From 52534630b182139052155a24a568bab092200f9d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:30:48 +0000 Subject: [PATCH] Deployed d8ea10b to main with MkDocs 1.6.1 and mike 2.1.3 --- main/CHANGLOG.html | 2 +- main/FAQ.html | 2 +- .../cv_modules/image_classification.html | 2 +- .../cv_modules/image_feature.html | 2 +- .../cv_modules/instance_segmentation.html | 2 +- .../cv_modules/ml_classification.html | 2 +- .../cv_modules/object_detection.html | 2 +- .../cv_modules/semantic_segmentation.html | 2 +- .../ocr_modules/table_recognition.html | 2 +- .../text_detection_recognition.html | 2 +- .../time_series_anomaly_detection.html | 2 +- .../time_series_classification.html | 2 +- .../time_series_forecasting.html | 2 +- main/en/CHANGLOG.html | 2 +- main/en/FAQ.html | 2 +- .../cv_modules/image_classification.html | 2 +- .../cv_modules/image_feature.html | 2 +- .../cv_modules/instance_segmentation.html | 2 +- .../cv_modules/ml_classification.html | 2 +- .../cv_modules/object_detection.html | 2 +- .../cv_modules/semantic_segmentation.html | 2 +- .../ocr_modules/table_recognition.html | 2 +- .../text_detection_recognition.html | 2 +- .../time_series_anomaly_detection.html | 2 +- .../time_series_classification.html | 2 +- .../time_series_forecasting.html | 2 +- main/en/index.html | 2 +- main/en/installation/installation.html | 2 +- .../en/installation/paddlepaddle_install.html | 2 +- .../module_usage/instructions/benchmark.html | 54 +- .../config_parameters_common.html | 2 +- .../config_parameters_time_series.html | 2 +- .../instructions/model_python_API.html | 2 +- .../cv_modules/anomaly_detection.html | 2 +- .../tutorials/cv_modules/face_detection.html | 2 +- .../tutorials/cv_modules/face_feature.html | 2 +- .../tutorials/cv_modules/human_detection.html | 2 +- .../cv_modules/image_classification.html | 2 +- .../tutorials/cv_modules/image_feature.html | 2 +- .../image_multilabel_classification.html | 2 +- .../cv_modules/instance_segmentation.html | 2 +- .../cv_modules/mainbody_detection.html | 2 +- .../cv_modules/object_detection.html | 2 +- .../pedestrian_attribute_recognition.html | 2 +- .../cv_modules/semantic_segmentation.html | 2 +- .../cv_modules/small_object_detection.html | 2 +- .../vehicle_attribute_recognition.html | 2 +- .../cv_modules/vehicle_detection.html | 2 +- .../doc_img_orientation_classification.html | 2 +- .../ocr_modules/formula_recognition.html | 2 +- .../ocr_modules/layout_detection.html | 2 +- .../ocr_modules/seal_text_detection.html | 2 +- .../table_structure_recognition.html | 2 +- .../tutorials/ocr_modules/text_detection.html | 2 +- .../ocr_modules/text_image_unwarping.html | 2 +- .../ocr_modules/text_recognition.html | 2 +- .../time_series_anomaly_detection.html | 2 +- .../time_series_classification.html | 2 +- .../time_series_forecasting.html | 2 +- .../how_to_contribute_device.html | 4441 +++++++++++++++++ .../how_to_contribute_model.html | 4424 ++++++++++++++++ .../multi_devices_use_guide.html | 6 +- .../paddlepaddle_install_DCU.html | 2 +- .../paddlepaddle_install_MLU.html | 2 +- .../paddlepaddle_install_NPU.html | 2 +- .../paddlepaddle_install_XPU.html | 2 +- main/en/pipeline_deploy/edge_deploy.html | 2 +- .../high_performance_inference.html | 213 +- main/en/pipeline_deploy/service_deploy.html | 2 +- .../instructions/pipeline_CLI_usage.html | 2 +- .../instructions/pipeline_python_API.html | 2 +- .../pipeline_develop_guide.html | 2 +- .../cv_pipelines/face_recognition.html | 2 +- .../general_image_recognition.html | 2 +- .../cv_pipelines/image_anomaly_detection.html | 2 +- .../cv_pipelines/image_classification.html | 2 +- .../image_multi_label_classification.html | 2 +- .../cv_pipelines/instance_segmentation.html | 2 +- .../cv_pipelines/object_detection.html | 2 +- .../pedestrian_attribute_recognition.html | 2 +- .../cv_pipelines/semantic_segmentation.html | 2 +- .../cv_pipelines/small_object_detection.html | 2 +- .../vehicle_attribute_recognition.html | 2 +- ...document_scene_information_extraction.html | 2 +- .../tutorials/ocr_pipelines/OCR.html | 2 +- .../ocr_pipelines/formula_recognition.html | 2 +- .../ocr_pipelines/layout_parsing.html | 2 +- .../ocr_pipelines/seal_recognition.html | 2 +- .../ocr_pipelines/table_recognition.html | 2 +- .../time_series_anomaly_detection.html | 2 +- .../time_series_classification.html | 2 +- .../time_series_forecasting.html | 2 +- .../anomaly_detection_tutorial.html | 2 +- .../anomaly_detection_tutorial_en.html | 2 +- .../deployment_tutorial.html | 2 +- ...extraction(layout_detection)_tutorial.html | 2 +- ...extraction(seal_recognition)_tutorial.html | 2 +- ...image_classification_garbage_tutorial.html | 2 +- ..._segmentation_remote_sensing_tutorial.html | 2 +- .../object_detection_fall_tutorial.html | 2 +- ...ject_detection_fashion_pedia_tutorial.html | 2 +- .../ocr_det_license_tutorial.html | 2 +- .../ocr_rec_chinese_tutorial.html | 2 +- .../semantic_segmentation_road_tutorial.html | 2 +- .../ts_anomaly_detection.html | 2 +- .../ts_classification.html | 2 +- main/en/practical_tutorials/ts_forecast.html | 2 +- main/en/quick_start.html | 2 +- main/en/support_list/model_list_dcu.html | 2 +- main/en/support_list/model_list_mlu.html | 2 +- main/en/support_list/model_list_npu.html | 2 +- main/en/support_list/model_list_xpu.html | 2 +- main/en/support_list/models_list.html | 2 +- main/en/support_list/pipelines_list.html | 2 +- main/en/support_list/pipelines_list_dcu.html | 2 +- main/en/support_list/pipelines_list_mlu.html | 2 +- main/en/support_list/pipelines_list_npu.html | 2 +- main/en/support_list/pipelines_list_xpu.html | 2 +- main/index.html | 2 +- main/installation/installation.html | 2 +- main/installation/paddlepaddle_install.html | 2 +- main/module_usage/instructions/benchmark.html | 54 +- .../config_parameters_common.html | 2 +- .../config_parameters_time_series.html | 2 +- .../instructions/model_python_API.html | 2 +- .../cv_modules/anomaly_detection.html | 2 +- .../tutorials/cv_modules/face_detection.html | 2 +- .../tutorials/cv_modules/face_feature.html | 2 +- .../tutorials/cv_modules/human_detection.html | 2 +- .../cv_modules/image_classification.html | 2 +- .../tutorials/cv_modules/image_feature.html | 2 +- .../image_multilabel_classification.html | 2 +- .../cv_modules/instance_segmentation.html | 2 +- .../cv_modules/mainbody_detection.html | 2 +- .../cv_modules/object_detection.html | 2 +- .../pedestrian_attribute_recognition.html | 2 +- .../cv_modules/semantic_segmentation.html | 2 +- .../cv_modules/small_object_detection.html | 2 +- .../vehicle_attribute_recognition.html | 2 +- .../cv_modules/vehicle_detection.html | 2 +- .../doc_img_orientation_classification.html | 2 +- .../ocr_modules/formula_recognition.html | 2 +- .../ocr_modules/layout_detection.html | 2 +- .../ocr_modules/seal_text_detection.html | 2 +- .../table_structure_recognition.html | 2 +- .../tutorials/ocr_modules/text_detection.html | 2 +- .../ocr_modules/text_image_unwarping.html | 2 +- .../ocr_modules/text_recognition.html | 2 +- .../time_series_anomaly_detection.html | 2 +- .../time_series_classification.html | 2 +- .../time_series_forecasting.html | 2 +- .../how_to_contribute_device.html | 4441 +++++++++++++++++ .../how_to_contribute_model.html | 4424 ++++++++++++++++ .../multi_devices_use_guide.html | 2 +- .../paddlepaddle_install_DCU.html | 2 +- .../paddlepaddle_install_MLU.html | 2 +- .../paddlepaddle_install_NPU.html | 2 +- .../paddlepaddle_install_XPU.html | 2 +- main/pipeline_deploy/edge_deploy.html | 2 +- .../high_performance_inference.html | 2 +- main/pipeline_deploy/service_deploy.html | 2 +- .../instructions/pipeline_CLI_usage.html | 2 +- .../instructions/pipeline_python_API.html | 2 +- .../pipeline_develop_guide.html | 2 +- .../cv_pipelines/face_recognition.html | 2 +- .../general_image_recognition.html | 2 +- .../cv_pipelines/image_anomaly_detection.html | 2 +- .../cv_pipelines/image_classification.html | 2 +- .../image_multi_label_classification.html | 2 +- .../cv_pipelines/instance_segmentation.html | 2 +- .../cv_pipelines/object_detection.html | 2 +- .../pedestrian_attribute_recognition.html | 2 +- .../cv_pipelines/semantic_segmentation.html | 2 +- .../cv_pipelines/small_object_detection.html | 2 +- .../vehicle_attribute_recognition.html | 2 +- ...document_scene_information_extraction.html | 2 +- .../tutorials/ocr_pipelines/OCR.html | 2 +- .../ocr_pipelines/formula_recognition.html | 2 +- .../ocr_pipelines/layout_parsing.html | 2 +- .../ocr_pipelines/seal_recognition.html | 2 +- .../ocr_pipelines/table_recognition.html | 2 +- .../time_series_anomaly_detection.html | 2 +- .../time_series_classification.html | 2 +- .../time_series_forecasting.html | 2 +- .../anomaly_detection_tutorial.html | 2 +- .../anomaly_detection_tutorial_en.html | 2 +- .../deployment_tutorial.html | 2 +- ...extraction(layout_detection)_tutorial.html | 2 +- ...extraction(seal_recognition)_tutorial.html | 2 +- ...image_classification_garbage_tutorial.html | 2 +- ..._segmentation_remote_sensing_tutorial.html | 2 +- .../object_detection_fall_tutorial.html | 2 +- ...ject_detection_fashion_pedia_tutorial.html | 2 +- .../ocr_det_license_tutorial.html | 2 +- .../ocr_rec_chinese_tutorial.html | 2 +- .../semantic_segmentation_road_tutorial.html | 2 +- .../ts_anomaly_detection.html | 2 +- .../ts_classification.html | 2 +- main/practical_tutorials/ts_forecast.html | 2 +- main/quick_start.html | 2 +- main/search/search_index.js | 2 +- main/search/search_index.json | 2 +- main/sitemap.xml | 28 + main/sitemap.xml.gz | Bin 3996 -> 4071 bytes main/support_list/model_list_dcu.html | 2 +- main/support_list/model_list_mlu.html | 2 +- main/support_list/model_list_npu.html | 2 +- main/support_list/model_list_xpu.html | 2 +- main/support_list/models_list.html | 2 +- main/support_list/pipelines_list.html | 2 +- main/support_list/pipelines_list_dcu.html | 2 +- main/support_list/pipelines_list_mlu.html | 2 +- main/support_list/pipelines_list_npu.html | 2 +- main/support_list/pipelines_list_xpu.html | 2 +- 214 files changed, 18176 insertions(+), 317 deletions(-) create mode 100644 main/en/other_devices_support/how_to_contribute_device.html create mode 100644 main/en/other_devices_support/how_to_contribute_model.html create mode 100644 main/other_devices_support/how_to_contribute_device.html create mode 100644 main/other_devices_support/how_to_contribute_model.html diff --git a/main/CHANGLOG.html b/main/CHANGLOG.html index e96739da30..46066c50f8 100644 --- a/main/CHANGLOG.html +++ b/main/CHANGLOG.html @@ -4692,7 +4692,7 @@

PaddleX v1.0.0(5.21/2020) diff --git a/main/FAQ.html b/main/FAQ.html index aff9c6feab..99d1471de3 100644 --- a/main/FAQ.html +++ b/main/FAQ.html @@ -4408,7 +4408,7 @@

Q:当我在使用PaddleX的过程中遇到问题,应 diff --git a/main/data_annotations/cv_modules/image_classification.html b/main/data_annotations/cv_modules/image_classification.html index 5715afdbef..efa4bd0237 100644 --- a/main/data_annotations/cv_modules/image_classification.html +++ b/main/data_annotations/cv_modules/image_classification.html @@ -4580,7 +4580,7 @@

2. 数据格式 diff --git a/main/data_annotations/cv_modules/image_feature.html b/main/data_annotations/cv_modules/image_feature.html index 75ce2214fc..6d1ce16e37 100644 --- a/main/data_annotations/cv_modules/image_feature.html +++ b/main/data_annotations/cv_modules/image_feature.html @@ -4584,7 +4584,7 @@

3. 数据格式 diff --git a/main/data_annotations/cv_modules/instance_segmentation.html b/main/data_annotations/cv_modules/instance_segmentation.html index 9e135ff7d0..ec5f6febbb 100644 --- a/main/data_annotations/cv_modules/instance_segmentation.html +++ b/main/data_annotations/cv_modules/instance_segmentation.html @@ -4598,7 +4598,7 @@

3. 数据格式 diff --git a/main/data_annotations/cv_modules/ml_classification.html b/main/data_annotations/cv_modules/ml_classification.html index 983a57211b..faf29098ab 100644 --- a/main/data_annotations/cv_modules/ml_classification.html +++ b/main/data_annotations/cv_modules/ml_classification.html @@ -4787,7 +4787,7 @@

5. 数据格式 diff --git a/main/data_annotations/cv_modules/object_detection.html b/main/data_annotations/cv_modules/object_detection.html index 8a715c5565..02c5242387 100644 --- a/main/data_annotations/cv_modules/object_detection.html +++ b/main/data_annotations/cv_modules/object_detection.html @@ -4746,7 +4746,7 @@

4. 数据格式 diff --git a/main/data_annotations/cv_modules/semantic_segmentation.html b/main/data_annotations/cv_modules/semantic_segmentation.html index 1e9d013948..7a23e6fbb7 100644 --- a/main/data_annotations/cv_modules/semantic_segmentation.html +++ b/main/data_annotations/cv_modules/semantic_segmentation.html @@ -4631,7 +4631,7 @@

数据格式 diff --git a/main/data_annotations/ocr_modules/table_recognition.html b/main/data_annotations/ocr_modules/table_recognition.html index ec02e3a23e..6d430d839b 100644 --- a/main/data_annotations/ocr_modules/table_recognition.html +++ b/main/data_annotations/ocr_modules/table_recognition.html @@ -4377,7 +4377,7 @@

2. 数据格式 diff --git a/main/data_annotations/ocr_modules/text_detection_recognition.html b/main/data_annotations/ocr_modules/text_detection_recognition.html index 7fa883d0a2..834fdc8a1c 100644 --- a/main/data_annotations/ocr_modules/text_detection_recognition.html +++ b/main/data_annotations/ocr_modules/text_detection_recognition.html @@ -4556,7 +4556,7 @@

3. 数据格式 diff --git a/main/data_annotations/time_series_modules/time_series_anomaly_detection.html b/main/data_annotations/time_series_modules/time_series_anomaly_detection.html index 70d3eb68e6..11fe23eb28 100644 --- a/main/data_annotations/time_series_modules/time_series_anomaly_detection.html +++ b/main/data_annotations/time_series_modules/time_series_anomaly_detection.html @@ -4285,7 +4285,7 @@

PaddleX时序异常检测任务模块数据标注教程 diff --git a/main/data_annotations/time_series_modules/time_series_classification.html b/main/data_annotations/time_series_modules/time_series_classification.html index 6afc4fe6b7..6c9c903e91 100644 --- a/main/data_annotations/time_series_modules/time_series_classification.html +++ b/main/data_annotations/time_series_modules/time_series_classification.html @@ -4286,7 +4286,7 @@

PaddleX时序分类任务模块数据标注教程AmberC0209 + zhang-prog diff --git a/main/data_annotations/time_series_modules/time_series_forecasting.html b/main/data_annotations/time_series_modules/time_series_forecasting.html index 6c0dac9504..d5e00ea7e7 100644 --- a/main/data_annotations/time_series_modules/time_series_forecasting.html +++ b/main/data_annotations/time_series_modules/time_series_forecasting.html @@ -4286,7 +4286,7 @@

PaddleX时序预测任务模块数据标注教程AmberC0209 + zhang-prog diff --git a/main/en/CHANGLOG.html b/main/en/CHANGLOG.html index 32af505dd1..12c759e724 100644 --- a/main/en/CHANGLOG.html +++ b/main/en/CHANGLOG.html @@ -4666,7 +4666,7 @@

PaddleX v1.0.0 (5.21/2020) diff --git a/main/en/FAQ.html b/main/en/FAQ.html index dd614cd741..3e9df52730 100644 --- a/main/en/FAQ.html +++ b/main/en/FAQ.html @@ -4408,7 +4408,7 @@

AmberC0209 + zhang-prog diff --git a/main/en/data_annotations/cv_modules/image_classification.html b/main/en/data_annotations/cv_modules/image_classification.html index d3555f374b..5b83985892 100644 --- a/main/en/data_annotations/cv_modules/image_classification.html +++ b/main/en/data_annotations/cv_modules/image_classification.html @@ -4563,7 +4563,7 @@

2. Data Format diff --git a/main/en/data_annotations/cv_modules/image_feature.html b/main/en/data_annotations/cv_modules/image_feature.html index e6cd1e3650..08c70cbf23 100644 --- a/main/en/data_annotations/cv_modules/image_feature.html +++ b/main/en/data_annotations/cv_modules/image_feature.html @@ -4584,7 +4584,7 @@

3. Data Format diff --git a/main/en/data_annotations/cv_modules/instance_segmentation.html b/main/en/data_annotations/cv_modules/instance_segmentation.html index 4b4e562f69..5293e3b3d4 100644 --- a/main/en/data_annotations/cv_modules/instance_segmentation.html +++ b/main/en/data_annotations/cv_modules/instance_segmentation.html @@ -4602,7 +4602,7 @@

3. Data Format diff --git a/main/en/data_annotations/cv_modules/ml_classification.html b/main/en/data_annotations/cv_modules/ml_classification.html index eb55c129a1..dce8144836 100644 --- a/main/en/data_annotations/cv_modules/ml_classification.html +++ b/main/en/data_annotations/cv_modules/ml_classification.html @@ -4796,7 +4796,7 @@

5. Data Format diff --git a/main/en/data_annotations/cv_modules/object_detection.html b/main/en/data_annotations/cv_modules/object_detection.html index 5be8686406..b586afade0 100644 --- a/main/en/data_annotations/cv_modules/object_detection.html +++ b/main/en/data_annotations/cv_modules/object_detection.html @@ -4746,7 +4746,7 @@

4. Data Format diff --git a/main/en/data_annotations/cv_modules/semantic_segmentation.html b/main/en/data_annotations/cv_modules/semantic_segmentation.html index 8420eb27b3..a41697bf2d 100644 --- a/main/en/data_annotations/cv_modules/semantic_segmentation.html +++ b/main/en/data_annotations/cv_modules/semantic_segmentation.html @@ -4631,7 +4631,7 @@

Data Format diff --git a/main/en/data_annotations/ocr_modules/table_recognition.html b/main/en/data_annotations/ocr_modules/table_recognition.html index 8d2a2cbb9e..3d55eb9428 100644 --- a/main/en/data_annotations/ocr_modules/table_recognition.html +++ b/main/en/data_annotations/ocr_modules/table_recognition.html @@ -4375,7 +4375,7 @@

2. Data Format diff --git a/main/en/data_annotations/ocr_modules/text_detection_recognition.html b/main/en/data_annotations/ocr_modules/text_detection_recognition.html index 48b1226041..c5dbb134ad 100644 --- a/main/en/data_annotations/ocr_modules/text_detection_recognition.html +++ b/main/en/data_annotations/ocr_modules/text_detection_recognition.html @@ -4556,7 +4556,7 @@

3. Data Format diff --git a/main/en/data_annotations/time_series_modules/time_series_anomaly_detection.html b/main/en/data_annotations/time_series_modules/time_series_anomaly_detection.html index b65d9eb6c6..23dbff886c 100644 --- a/main/en/data_annotations/time_series_modules/time_series_anomaly_detection.html +++ b/main/en/data_annotations/time_series_modules/time_series_anomaly_detection.html @@ -4285,7 +4285,7 @@

AmberC0209 + zhang-prog diff --git a/main/en/data_annotations/time_series_modules/time_series_classification.html b/main/en/data_annotations/time_series_modules/time_series_classification.html index ab3ee9aa07..f8fc2a23d4 100644 --- a/main/en/data_annotations/time_series_modules/time_series_classification.html +++ b/main/en/data_annotations/time_series_modules/time_series_classification.html @@ -4286,7 +4286,7 @@

Paddle diff --git a/main/en/data_annotations/time_series_modules/time_series_forecasting.html b/main/en/data_annotations/time_series_modules/time_series_forecasting.html index e1be2e6490..cf18dca663 100644 --- a/main/en/data_annotations/time_series_modules/time_series_forecasting.html +++ b/main/en/data_annotations/time_series_modules/time_series_forecasting.html @@ -4286,7 +4286,7 @@

PaddleX T diff --git a/main/en/index.html b/main/en/index.html index 398f5155ce..55895d7223 100644 --- a/main/en/index.html +++ b/main/en/index.html @@ -4833,7 +4833,7 @@

📄 LicenseAmberC0209 + zhang-prog diff --git a/main/en/installation/installation.html b/main/en/installation/installation.html index 201fe2d597..8c040ffaab 100644 --- a/main/en/installation/installation.html +++ b/main/en/installation/installation.html @@ -4688,7 +4688,7 @@

2.2.2 Install PaddleXAmberC0209 + zhang-prog diff --git a/main/en/installation/paddlepaddle_install.html b/main/en/installation/paddlepaddle_install.html index db7dc4fc72..9be7285a2c 100644 --- a/main/en/installation/paddlepaddle_install.html +++ b/main/en/installation/paddlepaddle_install.html @@ -4407,7 +4407,7 @@

Installing PaddlePaddle via pip diff --git a/main/en/module_usage/instructions/benchmark.html b/main/en/module_usage/instructions/benchmark.html index c64a6a214f..04a69dd57c 100644 --- a/main/en/module_usage/instructions/benchmark.html +++ b/main/en/module_usage/instructions/benchmark.html @@ -4232,42 +4232,42 @@

模型推理 Benchmark
+----------------+-----------------+-----------------+------------------------+
 |   Component    | Total Time (ms) | Number of Calls | Avg Time Per Call (ms) |
 +----------------+-----------------+-----------------+------------------------+
-|    ReadCmp     |   100.20136833  |        10       |      10.02013683       |
-|     Resize     |   17.05980301   |        20       |       0.85299015       |
-|   Normalize    |   45.44949532   |        20       |       2.27247477       |
-|   ToCHWImage   |    0.03671646   |        20       |       0.00183582       |
-|    Copy2GPU    |   12.28785515   |        10       |       1.22878551       |
-|     Infer      |   76.59482956   |        10       |       7.65948296       |
-|    Copy2CPU    |    0.39863586   |        10       |       0.03986359       |
-| DetPostProcess |    0.43916702   |        20       |       0.02195835       |
+|    ReadCmp     |   99.60412979   |        10       |       9.96041298       |
+|     Resize     |   17.01641083   |        20       |       0.85082054       |
+|   Normalize    |   44.61312294   |        20       |       2.23065615       |
+|   ToCHWImage   |    0.03385544   |        20       |       0.00169277       |
+|    Copy2GPU    |   13.46874237   |        10       |       1.34687424       |
+|     Infer      |   71.31743431   |        10       |       7.13174343       |
+|    Copy2CPU    |    0.39076805   |        10       |       0.03907681       |
+| DetPostProcess |    0.36168098   |        20       |       0.01808405       |
 +----------------+-----------------+-----------------+------------------------+
 +-------------+-----------------+---------------------+----------------------------+
 |    Stage    | Total Time (ms) | Number of Instances | Avg Time Per Instance (ms) |
 +-------------+-----------------+---------------------+----------------------------+
-|  PreProcess |   162.74738312  |          20         |         8.13736916         |
-|  Inference  |   89.28132057   |          20         |         4.46406603         |
-| PostProcess |    0.43916702   |          20         |         0.02195835         |
-|   End2End   |    0.27992606   |          20         |         0.01399630         |
-|    WarmUp   |    5.37562728   |          5          |         1.07512546         |
+|  PreProcess |   161.26751900  |          20         |         8.06337595         |
+|  Inference  |   85.17694473   |          20         |         4.25884724         |
+| PostProcess |    0.36168098   |          20         |         0.01808405         |
+|   End2End   |   256.90770149  |          20         |        12.84538507         |
+|    WarmUp   |  5412.37807274  |          10         |        541.23780727        |
 +-------------+-----------------+---------------------+----------------------------+
 

在 Benchmark 结果中,会统计该模型全部组件(Component)的总耗时(Total Time,单位为“毫秒”)、调用次数Number of Calls)、调用**平均执行耗时(Avg Time Per Call,单位“毫秒”),以及按预热(WarmUp)、预处理(PreProcess)、模型推理(Inference)、后处理(PostProcess)和端到端(End2End)进行划分的耗时统计,包括每个阶段的总耗时(Total Time,单位为“毫秒”)、**样本数Number of Instances)和**单样本**平均执行耗时(Avg Time Per Instance,单位“毫秒”),同时,上述指标会保存到到本地: ./benchmark/detail.csv./benchmark/summary.csv

Component,Total Time (ms),Number of Calls,Avg Time Per Call (ms)
-ReadCmp,100.20136833190918,10,10.020136833190918
-Resize,17.059803009033203,20,0.8529901504516602
-Normalize,45.44949531555176,20,2.272474765777588
-ToCHWImage,0.036716461181640625,20,0.0018358230590820312
-Copy2GPU,12.28785514831543,10,1.228785514831543
-Infer,76.59482955932617,10,7.659482955932617
-Copy2CPU,0.3986358642578125,10,0.03986358642578125
-DetPostProcess,0.4391670227050781,20,0.021958351135253906
+ReadCmp,99.60412979125977,10,9.960412979125977
+Resize,17.01641082763672,20,0.8508205413818359
+Normalize,44.61312294006348,20,2.230656147003174
+ToCHWImage,0.033855438232421875,20,0.0016927719116210938
+Copy2GPU,13.468742370605469,10,1.3468742370605469
+Infer,71.31743431091309,10,7.131743431091309
+Copy2CPU,0.39076805114746094,10,0.039076805114746094
+DetPostProcess,0.3616809844970703,20,0.018084049224853516
 
Stage,Total Time (ms),Number of Instances,Avg Time Per Instance (ms)
-PreProcess,162.74738311767578,20,8.137369155883789
-Inference,89.28132057189941,20,4.464066028594971
-PostProcess,0.4391670227050781,20,0.021958351135253906
-End2End,0.279926061630249,20,0.013996303081512451
-WarmUp,5.375627279281616,5,1.0751254558563232
+PreProcess,161.26751899719238,20,8.06337594985962
+Inference,85.17694473266602,20,4.258847236633301
+PostProcess,0.3616809844970703,20,0.018084049224853516
+End2End,256.90770149230957,20,12.845385074615479
+WarmUp,5412.3780727386475,10,541.2378072738647
 
@@ -4316,7 +4316,7 @@

模型推理 Benchmark diff --git a/main/en/module_usage/instructions/config_parameters_common.html b/main/en/module_usage/instructions/config_parameters_common.html index 77073b0deb..8ab0af0519 100644 --- a/main/en/module_usage/instructions/config_parameters_common.html +++ b/main/en/module_usage/instructions/config_parameters_common.html @@ -4542,7 +4542,7 @@

PredictAmberC0209 + zhang-prog diff --git a/main/en/module_usage/instructions/config_parameters_time_series.html b/main/en/module_usage/instructions/config_parameters_time_series.html index db692a5dc5..d513735c42 100644 --- a/main/en/module_usage/instructions/config_parameters_time_series.html +++ b/main/en/module_usage/instructions/config_parameters_time_series.html @@ -4600,7 +4600,7 @@

PredictAmberC0209 + zhang-prog diff --git a/main/en/module_usage/instructions/model_python_API.html b/main/en/module_usage/instructions/model_python_API.html index fa15877e90..ae5963072c 100644 --- a/main/en/module_usage/instructions/model_python_API.html +++ b/main/en/module_usage/instructions/model_python_API.html @@ -4671,7 +4671,7 @@

Methods:AmberC0209 + zhang-prog diff --git a/main/en/module_usage/tutorials/cv_modules/anomaly_detection.html b/main/en/module_usage/tutorials/cv_modules/anomaly_detection.html index c6b27ca689..ab3093c5e0 100644 --- a/main/en/module_usage/tutorials/cv_modules/anomaly_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/anomaly_detection.html @@ -4755,7 +4755,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/face_detection.html b/main/en/module_usage/tutorials/cv_modules/face_detection.html index 54a48c7532..ff6308addc 100644 --- a/main/en/module_usage/tutorials/cv_modules/face_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/face_detection.html @@ -4844,7 +4844,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/face_feature.html b/main/en/module_usage/tutorials/cv_modules/face_feature.html index 6b10e0a5f4..07cbbeb1b8 100644 --- a/main/en/module_usage/tutorials/cv_modules/face_feature.html +++ b/main/en/module_usage/tutorials/cv_modules/face_feature.html @@ -4773,7 +4773,7 @@

4.2 Model TrainingAmberC0209 + zhang-prog diff --git a/main/en/module_usage/tutorials/cv_modules/human_detection.html b/main/en/module_usage/tutorials/cv_modules/human_detection.html index 52c2847347..b53a640242 100644 --- a/main/en/module_usage/tutorials/cv_modules/human_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/human_detection.html @@ -4821,7 +4821,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/image_classification.html b/main/en/module_usage/tutorials/cv_modules/image_classification.html index 8f56a741d6..37e4862900 100644 --- a/main/en/module_usage/tutorials/cv_modules/image_classification.html +++ b/main/en/module_usage/tutorials/cv_modules/image_classification.html @@ -5467,7 +5467,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/image_feature.html b/main/en/module_usage/tutorials/cv_modules/image_feature.html index 9780de0478..e4b5930272 100644 --- a/main/en/module_usage/tutorials/cv_modules/image_feature.html +++ b/main/en/module_usage/tutorials/cv_modules/image_feature.html @@ -4896,7 +4896,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/image_multilabel_classification.html b/main/en/module_usage/tutorials/cv_modules/image_multilabel_classification.html index 743312c74b..d196e08478 100644 --- a/main/en/module_usage/tutorials/cv_modules/image_multilabel_classification.html +++ b/main/en/module_usage/tutorials/cv_modules/image_multilabel_classification.html @@ -4891,7 +4891,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/instance_segmentation.html b/main/en/module_usage/tutorials/cv_modules/instance_segmentation.html index ea47a99659..f9be982796 100644 --- a/main/en/module_usage/tutorials/cv_modules/instance_segmentation.html +++ b/main/en/module_usage/tutorials/cv_modules/instance_segmentation.html @@ -4981,7 +4981,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/mainbody_detection.html b/main/en/module_usage/tutorials/cv_modules/mainbody_detection.html index 6ac16816a2..792ecd2b34 100644 --- a/main/en/module_usage/tutorials/cv_modules/mainbody_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/mainbody_detection.html @@ -4821,7 +4821,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/object_detection.html b/main/en/module_usage/tutorials/cv_modules/object_detection.html index 4a4bd59377..012d58d61f 100644 --- a/main/en/module_usage/tutorials/cv_modules/object_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/object_detection.html @@ -5191,7 +5191,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html b/main/en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html index 82907f0668..914a272c38 100644 --- a/main/en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html +++ b/main/en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html @@ -4840,7 +4840,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/semantic_segmentation.html b/main/en/module_usage/tutorials/cv_modules/semantic_segmentation.html index 8948ee74f7..412b452c4b 100644 --- a/main/en/module_usage/tutorials/cv_modules/semantic_segmentation.html +++ b/main/en/module_usage/tutorials/cv_modules/semantic_segmentation.html @@ -5015,7 +5015,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/small_object_detection.html b/main/en/module_usage/tutorials/cv_modules/small_object_detection.html index c9045d0b0a..7f2af9d1f7 100644 --- a/main/en/module_usage/tutorials/cv_modules/small_object_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/small_object_detection.html @@ -4866,7 +4866,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html b/main/en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html index 3d167d775a..9b05d6f39c 100644 --- a/main/en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html +++ b/main/en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html @@ -4825,7 +4825,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/cv_modules/vehicle_detection.html b/main/en/module_usage/tutorials/cv_modules/vehicle_detection.html index 9f83e54314..361868345f 100644 --- a/main/en/module_usage/tutorials/cv_modules/vehicle_detection.html +++ b/main/en/module_usage/tutorials/cv_modules/vehicle_detection.html @@ -4602,7 +4602,7 @@

II. Supported Model List diff --git a/main/en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html b/main/en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html index 31100270e0..8591fb41ef 100644 --- a/main/en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html +++ b/main/en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html @@ -4840,7 +4840,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/ocr_modules/formula_recognition.html b/main/en/module_usage/tutorials/ocr_modules/formula_recognition.html index 5f7e6fd14c..2adea8dc86 100644 --- a/main/en/module_usage/tutorials/ocr_modules/formula_recognition.html +++ b/main/en/module_usage/tutorials/ocr_modules/formula_recognition.html @@ -4851,7 +4851,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/ocr_modules/layout_detection.html b/main/en/module_usage/tutorials/ocr_modules/layout_detection.html index b77a32639e..a4c8562df7 100644 --- a/main/en/module_usage/tutorials/ocr_modules/layout_detection.html +++ b/main/en/module_usage/tutorials/ocr_modules/layout_detection.html @@ -4877,7 +4877,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/ocr_modules/seal_text_detection.html b/main/en/module_usage/tutorials/ocr_modules/seal_text_detection.html index 7ddce7d594..272fb327b6 100644 --- a/main/en/module_usage/tutorials/ocr_modules/seal_text_detection.html +++ b/main/en/module_usage/tutorials/ocr_modules/seal_text_detection.html @@ -4843,7 +4843,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/ocr_modules/table_structure_recognition.html b/main/en/module_usage/tutorials/ocr_modules/table_structure_recognition.html index 6870ecd587..b5c3821ad5 100644 --- a/main/en/module_usage/tutorials/ocr_modules/table_structure_recognition.html +++ b/main/en/module_usage/tutorials/ocr_modules/table_structure_recognition.html @@ -4840,7 +4840,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/ocr_modules/text_detection.html b/main/en/module_usage/tutorials/ocr_modules/text_detection.html index c169b781f1..24484223e6 100644 --- a/main/en/module_usage/tutorials/ocr_modules/text_detection.html +++ b/main/en/module_usage/tutorials/ocr_modules/text_detection.html @@ -4817,7 +4817,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/ocr_modules/text_image_unwarping.html b/main/en/module_usage/tutorials/ocr_modules/text_image_unwarping.html index 3b7f0304b9..f995e2548b 100644 --- a/main/en/module_usage/tutorials/ocr_modules/text_image_unwarping.html +++ b/main/en/module_usage/tutorials/ocr_modules/text_image_unwarping.html @@ -4445,7 +4445,7 @@

IV. Custom Development diff --git a/main/en/module_usage/tutorials/ocr_modules/text_recognition.html b/main/en/module_usage/tutorials/ocr_modules/text_recognition.html index 0a6fab0b68..fd9f47b192 100644 --- a/main/en/module_usage/tutorials/ocr_modules/text_recognition.html +++ b/main/en/module_usage/tutorials/ocr_modules/text_recognition.html @@ -4895,7 +4895,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html b/main/en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html index 22602eb18f..ab4ef51ded 100644 --- a/main/en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html +++ b/main/en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html @@ -4896,7 +4896,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/time_series_modules/time_series_classification.html b/main/en/module_usage/tutorials/time_series_modules/time_series_classification.html index 60c3574f4f..2ea0d6e9ec 100644 --- a/main/en/module_usage/tutorials/time_series_modules/time_series_classification.html +++ b/main/en/module_usage/tutorials/time_series_modules/time_series_classification.html @@ -4870,7 +4870,7 @@

4.4.2 Model Integration diff --git a/main/en/module_usage/tutorials/time_series_modules/time_series_forecasting.html b/main/en/module_usage/tutorials/time_series_modules/time_series_forecasting.html index 113f925f8d..74c7b35870 100644 --- a/main/en/module_usage/tutorials/time_series_modules/time_series_forecasting.html +++ b/main/en/module_usage/tutorials/time_series_modules/time_series_forecasting.html @@ -4926,7 +4926,7 @@

4.4.2 Model Integration diff --git a/main/en/other_devices_support/how_to_contribute_device.html b/main/en/other_devices_support/how_to_contribute_device.html new file mode 100644 index 0000000000..d7fac3e3c1 --- /dev/null +++ b/main/en/other_devices_support/how_to_contribute_device.html @@ -0,0 +1,4441 @@ + + + + + + + + + + + + + + + + + + + + + 1. More Device Support - PaddleX Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + +

1. More Device Support

+

The prosperity of the PaddlePaddle ecosystem is inseparable from the contributions of developers and users. We warmly welcome you to provide more device compatibility for PaddleX and greatly appreciate your feedback.

+

Currently, PaddleX supports Intel/Apple M series CPU, NVIDIA GPUs, XPU, Ascend NPU, Hygon DCU, and MLU. If the device you wish to support is not within the current scope, you can contribute by following the methods below.

+

1.1 Integration Device into PaddlePaddle Backend

+

The PaddlePaddle deep learning framework provides multiple integration solutions, including operator development and mapping, subgraph and whole graph integration, deep learning compiler backend integration, and open neural network format conversion. Device vendors can flexibly choose based on their chip architecture design and software stack maturity. For specific details, please refer to PaddlePaddle Custom Device Integration Solutions.

+

1.2 Support for PaddleCV devkits

+

Since PaddleX is based on the PaddlePaddle model library, after the device completes the integration into the PaddlePaddle backend, select the corresponding devkit to submit code based on the models already supported by the device to ensure that the relevant devkits are adapted to the corresponding device. Refer to the contribution guides for each devkit:

+
    +
  1. +

    PaddleClas

    +
  2. +
  3. +

    PaddleDetection

    +
  4. +
  5. +

    PaddleSeg

    +
  6. +
  7. +

    PaddleOCR

    +
  8. +
  9. +

    PaddleTS

    +
  10. +
+

2. Updating PaddleX

+

After completing the device integration into PaddlePaddle and the PaddleCV devkits, you need to update the device recognition-related code and documentation in PaddleX.

+

2.1 Inference Support

+

2.1.1 Version Support (Optional)

+

If the relevant device has specific requirements for the PaddlePaddle version, you can make judgments based on device information and version information during initialization. The relevant code is located in the _check_paddle_version function in PaddleX Initialization.

+

2.1.2 Setting Environment Variables (Optional)

+

If special environment variables need to be set when using the relevant device, you can modify the device environment setup code. The relevant code is located in the set_env_for_device function in PaddleX Environment Variable Settings.

+

2.1.3 Creating a Predictor

+

PaddleX's inference capability is provided based on the Paddle Inference Predictor. When creating a Predictor, you need to select different device based on device information and create passes. The relevant code is located in the _create function in PaddleX Predictor Creation.

+

2.1.4 Updating the Device Support List

+

When creating a Predictor, it will judge whether the device is already supported. The relevant code is located in the SUPPORT_DEVICE constant in PaddleX Predictor Option.

+

2.1.5 Updating the Multi-Devices User Guide

+

Please update the PaddleX multi-devices user guide and add the newly supported device information to the documentation. Both Chinese and English versions need to be updated. The Chinese version is PaddleX多硬件使用指南, and the English version is PaddleX Multi-Devices Usage Guide.

+

2.1.6 Updating the Installation Tutorial

+

Please provide device-related installation tutorials in both Chinese and English. The Chinese version can refer to 昇腾 NPU 飞桨安装教程, and the English version can refer to Ascend NPU PaddlePaddle Installation Tutorial.

+

2.1.7 Updating the Model List

+

Please provide a list of models supported by the device in both Chinese and English. The Chinese version can refer to PaddleX模型列表(昇腾 NPU), and the English version can refer to PaddleX Model List (Huawei Ascend NPU).

+

2.2 Training Support

+

TODO

+

3. Submitting a PR

+

When you complete the device adaptation work, please submit a Pull Request to PaddleX with relevant information. We will validate the model and merge the relevant code after confirmation.

+

The relevant PR needs to provide information on reproducing model accuracy, including at least the following:

+
    +
  • +

    The software versions used to validate model accuracy, including but not limited to:

    +
  • +
  • +

    Paddle version

    +
  • +
  • +

    PaddleCustomDevice version (if any)

    +
  • +
  • +

    The branch of PaddleX or the corresponding devkit

    +
  • +
  • +

    The machine environment used to validate model accuracy, including but not limited to:

    +
  • +
  • +

    Chip model

    +
  • +
  • +

    Operating system version

    +
  • +
  • +

    Device driver version

    +
  • +
  • +

    Operator library version, etc.

    +
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/en/other_devices_support/how_to_contribute_model.html b/main/en/other_devices_support/how_to_contribute_model.html new file mode 100644 index 0000000000..9c6b9f85e9 --- /dev/null +++ b/main/en/other_devices_support/how_to_contribute_model.html @@ -0,0 +1,4424 @@ + + + + + + + + + + + + + + + + + + + + + 1. Contributing Models - PaddleX Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + +

1. Contributing Models

+

The prosperity of the PaddlePaddle ecosystem is inseparable from the contributions of developers and users. We warmly welcome you to contribute more models for multi-hardware compatibility to PaddlePaddle and greatly appreciate your feedback.

+

The current list of hardware-compatible models in PaddleX is as follows. You can check whether the relevant models have been adapted for the corresponding hardware:

+ +

The source code for current PaddleX-related models is placed in various kits, and some kits and models have not been integrated into PaddleX. Therefore, before adapting a model, please ensure that your model is already integrated into PaddleX. For the current list of PaddleX models, see PaddleX Model Library. If you have specific model requirements, please submit an issue to inform us.

+

If the model you are adapting involves modifications to the model networking code on the relevant hardware, please submit the code to the corresponding kit first, referring to the contribution guides for each kit:

+
    +
  1. +

    PaddleClas

    +
  2. +
  3. +

    PaddleDetection

    +
  4. +
  5. +

    PaddleSeg

    +
  6. +
  7. +

    PaddleOCR

    +
  8. +
  9. +

    PaddleTS

    +
  10. +
+

2. Submitting an Issue for Explanation

+

When you have completed the adaptation of a model on a specific hardware, please submit an issue to PaddleX explaining the relevant information. We will verify the model and, upon confirmation of no issues, merge the relevant code and update the model list in the documentation.

+

The relevant issue needs to provide information to reproduce the model's accuracy, including at least the following:

+
    +
  • +

    The software versions used to verify the model's accuracy, including but not limited to:

    +
  • +
  • +

    Paddle version

    +
  • +
  • +

    PaddleCustomDevice version (if applicable)

    +
  • +
  • +

    Branch of PaddleX or the corresponding kit

    +
  • +
  • +

    The machine environment used to verify the model's accuracy, including but not limited to:

    +
  • +
  • +

    Chip model

    +
  • +
  • +

    Operating system version

    +
  • +
  • +

    Hardware driver version

    +
  • +
  • +

    Operator library version, etc.

    +
  • +
+

3. More Documentation

+

For more documentation related to multi-hardware compatibility and usage in PaddlePaddle, please refer to:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/en/other_devices_support/multi_devices_use_guide.html b/main/en/other_devices_support/multi_devices_use_guide.html index d691a2f580..6a0417b6fa 100644 --- a/main/en/other_devices_support/multi_devices_use_guide.html +++ b/main/en/other_devices_support/multi_devices_use_guide.html @@ -88,7 +88,7 @@
- + Skip to content @@ -4398,7 +4398,7 @@ -

PaddleX Multi-Hardware Usage Guide

+

PaddleX Multi-Devices Usage Guide

This document focuses on the usage guide of PaddleX for Huawei Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU hardware platforms.

1. Installation

1.1 PaddlePaddle Installation

@@ -4575,7 +4575,7 @@

2. UsageAmberC0209 + zhang-prog diff --git a/main/en/other_devices_support/paddlepaddle_install_DCU.html b/main/en/other_devices_support/paddlepaddle_install_DCU.html index 971b2a2f40..566a1429cb 100644 --- a/main/en/other_devices_support/paddlepaddle_install_DCU.html +++ b/main/en/other_devices_support/paddlepaddle_install_DCU.html @@ -4372,7 +4372,7 @@

2. Install PaddlePaddle Package diff --git a/main/en/other_devices_support/paddlepaddle_install_MLU.html b/main/en/other_devices_support/paddlepaddle_install_MLU.html index 622943de5a..9c4de72215 100644 --- a/main/en/other_devices_support/paddlepaddle_install_MLU.html +++ b/main/en/other_devices_support/paddlepaddle_install_MLU.html @@ -4379,7 +4379,7 @@

2. Install Paddle Package diff --git a/main/en/other_devices_support/paddlepaddle_install_NPU.html b/main/en/other_devices_support/paddlepaddle_install_NPU.html index a917ab61c9..65a15da21c 100644 --- a/main/en/other_devices_support/paddlepaddle_install_NPU.html +++ b/main/en/other_devices_support/paddlepaddle_install_NPU.html @@ -4387,7 +4387,7 @@

2. Install Paddle Package diff --git a/main/en/other_devices_support/paddlepaddle_install_XPU.html b/main/en/other_devices_support/paddlepaddle_install_XPU.html index 68b566c921..6881b681d8 100644 --- a/main/en/other_devices_support/paddlepaddle_install_XPU.html +++ b/main/en/other_devices_support/paddlepaddle_install_XPU.html @@ -4374,7 +4374,7 @@

2. Install Paddle Package diff --git a/main/en/pipeline_deploy/edge_deploy.html b/main/en/pipeline_deploy/edge_deploy.html index 3ce68aba17..6738629934 100644 --- a/main/en/pipeline_deploy/edge_deploy.html +++ b/main/en/pipeline_deploy/edge_deploy.html @@ -4726,7 +4726,7 @@

Feedback SectionAmberC0209 + zhang-prog diff --git a/main/en/pipeline_deploy/high_performance_inference.html b/main/en/pipeline_deploy/high_performance_inference.html index d950f2d6cc..67a846105a 100644 --- a/main/en/pipeline_deploy/high_performance_inference.html +++ b/main/en/pipeline_deploy/high_performance_inference.html @@ -4531,147 +4531,248 @@

2. - - + + + - - - + + + - - - + + - - - + + + - - - + + + + + + + - - - + + - + - - + + + + + + + + + + + + + + + + + + - - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + - - - + + - + + + + + + + + - + - - + + - + + + - - + + - + + - + + + - + + - - + + + - + + - - + + + - - + + + + + + + + + + + + +
PipelinePipeline ModuleSpecific ModelsModuleModel Support List
General Image ClassificationImage ClassificationResNet18
ResNet34
- moreResNet50
ResNet101
ResNet152
ResNet18_vd
ResNet34_vd
ResNet50_vd
ResNet101_vd
ResNet152_vd
ResNet200_vd
PP-LCNet_x0_25
PP-LCNet_x0_35
PP-LCNet_x0_5
PP-LCNet_x0_75
PP-LCNet_x1_0
PP-LCNet_x1_5
PP-LCNet_x2_0
PP-LCNet_x2_5
PP-LCNetV2_small
PP-LCNetV2_base
PP-LCNetV2_large
MobileNetV3_large_x0_35
MobileNetV3_large_x0_5
MobileNetV3_large_x0_75
MobileNetV3_large_x1_0
MobileNetV3_large_x1_25
MobileNetV3_small_x0_35
MobileNetV3_small_x0_5
MobileNetV3_small_x0_75
MobileNetV3_small_x1_0
MobileNetV3_small_x1_25
ConvNeXt_tiny
ConvNeXt_small
ConvNeXt_base_224
ConvNeXt_base_384
ConvNeXt_large_224
ConvNeXt_large_384
MobileNetV1_x0_25
MobileNetV1_x0_5
MobileNetV1_x0_75
MobileNetV1_x1_0
MobileNetV2_x0_25
MobileNetV2_x0_5
MobileNetV2_x1_0
MobileNetV2_x1_5
MobileNetV2_x2_0
SwinTransformer_tiny_patch4_window7_224
SwinTransformer_small_patch4_window7_224
SwinTransformer_base_patch4_window7_224
SwinTransformer_base_patch4_window12_384
SwinTransformer_large_patch4_window7_224
SwinTransformer_large_patch4_window12_384
PP-HGNet_small
PP-HGNet_tiny
PP-HGNet_base
PP-HGNetV2-B0
PP-HGNetV2-B1
PP-HGNetV2-B2
PP-HGNetV2-B3
PP-HGNetV2-B4
PP-HGNetV2-B5
PP-HGNetV2-B6
CLIP_vit_base_patch16_224
CLIP_vit_large_patch14_224
OCRText Detection
General Object DetectionObject DetectionPP-YOLOE_plus-S
PP-YOLOE_plus-M
- morePP-YOLOE_plus-L
PP-YOLOE_plus-X
YOLOX-N
YOLOX-T
YOLOX-S
YOLOX-M
YOLOX-L
YOLOX-X
YOLOv3-DarkNet53
YOLOv3-ResNet50_vd_DCN
YOLOv3-MobileNetV3
RT-DETR-R18
RT-DETR-R50
RT-DETR-L
RT-DETR-H
RT-DETR-X
PicoDet-S
PicoDet-L
Text Recognition
General Semantic SegmentationSemantic SegmentationDeeplabv3-R50
Deeplabv3-R101
- moreDeeplabv3_Plus-R50
Deeplabv3_Plus-R101
PP-LiteSeg-T
OCRNet_HRNet-W48
OCRNet_HRNet-W18
SeaFormer_tiny
SeaFormer_small
SeaFormer_base
SeaFormer_large
SegFormer-B0
SegFormer-B1
SegFormer-B2
SegFormer-B3
SegFormer-B4
SegFormer-B5
PP-ChatOCRv3Table Recognition
General Instance SegmentationInstance SegmentationMask-RT-DETR-L
Mask-RT-DETR-H
Layout Detection
Text Detection
Seal Text RecognitionLayout AnalysisPicoDet-S_layout_3cls
PicoDet-S_layout_17cls
- morePicoDet-L_layout_3cls
PicoDet-L_layout_17cls
RT-DETR-H_layout_3cls
RT-DETR-H_layout_17cls
Text Recognition
Seal Text DetectionPP-OCRv4_server_seal_det
PP-OCRv4_mobile_seal_det
Text RecognitionPP-OCRv4_mobile_rec
PP-OCRv4_server_rec
Text Image Unwarping
Document Image Orientation Classification
Table RecognitionLayout Detection
Table Recognition
General OCR Text DetectionPP-OCRv4_server_det
PP-OCRv4_mobile_det
Text RecognitionPP-OCRv4_server_rec
PP-OCRv4_mobile_rec
ch_RepSVTR_rec
ch_SVTRv2_rec
General Table RecognitionLayout DetectionPicoDet_layout_1xObject DetectionObject DetectionFasterRCNN-Swin-Tiny-FPN ❌
CenterNet-DLA-34 ❌
CenterNet-ResNet50 ❌
Instance SegmentationInstance SegmentationMask-RT-DETR-S ❌
Image ClassificationImage Classification
Semantic SegmentationSemantic Segmentation
Time Series ForecastingTime Series Forecasting
Time Series Anomaly DetectionTime Series Anomaly Forecasting
Table RecognitionSLANetTime Series ClassificationTime Series Classification
SLANet_plusSmall Object DetectionSmall Object Detection
Multi-Label Image ClassificationMulti-Label Image Classification
Image Anomaly DetectionUnsupervised Anomaly Detection
Layout ParsingTable Structure Recognition
Layout Region Analysis
Text DetectionPP-OCRv4_server_det
PP-OCRv4_mobile_det
Text RecognitionPP-OCRv4_server_rec
PP-OCRv4_mobile_rec
ch_RepSVTR_rec
ch_SVTRv2_rec
Formula Recognition
Document Scene Information Extraction v3Table RecognitionSLANetSeal Text Detection
SLANet_plusText Image Unwarping
Document Image Orientation Classification
Formula Recognition Layout DetectionPicoDet_layout_1x
Text DetectionPP-OCRv4_server_detFormula Recognition
PP-OCRv4_mobile_detSeal RecognitionLayout Region Analysis
Text RecognitionPP-OCRv4_server_recSeal Text Detection
PP-OCRv4_mobile_recText Recognition
ch_RepSVTR_recImage RecognitionSubject Detection
ch_SVTRv2_recImage Feature
Seal Text DetectionPP-OCRv4_server_seal_detPedestrian Attribute RecognitionPedestrian Detection
PP-OCRv4_mobile_seal_detPedestrian Attribute Recognition
Text Image RectificationUVDocVehicle Attribute RecognitionVehicle Detection
Document Image Orientation ClassificationPP-LCNet_x1_0_doc_oriVehicle Attribute Recognition
Face RecognitionFace Detection
Face Feature
@@ -4722,7 +4823,7 @@

2. diff --git a/main/en/pipeline_deploy/service_deploy.html b/main/en/pipeline_deploy/service_deploy.html index 36e9357b05..ee2942a5f0 100644 --- a/main/en/pipeline_deploy/service_deploy.html +++ b/main/en/pipeline_deploy/service_deploy.html @@ -4540,7 +4540,7 @@

2.2 Consider SecurityAmberC0209 + zhang-prog diff --git a/main/en/pipeline_usage/instructions/pipeline_CLI_usage.html b/main/en/pipeline_usage/instructions/pipeline_CLI_usage.html index 32a655d892..586919a697 100644 --- a/main/en/pipeline_usage/instructions/pipeline_CLI_usage.html +++ b/main/en/pipeline_usage/instructions/pipeline_CLI_usage.html @@ -4434,7 +4434,7 @@

2. Custom Pipeline Configuration diff --git a/main/en/pipeline_usage/instructions/pipeline_python_API.html b/main/en/pipeline_usage/instructions/pipeline_python_API.html index b5003fae02..ee9fffd230 100644 --- a/main/en/pipeline_usage/instructions/pipeline_python_API.html +++ b/main/en/pipeline_usage/instructions/pipeline_python_API.html @@ -4724,7 +4724,7 @@

Methods:AmberC0209 + zhang-prog diff --git a/main/en/pipeline_usage/pipeline_develop_guide.html b/main/en/pipeline_usage/pipeline_develop_guide.html index 7e01316cad..d6e448bf3d 100644 --- a/main/en/pipeline_usage/pipeline_develop_guide.html +++ b/main/en/pipeline_usage/pipeline_develop_guide.html @@ -4631,7 +4631,7 @@

6. Development Integration and diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html b/main/en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html index ded0cdd4c0..e41ee500fd 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html @@ -5313,7 +5313,7 @@

3. Development Integration/Deployme diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html b/main/en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html index d46ff1ac45..3925ff8936 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html @@ -5395,7 +5395,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html b/main/en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html index 9528d7c196..cae9e95bf0 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html @@ -5164,7 +5164,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/image_classification.html b/main/en/pipeline_usage/tutorials/cv_pipelines/image_classification.html index cbf8a2ce7d..88dbd6be07 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/image_classification.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/image_classification.html @@ -5934,7 +5934,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html b/main/en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html index 5d97a6c5e7..cc20d9a4a2 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html @@ -5250,7 +5250,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html b/main/en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html index 0b4ba031ea..c0781a1af4 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html @@ -5433,7 +5433,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/object_detection.html b/main/en/pipeline_usage/tutorials/cv_pipelines/object_detection.html index 9f9365efac..b812490219 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/object_detection.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/object_detection.html @@ -5596,7 +5596,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html b/main/en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html index b456e2a4f3..896bbf6436 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html @@ -4968,7 +4968,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html b/main/en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html index 5bc23ab661..7c3b3be9dd 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html @@ -5386,7 +5386,7 @@

Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html b/main/en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html index e10ca1afaa..ea5eb98ae2 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html @@ -5238,7 +5238,7 @@

Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html b/main/en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html index 7abe6d6791..d4225d7f49 100644 --- a/main/en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html +++ b/main/en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html @@ -4985,7 +4985,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html b/main/en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html index dcd19f99df..a74dbbad29 100644 --- a/main/en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html +++ b/main/en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html @@ -5794,7 +5794,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/ocr_pipelines/OCR.html b/main/en/pipeline_usage/tutorials/ocr_pipelines/OCR.html index 3f99d5cc77..91bc38a449 100644 --- a/main/en/pipeline_usage/tutorials/ocr_pipelines/OCR.html +++ b/main/en/pipeline_usage/tutorials/ocr_pipelines/OCR.html @@ -5415,7 +5415,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html b/main/en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html index df77e6dab6..4494baf225 100644 --- a/main/en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html +++ b/main/en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html @@ -5353,7 +5353,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html b/main/en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html index 3cc61d39b8..68743fcfee 100644 --- a/main/en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html +++ b/main/en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html @@ -5290,7 +5290,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html b/main/en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html index 8f1a2d9f74..5bf9607452 100644 --- a/main/en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html +++ b/main/en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html @@ -5508,7 +5508,7 @@

5. Multiple hardware supportAmberC0209 + zhang-prog diff --git a/main/en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html b/main/en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html index 4f7f779721..e764fe866d 100644 --- a/main/en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html +++ b/main/en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html @@ -5450,7 +5450,7 @@

5. Multi-Hardware Support diff --git a/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html b/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html index 61197b694a..fbe8dd30c1 100644 --- a/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html +++ b/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html @@ -5235,7 +5235,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html b/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html index f46473e074..266347b557 100644 --- a/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html +++ b/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html @@ -5162,7 +5162,7 @@

5. Multi-hardware Support diff --git a/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html b/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html index 97779289eb..601252b640 100644 --- a/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html +++ b/main/en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html @@ -5245,7 +5245,7 @@

5. Multi-hardware Support diff --git a/main/en/practical_tutorials/anomaly_detection_tutorial.html b/main/en/practical_tutorials/anomaly_detection_tutorial.html index f9f9699164..b76719ec2d 100644 --- a/main/en/practical_tutorials/anomaly_detection_tutorial.html +++ b/main/en/practical_tutorials/anomaly_detection_tutorial.html @@ -4689,7 +4689,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/en/practical_tutorials/anomaly_detection_tutorial_en.html b/main/en/practical_tutorials/anomaly_detection_tutorial_en.html index 20b86747ef..4ace4cbfb2 100644 --- a/main/en/practical_tutorials/anomaly_detection_tutorial_en.html +++ b/main/en/practical_tutorials/anomaly_detection_tutorial_en.html @@ -4684,7 +4684,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/deployment_tutorial.html b/main/en/practical_tutorials/deployment_tutorial.html index 4844b74d20..44dcc14aa8 100644 --- a/main/en/practical_tutorials/deployment_tutorial.html +++ b/main/en/practical_tutorials/deployment_tutorial.html @@ -4819,7 +4819,7 @@

3.3 Deployment StepsAmberC0209 + zhang-prog diff --git a/main/en/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html b/main/en/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html index c04f7d1387..bc82b96df0 100644 --- a/main/en/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html +++ b/main/en/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html @@ -5088,7 +5088,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html b/main/en/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html index c1ad699861..63fe631a4c 100644 --- a/main/en/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html +++ b/main/en/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html @@ -4803,7 +4803,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/image_classification_garbage_tutorial.html b/main/en/practical_tutorials/image_classification_garbage_tutorial.html index d0a791ed1b..41ed5e56b5 100644 --- a/main/en/practical_tutorials/image_classification_garbage_tutorial.html +++ b/main/en/practical_tutorials/image_classification_garbage_tutorial.html @@ -4937,7 +4937,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html b/main/en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html index dacdabeeba..d265e78a70 100644 --- a/main/en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html +++ b/main/en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html @@ -4882,7 +4882,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/object_detection_fall_tutorial.html b/main/en/practical_tutorials/object_detection_fall_tutorial.html index ec6677cecb..51906e6a9f 100644 --- a/main/en/practical_tutorials/object_detection_fall_tutorial.html +++ b/main/en/practical_tutorials/object_detection_fall_tutorial.html @@ -4893,7 +4893,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/object_detection_fashion_pedia_tutorial.html b/main/en/practical_tutorials/object_detection_fashion_pedia_tutorial.html index 093805c851..9f39701107 100644 --- a/main/en/practical_tutorials/object_detection_fashion_pedia_tutorial.html +++ b/main/en/practical_tutorials/object_detection_fashion_pedia_tutorial.html @@ -4901,7 +4901,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/ocr_det_license_tutorial.html b/main/en/practical_tutorials/ocr_det_license_tutorial.html index bfb8a3dd7e..fb412a5de2 100644 --- a/main/en/practical_tutorials/ocr_det_license_tutorial.html +++ b/main/en/practical_tutorials/ocr_det_license_tutorial.html @@ -4848,7 +4848,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/ocr_rec_chinese_tutorial.html b/main/en/practical_tutorials/ocr_rec_chinese_tutorial.html index da9920e9e8..01d2536ccf 100644 --- a/main/en/practical_tutorials/ocr_rec_chinese_tutorial.html +++ b/main/en/practical_tutorials/ocr_rec_chinese_tutorial.html @@ -4858,7 +4858,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/semantic_segmentation_road_tutorial.html b/main/en/practical_tutorials/semantic_segmentation_road_tutorial.html index 93d8d4402c..f6f1f20729 100644 --- a/main/en/practical_tutorials/semantic_segmentation_road_tutorial.html +++ b/main/en/practical_tutorials/semantic_segmentation_road_tutorial.html @@ -4871,7 +4871,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/ts_anomaly_detection.html b/main/en/practical_tutorials/ts_anomaly_detection.html index 1173b67534..3b4e442104 100644 --- a/main/en/practical_tutorials/ts_anomaly_detection.html +++ b/main/en/practical_tutorials/ts_anomaly_detection.html @@ -4879,7 +4879,7 @@

7. Integration/Deployment diff --git a/main/en/practical_tutorials/ts_classification.html b/main/en/practical_tutorials/ts_classification.html index b1a8b237e1..765d9d3adf 100644 --- a/main/en/practical_tutorials/ts_classification.html +++ b/main/en/practical_tutorials/ts_classification.html @@ -4836,7 +4836,7 @@

7. Development Integration/Deployme diff --git a/main/en/practical_tutorials/ts_forecast.html b/main/en/practical_tutorials/ts_forecast.html index c0b004a045..9e0c1427af 100644 --- a/main/en/practical_tutorials/ts_forecast.html +++ b/main/en/practical_tutorials/ts_forecast.html @@ -5015,7 +5015,7 @@

7.Integration/Deployment diff --git a/main/en/quick_start.html b/main/en/quick_start.html index 8bfe0c44ee..3daf7914bd 100644 --- a/main/en/quick_start.html +++ b/main/en/quick_start.html @@ -4603,7 +4603,7 @@

📝 Python Script Usage diff --git a/main/en/support_list/model_list_dcu.html b/main/en/support_list/model_list_dcu.html index c8fa744f56..b87a456c3d 100644 --- a/main/en/support_list/model_list_dcu.html +++ b/main/en/support_list/model_list_dcu.html @@ -4409,7 +4409,7 @@

Semantic Segmentation ModuleAmberC0209 + zhang-prog diff --git a/main/en/support_list/model_list_mlu.html b/main/en/support_list/model_list_mlu.html index d40271b0d4..9dc6e38657 100644 --- a/main/en/support_list/model_list_mlu.html +++ b/main/en/support_list/model_list_mlu.html @@ -4728,7 +4728,7 @@

Time Series Forecasting ModuleAmberC0209 + zhang-prog diff --git a/main/en/support_list/model_list_npu.html b/main/en/support_list/model_list_npu.html index a661bb69f0..798698208e 100644 --- a/main/en/support_list/model_list_npu.html +++ b/main/en/support_list/model_list_npu.html @@ -5703,7 +5703,7 @@

Time Series Classification Module diff --git a/main/en/support_list/model_list_xpu.html b/main/en/support_list/model_list_xpu.html index 9c32460340..32090436ab 100644 --- a/main/en/support_list/model_list_xpu.html +++ b/main/en/support_list/model_list_xpu.html @@ -4728,7 +4728,7 @@

Time Series Forecasting ModuleAmberC0209 + zhang-prog diff --git a/main/en/support_list/models_list.html b/main/en/support_list/models_list.html index a498971ded..766aa084c5 100644 --- a/main/en/support_list/models_list.html +++ b/main/en/support_list/models_list.html @@ -6902,7 +6902,7 @@

AmberC0209 + zhang-prog diff --git a/main/en/support_list/pipelines_list.html b/main/en/support_list/pipelines_list.html index a7d1886a46..75b68863bf 100644 --- a/main/en/support_list/pipelines_list.html +++ b/main/en/support_list/pipelines_list.html @@ -4718,7 +4718,7 @@

💬 Discussion diff --git a/main/installation/installation.html b/main/installation/installation.html index 220d816bc7..07a9481d99 100644 --- a/main/installation/installation.html +++ b/main/installation/installation.html @@ -4691,7 +4691,7 @@

2.2.2 安装PaddleXAmberC0209 + zhang-prog diff --git a/main/installation/paddlepaddle_install.html b/main/installation/paddlepaddle_install.html index 33840d8ee7..4eba039c22 100644 --- a/main/installation/paddlepaddle_install.html +++ b/main/installation/paddlepaddle_install.html @@ -4409,7 +4409,7 @@

基于 pip 安装飞桨AmberC0209 + zhang-prog diff --git a/main/module_usage/instructions/benchmark.html b/main/module_usage/instructions/benchmark.html index 42c3067bcc..9d0b8d331d 100644 --- a/main/module_usage/instructions/benchmark.html +++ b/main/module_usage/instructions/benchmark.html @@ -4232,42 +4232,42 @@

模型推理 Benchmark
+----------------+-----------------+-----------------+------------------------+
 |   Component    | Total Time (ms) | Number of Calls | Avg Time Per Call (ms) |
 +----------------+-----------------+-----------------+------------------------+
-|    ReadCmp     |   100.20136833  |        10       |      10.02013683       |
-|     Resize     |   17.05980301   |        20       |       0.85299015       |
-|   Normalize    |   45.44949532   |        20       |       2.27247477       |
-|   ToCHWImage   |    0.03671646   |        20       |       0.00183582       |
-|    Copy2GPU    |   12.28785515   |        10       |       1.22878551       |
-|     Infer      |   76.59482956   |        10       |       7.65948296       |
-|    Copy2CPU    |    0.39863586   |        10       |       0.03986359       |
-| DetPostProcess |    0.43916702   |        20       |       0.02195835       |
+|    ReadCmp     |   99.60412979   |        10       |       9.96041298       |
+|     Resize     |   17.01641083   |        20       |       0.85082054       |
+|   Normalize    |   44.61312294   |        20       |       2.23065615       |
+|   ToCHWImage   |    0.03385544   |        20       |       0.00169277       |
+|    Copy2GPU    |   13.46874237   |        10       |       1.34687424       |
+|     Infer      |   71.31743431   |        10       |       7.13174343       |
+|    Copy2CPU    |    0.39076805   |        10       |       0.03907681       |
+| DetPostProcess |    0.36168098   |        20       |       0.01808405       |
 +----------------+-----------------+-----------------+------------------------+
 +-------------+-----------------+---------------------+----------------------------+
 |    Stage    | Total Time (ms) | Number of Instances | Avg Time Per Instance (ms) |
 +-------------+-----------------+---------------------+----------------------------+
-|  PreProcess |   162.74738312  |          20         |         8.13736916         |
-|  Inference  |   89.28132057   |          20         |         4.46406603         |
-| PostProcess |    0.43916702   |          20         |         0.02195835         |
-|   End2End   |    0.27992606   |          20         |         0.01399630         |
-|    WarmUp   |    5.37562728   |          5          |         1.07512546         |
+|  PreProcess |   161.26751900  |          20         |         8.06337595         |
+|  Inference  |   85.17694473   |          20         |         4.25884724         |
+| PostProcess |    0.36168098   |          20         |         0.01808405         |
+|   End2End   |   256.90770149  |          20         |        12.84538507         |
+|    WarmUp   |  5412.37807274  |          10         |        541.23780727        |
 +-------------+-----------------+---------------------+----------------------------+
 

在 Benchmark 结果中,会统计该模型全部组件(Component)的总耗时(Total Time,单位为“毫秒”)、调用次数Number of Calls)、调用**平均执行耗时(Avg Time Per Call,单位“毫秒”),以及按预热(WarmUp)、预处理(PreProcess)、模型推理(Inference)、后处理(PostProcess)和端到端(End2End)进行划分的耗时统计,包括每个阶段的总耗时(Total Time,单位为“毫秒”)、**样本数Number of Instances)和**单样本**平均执行耗时(Avg Time Per Instance,单位“毫秒”),同时,上述指标会保存到到本地: ./benchmark/detail.csv./benchmark/summary.csv

Component,Total Time (ms),Number of Calls,Avg Time Per Call (ms)
-ReadCmp,100.20136833190918,10,10.020136833190918
-Resize,17.059803009033203,20,0.8529901504516602
-Normalize,45.44949531555176,20,2.272474765777588
-ToCHWImage,0.036716461181640625,20,0.0018358230590820312
-Copy2GPU,12.28785514831543,10,1.228785514831543
-Infer,76.59482955932617,10,7.659482955932617
-Copy2CPU,0.3986358642578125,10,0.03986358642578125
-DetPostProcess,0.4391670227050781,20,0.021958351135253906
+ReadCmp,99.60412979125977,10,9.960412979125977
+Resize,17.01641082763672,20,0.8508205413818359
+Normalize,44.61312294006348,20,2.230656147003174
+ToCHWImage,0.033855438232421875,20,0.0016927719116210938
+Copy2GPU,13.468742370605469,10,1.3468742370605469
+Infer,71.31743431091309,10,7.131743431091309
+Copy2CPU,0.39076805114746094,10,0.039076805114746094
+DetPostProcess,0.3616809844970703,20,0.018084049224853516
 
Stage,Total Time (ms),Number of Instances,Avg Time Per Instance (ms)
-PreProcess,162.74738311767578,20,8.137369155883789
-Inference,89.28132057189941,20,4.464066028594971
-PostProcess,0.4391670227050781,20,0.021958351135253906
-End2End,0.279926061630249,20,0.013996303081512451
-WarmUp,5.375627279281616,5,1.0751254558563232
+PreProcess,161.26751899719238,20,8.06337594985962
+Inference,85.17694473266602,20,4.258847236633301
+PostProcess,0.3616809844970703,20,0.018084049224853516
+End2End,256.90770149230957,20,12.845385074615479
+WarmUp,5412.3780727386475,10,541.2378072738647
 
@@ -4316,7 +4316,7 @@

模型推理 Benchmark diff --git a/main/module_usage/instructions/config_parameters_common.html b/main/module_usage/instructions/config_parameters_common.html index cffba4a9d0..99ea290a46 100644 --- a/main/module_usage/instructions/config_parameters_common.html +++ b/main/module_usage/instructions/config_parameters_common.html @@ -4542,7 +4542,7 @@

PredictAmberC0209 + zhang-prog diff --git a/main/module_usage/instructions/config_parameters_time_series.html b/main/module_usage/instructions/config_parameters_time_series.html index 8ea8955645..9bc3269b8d 100644 --- a/main/module_usage/instructions/config_parameters_time_series.html +++ b/main/module_usage/instructions/config_parameters_time_series.html @@ -4600,7 +4600,7 @@

PredictAmberC0209 + zhang-prog diff --git a/main/module_usage/instructions/model_python_API.html b/main/module_usage/instructions/model_python_API.html index 134b7c9871..7b2d9533ce 100644 --- a/main/module_usage/instructions/model_python_API.html +++ b/main/module_usage/instructions/model_python_API.html @@ -4670,7 +4670,7 @@

方法:&pa diff --git a/main/module_usage/tutorials/cv_modules/anomaly_detection.html b/main/module_usage/tutorials/cv_modules/anomaly_detection.html index 0e93963975..464dba9b0d 100644 --- a/main/module_usage/tutorials/cv_modules/anomaly_detection.html +++ b/main/module_usage/tutorials/cv_modules/anomaly_detection.html @@ -4755,7 +4755,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/face_detection.html b/main/module_usage/tutorials/cv_modules/face_detection.html index 3e2b1403bc..a58bbb713d 100644 --- a/main/module_usage/tutorials/cv_modules/face_detection.html +++ b/main/module_usage/tutorials/cv_modules/face_detection.html @@ -4855,7 +4855,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/face_feature.html b/main/module_usage/tutorials/cv_modules/face_feature.html index 87d212772a..e4501c4419 100644 --- a/main/module_usage/tutorials/cv_modules/face_feature.html +++ b/main/module_usage/tutorials/cv_modules/face_feature.html @@ -4866,7 +4866,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/human_detection.html b/main/module_usage/tutorials/cv_modules/human_detection.html index b365a9b0aa..a981dc2f89 100644 --- a/main/module_usage/tutorials/cv_modules/human_detection.html +++ b/main/module_usage/tutorials/cv_modules/human_detection.html @@ -4833,7 +4833,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/image_classification.html b/main/module_usage/tutorials/cv_modules/image_classification.html index 0cc7640490..d594fa76af 100644 --- a/main/module_usage/tutorials/cv_modules/image_classification.html +++ b/main/module_usage/tutorials/cv_modules/image_classification.html @@ -5464,7 +5464,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/image_feature.html b/main/module_usage/tutorials/cv_modules/image_feature.html index 03b82cf449..9e325c9e8a 100644 --- a/main/module_usage/tutorials/cv_modules/image_feature.html +++ b/main/module_usage/tutorials/cv_modules/image_feature.html @@ -4898,7 +4898,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/image_multilabel_classification.html b/main/module_usage/tutorials/cv_modules/image_multilabel_classification.html index b2bbbeda6b..d732a16866 100644 --- a/main/module_usage/tutorials/cv_modules/image_multilabel_classification.html +++ b/main/module_usage/tutorials/cv_modules/image_multilabel_classification.html @@ -4894,7 +4894,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/instance_segmentation.html b/main/module_usage/tutorials/cv_modules/instance_segmentation.html index 3ae0a046ad..cfb69547ba 100644 --- a/main/module_usage/tutorials/cv_modules/instance_segmentation.html +++ b/main/module_usage/tutorials/cv_modules/instance_segmentation.html @@ -4971,7 +4971,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/mainbody_detection.html b/main/module_usage/tutorials/cv_modules/mainbody_detection.html index 8499efc86e..ecbc50fdd1 100644 --- a/main/module_usage/tutorials/cv_modules/mainbody_detection.html +++ b/main/module_usage/tutorials/cv_modules/mainbody_detection.html @@ -4829,7 +4829,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/object_detection.html b/main/module_usage/tutorials/cv_modules/object_detection.html index 2dbf487e29..107b054183 100644 --- a/main/module_usage/tutorials/cv_modules/object_detection.html +++ b/main/module_usage/tutorials/cv_modules/object_detection.html @@ -5192,7 +5192,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html b/main/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html index 05e317ca2b..2b78ced782 100644 --- a/main/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html +++ b/main/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html @@ -4841,7 +4841,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/semantic_segmentation.html b/main/module_usage/tutorials/cv_modules/semantic_segmentation.html index 641c6c410f..e1de256ea2 100644 --- a/main/module_usage/tutorials/cv_modules/semantic_segmentation.html +++ b/main/module_usage/tutorials/cv_modules/semantic_segmentation.html @@ -5017,7 +5017,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/small_object_detection.html b/main/module_usage/tutorials/cv_modules/small_object_detection.html index 8547fa3226..bdc3223306 100644 --- a/main/module_usage/tutorials/cv_modules/small_object_detection.html +++ b/main/module_usage/tutorials/cv_modules/small_object_detection.html @@ -4874,7 +4874,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html b/main/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html index 9a44d5b652..6d109b4e28 100644 --- a/main/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html +++ b/main/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html @@ -4845,7 +4845,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/cv_modules/vehicle_detection.html b/main/module_usage/tutorials/cv_modules/vehicle_detection.html index 76c9fca7c2..d0c55448d2 100644 --- a/main/module_usage/tutorials/cv_modules/vehicle_detection.html +++ b/main/module_usage/tutorials/cv_modules/vehicle_detection.html @@ -4835,7 +4835,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html b/main/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html index 3cbad75c92..c2aec45422 100644 --- a/main/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html +++ b/main/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html @@ -4825,7 +4825,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/formula_recognition.html b/main/module_usage/tutorials/ocr_modules/formula_recognition.html index e32a3f2027..f34150204a 100644 --- a/main/module_usage/tutorials/ocr_modules/formula_recognition.html +++ b/main/module_usage/tutorials/ocr_modules/formula_recognition.html @@ -4857,7 +4857,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/layout_detection.html b/main/module_usage/tutorials/ocr_modules/layout_detection.html index ec5d3d33d7..b2b3cafa68 100644 --- a/main/module_usage/tutorials/ocr_modules/layout_detection.html +++ b/main/module_usage/tutorials/ocr_modules/layout_detection.html @@ -4877,7 +4877,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/seal_text_detection.html b/main/module_usage/tutorials/ocr_modules/seal_text_detection.html index f21680a071..7050829280 100644 --- a/main/module_usage/tutorials/ocr_modules/seal_text_detection.html +++ b/main/module_usage/tutorials/ocr_modules/seal_text_detection.html @@ -4831,7 +4831,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/table_structure_recognition.html b/main/module_usage/tutorials/ocr_modules/table_structure_recognition.html index 1ba8bf2708..22f1507a54 100644 --- a/main/module_usage/tutorials/ocr_modules/table_structure_recognition.html +++ b/main/module_usage/tutorials/ocr_modules/table_structure_recognition.html @@ -4828,7 +4828,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/text_detection.html b/main/module_usage/tutorials/ocr_modules/text_detection.html index 7f75a4b8db..001fb29bd1 100644 --- a/main/module_usage/tutorials/ocr_modules/text_detection.html +++ b/main/module_usage/tutorials/ocr_modules/text_detection.html @@ -4817,7 +4817,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/text_image_unwarping.html b/main/module_usage/tutorials/ocr_modules/text_image_unwarping.html index 0af21e7337..448496560a 100644 --- a/main/module_usage/tutorials/ocr_modules/text_image_unwarping.html +++ b/main/module_usage/tutorials/ocr_modules/text_image_unwarping.html @@ -4441,7 +4441,7 @@

四、二次开发AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/ocr_modules/text_recognition.html b/main/module_usage/tutorials/ocr_modules/text_recognition.html index bf2bce2aa4..a0eb4d9e69 100644 --- a/main/module_usage/tutorials/ocr_modules/text_recognition.html +++ b/main/module_usage/tutorials/ocr_modules/text_recognition.html @@ -4893,7 +4893,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html b/main/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html index 152caf0b57..61c64063a1 100644 --- a/main/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html +++ b/main/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html @@ -4891,7 +4891,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/time_series_modules/time_series_classification.html b/main/module_usage/tutorials/time_series_modules/time_series_classification.html index 15246791f5..1fbac6086f 100644 --- a/main/module_usage/tutorials/time_series_modules/time_series_classification.html +++ b/main/module_usage/tutorials/time_series_modules/time_series_classification.html @@ -4867,7 +4867,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/module_usage/tutorials/time_series_modules/time_series_forecasting.html b/main/module_usage/tutorials/time_series_modules/time_series_forecasting.html index 7df5de238b..277c895f3c 100644 --- a/main/module_usage/tutorials/time_series_modules/time_series_forecasting.html +++ b/main/module_usage/tutorials/time_series_modules/time_series_forecasting.html @@ -4917,7 +4917,7 @@

4.4.2 模型集成AmberC0209 + zhang-prog diff --git a/main/other_devices_support/how_to_contribute_device.html b/main/other_devices_support/how_to_contribute_device.html new file mode 100644 index 0000000000..c40c4a7dfa --- /dev/null +++ b/main/other_devices_support/how_to_contribute_device.html @@ -0,0 +1,4441 @@ + + + + + + + + + + + + + + + + + + + + + 1. 更多硬件支持 - PaddleX 文档 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 跳转至 + + +
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + +

1. 更多硬件支持

+

飞桨生态的繁荣离不开开发者和用户的贡献,我们非常欢迎您为 PaddleX 提供更多的硬件适配,也十分感谢您的反馈。

+

当前支持的类型为 Intel/苹果M系列 CPU、英伟达 GPU、昆仑芯 XPU、昇腾 NPU、海光 DCU 和寒武纪MLU,如果您要支持的硬件不在已经支持的范围内,可以参考如下方式进行贡献。

+

1.1 硬件接入飞桨后端

+

飞桨深度学习框架提供了多种硬件接入的方案,包括算子开发与映射、子图与整图接入、深度学习编译器后端接入以及开源神经网络格式转化四种硬件接入方案,供硬件厂商根据自身芯片架构设计与软件栈的建设成熟度进行灵活选择,具体细节请参考飞桨硬件接入方案

+

1.2 各个套件支持

+

由于PaddleX基于飞桨模型库实现。当硬件完成飞桨后端接入后,按照硬件已经支持的模型情况,选择相应的套件去提交代码,确保相关套件适配了对应硬件,参考各套件贡献指南:

+
    +
  1. +

    PaddleClas

    +
  2. +
  3. +

    PaddleDetection

    +
  4. +
  5. +

    PaddleSeg

    +
  6. +
  7. +

    PaddleOCR

    +
  8. +
  9. +

    PaddleTS

    +
  10. +
+

2. 更新PaddleX

+

当完成硬件接入飞桨和各个套件后,需要更新PaddleX中硬件识别相关的代码和说明文档

+

2.1 推理能力支持

+

2.1.1 版本支持(可忽略)

+

如果相关硬件对于飞桨版本有特定要求,可以在初始化时根据设备信息和版本信息进行判断,相关代码位于 PaddleX初始化中的 _check_paddle_version

+

2.1.2 设置环境变量(可忽略)

+

如果相关硬件在使用时,需要设定特殊的环境变量,可以修改设备环境设置代码,相关代码位于 PaddleX环境变量设置中的 set_env_for_device

+

2.1.3 创建Predictor

+

PaddleX的推理能力基于飞桨Paddle Inference Predictor提供,创建Predictor时需要根据设备信息选择不同的硬件并创建pass,相关代码位于PaddleX Predictor创建_create

+

2.1.4 更新硬件支持列表

+

创建Predictor时会判断设备是否已支持,相关代码位于PaddleX Predictor Option中的 SUPPORT_DEVICE

+

2.1.5 更新多硬件说明指南

+

请更新PaddleX多硬件说明指南,将新支持的硬件信息更新到文档中,需要同时更新中英文版本,中文版本 PaddleX多硬件使用指南 ,英文版本 PaddleX Multi-Hardware Usage Guide

+

2.1.6 更新安装教程

+

请提供硬件相关的安装教程,需要提供中英文版本,中文版本参考 昇腾 NPU 飞桨安装教程 ,英文版本参考 Ascend NPU PaddlePaddle Installation Tutorial

+

2.1.7 更新模型列表

+

请提供硬件支持的模型列表,需要提供中英文版本,中文版本参考 PaddleX模型列表(昇腾 NPU) ,英文版本参考 PaddleX Model List (Huawei Ascend NPU)

+

2.2 训练能力支持

+

TODO

+

3. 提交PR

+

当您完成特定硬件的适配工作后,请给PaddleX提交一个 Pull Request 说明相关信息,我们将会对模型进行验证,确认无问题后将合入相关代码

+

相关PR需要提供复现模型精度的信息,至少包含以下内容:

+
    +
  • +

    验证模型精度所用到的软件版本,包括但不限于:

    +
  • +
  • +

    Paddle版本

    +
  • +
  • +

    PaddleCustomDevice版本(如果有)

    +
  • +
  • +

    PaddleX或者对应套件的分支

    +
  • +
  • +

    验证模型精度所用到的机器环境,包括但不限于:

    +
  • +
  • +

    芯片型号

    +
  • +
  • +

    系统版本

    +
  • +
  • +

    硬件驱动版本

    +
  • +
  • +

    算子库版本等

    +
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/other_devices_support/how_to_contribute_model.html b/main/other_devices_support/how_to_contribute_model.html new file mode 100644 index 0000000000..ac6bba5b41 --- /dev/null +++ b/main/other_devices_support/how_to_contribute_model.html @@ -0,0 +1,4424 @@ + + + + + + + + + + + + + + + + + + + + + 1. 贡献模型 - PaddleX 文档 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + 跳转至 + + +
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + +

1. 贡献模型

+

飞桨生态的繁荣离不开开发者和用户的贡献,我们非常欢迎您为飞桨的多硬件适配贡献更多的模型,也十分感谢您的反馈。

+

当前PaddleX中对于各硬件适配模型的列表如下,您可以确认相关模型是否已经在对应硬件中进行过适配:

+ +

当前PaddleX相关模型的源码放置在各个套件中,部分套件和模型并未接入PaddleX中,因此对模型进行适配前,请务必保证您的模型在PaddleX中已经接入,当前PaddleX模型列表详见 PaddleX模型库。如果您有特殊的模型需求,请提交 issue 告知我们。

+

如果您适配的模型在相关硬件上涉及到模型组网代码的修改,请先提交代码到对应的套件中,参考各套件贡献指南:

+
    +
  1. +

    PaddleClas

    +
  2. +
  3. +

    PaddleDetection

    +
  4. +
  5. +

    PaddleSeg

    +
  6. +
  7. +

    PaddleOCR

    +
  8. +
  9. +

    PaddleTS

    +
  10. +
+

2. 提交说明issue

+

当您完成特定硬件上某款模型的适配工作后,请给PaddleX提交一个 issue 说明相关信息,我们将会对模型进行验证,确认无问题后将合入相关代码并在文档中对模型列表进行更新

+

相关issue需要提供复现模型精度的信息,至少包含以下内容:

+
    +
  • +

    验证模型精度所用到的软件版本,包括但不限于:

    +
  • +
  • +

    Paddle版本

    +
  • +
  • +

    PaddleCustomDevice版本(如果有)

    +
  • +
  • +

    PaddleX或者对应套件的分支

    +
  • +
  • +

    验证模型精度所用到的机器环境,包括但不限于:

    +
  • +
  • +

    芯片型号

    +
  • +
  • +

    系统版本

    +
  • +
  • +

    硬件驱动版本

    +
  • +
  • +

    算子库版本等

    +
  • +
+

3. 更多文档

+

更多关于飞桨多硬件适配和使用的相关文档,可以参考

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/other_devices_support/multi_devices_use_guide.html b/main/other_devices_support/multi_devices_use_guide.html index 15884338e2..09cee1167d 100644 --- a/main/other_devices_support/multi_devices_use_guide.html +++ b/main/other_devices_support/multi_devices_use_guide.html @@ -4576,7 +4576,7 @@

2、使用&par diff --git a/main/other_devices_support/paddlepaddle_install_DCU.html b/main/other_devices_support/paddlepaddle_install_DCU.html index e88ee48866..66294b2e93 100644 --- a/main/other_devices_support/paddlepaddle_install_DCU.html +++ b/main/other_devices_support/paddlepaddle_install_DCU.html @@ -4372,7 +4372,7 @@

2、安装paddle包 diff --git a/main/other_devices_support/paddlepaddle_install_MLU.html b/main/other_devices_support/paddlepaddle_install_MLU.html index 514cedf643..947590537a 100644 --- a/main/other_devices_support/paddlepaddle_install_MLU.html +++ b/main/other_devices_support/paddlepaddle_install_MLU.html @@ -4379,7 +4379,7 @@

2、安装paddle包 diff --git a/main/other_devices_support/paddlepaddle_install_NPU.html b/main/other_devices_support/paddlepaddle_install_NPU.html index 4f037e4727..a1a731b75b 100644 --- a/main/other_devices_support/paddlepaddle_install_NPU.html +++ b/main/other_devices_support/paddlepaddle_install_NPU.html @@ -4387,7 +4387,7 @@

2、安装paddle包 diff --git a/main/other_devices_support/paddlepaddle_install_XPU.html b/main/other_devices_support/paddlepaddle_install_XPU.html index 82bda02787..18a73013d6 100644 --- a/main/other_devices_support/paddlepaddle_install_XPU.html +++ b/main/other_devices_support/paddlepaddle_install_XPU.html @@ -4374,7 +4374,7 @@

2、安装paddle包 diff --git a/main/pipeline_deploy/edge_deploy.html b/main/pipeline_deploy/edge_deploy.html index 718303f385..36374d0f03 100644 --- a/main/pipeline_deploy/edge_deploy.html +++ b/main/pipeline_deploy/edge_deploy.html @@ -4728,7 +4728,7 @@

反馈专区 diff --git a/main/pipeline_deploy/high_performance_inference.html b/main/pipeline_deploy/high_performance_inference.html index 4aa08d80e8..a9570395c0 100644 --- a/main/pipeline_deploy/high_performance_inference.html +++ b/main/pipeline_deploy/high_performance_inference.html @@ -4823,7 +4823,7 @@

2、支持使用高性能推理插件的产线与模型AmberC0209 + zhang-prog diff --git a/main/pipeline_deploy/service_deploy.html b/main/pipeline_deploy/service_deploy.html index e80704ac94..851f08bdc7 100644 --- a/main/pipeline_deploy/service_deploy.html +++ b/main/pipeline_deploy/service_deploy.html @@ -4540,7 +4540,7 @@

2.2 考虑安全性AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/instructions/pipeline_CLI_usage.html b/main/pipeline_usage/instructions/pipeline_CLI_usage.html index e6272a3fc9..b09f01a746 100644 --- a/main/pipeline_usage/instructions/pipeline_CLI_usage.html +++ b/main/pipeline_usage/instructions/pipeline_CLI_usage.html @@ -4434,7 +4434,7 @@

2. 自定义产线配置AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/instructions/pipeline_python_API.html b/main/pipeline_usage/instructions/pipeline_python_API.html index bcabdad775..31f958d29c 100644 --- a/main/pipeline_usage/instructions/pipeline_python_API.html +++ b/main/pipeline_usage/instructions/pipeline_python_API.html @@ -4662,7 +4662,7 @@

方法:&pa diff --git a/main/pipeline_usage/pipeline_develop_guide.html b/main/pipeline_usage/pipeline_develop_guide.html index d53e6fd29c..82ac27a82b 100644 --- a/main/pipeline_usage/pipeline_develop_guide.html +++ b/main/pipeline_usage/pipeline_develop_guide.html @@ -4633,7 +4633,7 @@

6、开发集成/部署AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/face_recognition.html b/main/pipeline_usage/tutorials/cv_pipelines/face_recognition.html index ad3c39edfa..abf89f56dc 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/face_recognition.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/face_recognition.html @@ -5546,7 +5546,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html b/main/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html index 7fc5b269ba..fc2dc32c40 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html @@ -5412,7 +5412,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html b/main/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html index 51672670a6..291789bc60 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html @@ -5190,7 +5190,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/image_classification.html b/main/pipeline_usage/tutorials/cv_pipelines/image_classification.html index 6fd0b7edd7..e445951531 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/image_classification.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/image_classification.html @@ -5947,7 +5947,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html b/main/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html index 2182566c46..49e25e3fde 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html @@ -5270,7 +5270,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html b/main/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html index 8ce55c7356..315a059b5f 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html @@ -5452,7 +5452,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/object_detection.html b/main/pipeline_usage/tutorials/cv_pipelines/object_detection.html index bac0b21d40..d73d39e503 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/object_detection.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/object_detection.html @@ -5616,7 +5616,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html b/main/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html index 91bc667ad7..0c47ee5ea4 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html @@ -4991,7 +4991,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html b/main/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html index e73361685b..b16014cdaa 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html @@ -5414,7 +5414,7 @@

多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html b/main/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html index 476601f062..023ebcfe96 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html @@ -5256,7 +5256,7 @@

多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html b/main/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html index a5425b2aaa..43f4e0ba7e 100644 --- a/main/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html +++ b/main/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html @@ -4988,7 +4988,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html b/main/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html index 35dd693860..69439786ff 100644 --- a/main/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html +++ b/main/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html @@ -5753,7 +5753,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/ocr_pipelines/OCR.html b/main/pipeline_usage/tutorials/ocr_pipelines/OCR.html index 13355cea1b..77a29d3ea8 100644 --- a/main/pipeline_usage/tutorials/ocr_pipelines/OCR.html +++ b/main/pipeline_usage/tutorials/ocr_pipelines/OCR.html @@ -5437,7 +5437,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html b/main/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html index cf72838db3..31fd31645a 100644 --- a/main/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html +++ b/main/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html @@ -5360,7 +5360,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html b/main/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html index 205f23fde9..48bf134173 100644 --- a/main/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html +++ b/main/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html @@ -5296,7 +5296,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html b/main/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html index 8e6fcbd9dc..4c9e76baf7 100644 --- a/main/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html +++ b/main/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html @@ -5539,7 +5539,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html b/main/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html index 821d0de549..9e4efe39ee 100644 --- a/main/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html +++ b/main/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html @@ -5556,7 +5556,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html b/main/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html index e0923d5a04..60f7364fd0 100644 --- a/main/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html +++ b/main/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html @@ -5259,7 +5259,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html b/main/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html index 1fe998d5f7..d81c34b993 100644 --- a/main/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html +++ b/main/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html @@ -5178,7 +5178,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html b/main/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html index ecc2ebad1f..2e6dd96930 100644 --- a/main/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html +++ b/main/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html @@ -5270,7 +5270,7 @@

5. 多硬件支持AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/anomaly_detection_tutorial.html b/main/practical_tutorials/anomaly_detection_tutorial.html index ee0a9414e3..eb7c1c46ca 100644 --- a/main/practical_tutorials/anomaly_detection_tutorial.html +++ b/main/practical_tutorials/anomaly_detection_tutorial.html @@ -4689,7 +4689,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/anomaly_detection_tutorial_en.html b/main/practical_tutorials/anomaly_detection_tutorial_en.html index 1b2d852eb0..10423e2c82 100644 --- a/main/practical_tutorials/anomaly_detection_tutorial_en.html +++ b/main/practical_tutorials/anomaly_detection_tutorial_en.html @@ -4684,7 +4684,7 @@

7. Development Integration/Deployme diff --git a/main/practical_tutorials/deployment_tutorial.html b/main/practical_tutorials/deployment_tutorial.html index 4b76688a36..9e051603bb 100644 --- a/main/practical_tutorials/deployment_tutorial.html +++ b/main/practical_tutorials/deployment_tutorial.html @@ -4819,7 +4819,7 @@

3.3 部署步骤AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html b/main/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html index 21da1daded..2ef28ab642 100644 --- a/main/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html +++ b/main/practical_tutorials/document_scene_information_extraction(layout_detection)_tutorial.html @@ -5067,7 +5067,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html b/main/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html index a057ef9b2c..f9387c1d23 100644 --- a/main/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html +++ b/main/practical_tutorials/document_scene_information_extraction(seal_recognition)_tutorial.html @@ -4783,7 +4783,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/image_classification_garbage_tutorial.html b/main/practical_tutorials/image_classification_garbage_tutorial.html index c5b47cc3de..48020a2505 100644 --- a/main/practical_tutorials/image_classification_garbage_tutorial.html +++ b/main/practical_tutorials/image_classification_garbage_tutorial.html @@ -4916,7 +4916,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html b/main/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html index 37fce50f6a..9d5673904e 100644 --- a/main/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html +++ b/main/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html @@ -4880,7 +4880,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/object_detection_fall_tutorial.html b/main/practical_tutorials/object_detection_fall_tutorial.html index 8c4d24bb70..619ad2f47e 100644 --- a/main/practical_tutorials/object_detection_fall_tutorial.html +++ b/main/practical_tutorials/object_detection_fall_tutorial.html @@ -4891,7 +4891,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/object_detection_fashion_pedia_tutorial.html b/main/practical_tutorials/object_detection_fashion_pedia_tutorial.html index e344da8155..84da83b6a1 100644 --- a/main/practical_tutorials/object_detection_fashion_pedia_tutorial.html +++ b/main/practical_tutorials/object_detection_fashion_pedia_tutorial.html @@ -4899,7 +4899,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/ocr_det_license_tutorial.html b/main/practical_tutorials/ocr_det_license_tutorial.html index 05a15a008b..fe7f416a27 100644 --- a/main/practical_tutorials/ocr_det_license_tutorial.html +++ b/main/practical_tutorials/ocr_det_license_tutorial.html @@ -4848,7 +4848,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/ocr_rec_chinese_tutorial.html b/main/practical_tutorials/ocr_rec_chinese_tutorial.html index 3445c66b3f..000a4b4e34 100644 --- a/main/practical_tutorials/ocr_rec_chinese_tutorial.html +++ b/main/practical_tutorials/ocr_rec_chinese_tutorial.html @@ -4858,7 +4858,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/semantic_segmentation_road_tutorial.html b/main/practical_tutorials/semantic_segmentation_road_tutorial.html index 2d2096da80..3a5d67a074 100644 --- a/main/practical_tutorials/semantic_segmentation_road_tutorial.html +++ b/main/practical_tutorials/semantic_segmentation_road_tutorial.html @@ -4871,7 +4871,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/ts_anomaly_detection.html b/main/practical_tutorials/ts_anomaly_detection.html index 6d134556c8..a1e2ffbc48 100644 --- a/main/practical_tutorials/ts_anomaly_detection.html +++ b/main/practical_tutorials/ts_anomaly_detection.html @@ -4882,7 +4882,7 @@

7.开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/ts_classification.html b/main/practical_tutorials/ts_classification.html index 25a4a110c9..3fd1063b61 100644 --- a/main/practical_tutorials/ts_classification.html +++ b/main/practical_tutorials/ts_classification.html @@ -4845,7 +4845,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/practical_tutorials/ts_forecast.html b/main/practical_tutorials/ts_forecast.html index f103b71f3e..021bc26b42 100644 --- a/main/practical_tutorials/ts_forecast.html +++ b/main/practical_tutorials/ts_forecast.html @@ -5007,7 +5007,7 @@

7. 开发集成/部署AmberC0209 + zhang-prog diff --git a/main/quick_start.html b/main/quick_start.html index 282711fb5d..818ba81675 100644 --- a/main/quick_start.html +++ b/main/quick_start.html @@ -4609,7 +4609,7 @@

📝 Python 脚本使用 diff --git a/main/search/search_index.js b/main/search/search_index.js index 283260a39f..7082c743b6 100644 --- a/main/search/search_index.js +++ b/main/search/search_index.js @@ -1 +1 @@ -var __index = {"config":{"lang":["en","zh"],"separator":"[\\s\\u200b\\-_,:!=\\[\\]()\"`/]+|\\.(?!\\d)|&[lg]t;|(?!\\b)(?=[A-Z][a-z])","pipeline":["stopWordFilter"]},"docs":[{"location":"en/index.html","title":"Home","text":""},{"location":"en/index.html#introduction","title":"\ud83d\udd0d Introduction","text":"

PaddleX 3.0 is a low-code development tool for AI models built on the PaddlePaddle framework. It integrates numerousready-to-use pre-trained models, enablingfull-process developmentfrom model training to inference, supportinga variety of mainstream hardware both domestic and international, and aiding AI developers in industrial practice.

Image Classification Multi-label Image Classification Object Detection Instance Segmentation Semantic Segmentation Image Anomaly Detection OCR Table Recognition PP-ChatOCRv3-doc Time Series Forecasting Time Series Anomaly Detection Time Series Classification"},{"location":"en/index.html#why-paddlex","title":"\ud83c\udf1f Why PaddleX ?","text":"

\ud83c\udfa8 Rich Models One-click Call: Integrate over 200 PaddlePaddle models covering multiple key areas such as OCR, object detection, and time series forecasting into 19 pipelines. Experience the model effects quickly through easy Python API calls. Also supports more than 20 modules for easy model combination use by developers.

\ud83d\ude80 High Efficiency and Low barrier of entry: Achieve model full-process development based on graphical interfaces and unified commands, creating 8 featured model pipelines that combine large and small models, semi-supervised learning of large models, and multi-model fusion, greatly reducing the cost of iterating models.

\ud83c\udf10 Flexible Deployment in Various Scenarios: Support various deployment methods such as high-performance inference, service deployment, and lite deployment to ensure efficient operation and rapid response of models in different application scenarios.

\ud83d\udd27 Efficient Support for Mainstream Hardware: Support seamless switching of various mainstream hardware such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU to ensure efficient operation.

"},{"location":"en/index.html#recent-updates","title":"\ud83d\udce3 Recent Updates","text":"

\ud83d\udd25\ud83d\udd25 \"PaddleX Document Information Personalized Extraction Upgrade\", PP-ChatOCRv3 innovatively provides custom development functions for OCR models based on data fusion technology, offering stronger model fine-tuning capabilities. Millions of high-quality general OCR text recognition data are automatically integrated into vertical model training data at a specific ratio, solving the problem of weakened general text recognition capabilities caused by vertical model training in the industry. Suitable for practical scenarios in industries such as automated office, financial risk control, healthcare, education and publishing, and legal and government sectors. October 24th (Thursday) 19:00 Join our live session for an in-depth analysis of the open-source version of PP-ChatOCRv3 and the outstanding advantages of PaddleX 3.0 Beta1 in terms of accuracy and speed. Registration Link

\u2757 more courses

\ud83d\udd25\ud83d\udd25 9.30, 2024, PaddleX 3.0 Beta1 open source version is officially released, providing more than 200 models that can be called with a simple Python API; achieve model full-process development based on unified commands, and open source the basic capabilities of the PP-ChatOCRv3 pipeline; support more than 100 models for high-performance inference and service-oriented deployment (iterating continuously), more than 7 key visual models for edge-deployment; more than 70 models have been adapted for the full development process of Ascend 910B, more than 15 models have been adapted for the full development process of Kunlun chips and Cambricon

\ud83d\udd25 6.27, 2024, PaddleX 3.0 Beta open source version is officially released, supporting the use of various mainstream hardware for pipeline and model development in a low-code manner on the local side.

\ud83d\udd25 3.25, 2024, PaddleX 3.0 cloud release, supporting the creation of pipelines in the AI Studio Galaxy Community in a zero-code manner.

more

"},{"location":"en/index.html#explanation-of-pipeline","title":"\ud83d\udd20 Explanation of Pipeline","text":"

PaddleX is dedicated to achieving pipeline-level model training, inference, and deployment. A pipeline refers to a series of predefined development processes for specific AI tasks, which includes a combination of single models (single-function modules) capable of independently completing a certain type of task.

"},{"location":"en/index.html#what-can-paddlex-do","title":"\ud83d\udcca What can PaddleX do\uff1f","text":"

All pipelines of PaddleX support online experience on AI Studio and local fast inference. You can quickly experience the effects of each pre-trained pipeline. If you are satisfied with the effects of the pre-trained pipeline, you can directly perform high-performance inference / serving deployment / edge deployment on the pipeline. If not satisfied, you can also Custom Development to improve the pipeline effect. For the complete pipeline development process, please refer to the PaddleX pipeline Development Tool Local Use Tutorial.

In addition, PaddleX provides developers with a full-process efficient model training and deployment tool based on a cloud-based GUI. Developers do not need code development, just need to prepare a dataset that meets the pipeline requirements to quickly start model training. For details, please refer to the tutorial \"Developing Industrial-level AI Models with Zero Barrier\".

Pipeline Online Experience Local Inference High-Performance Inference Service-Oriented Deployment Edge Deployment Custom Development Zero-Code Development On AI Studio OCR Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 PP-ChatOCRv3 Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Table Recognition Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Object Detection Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Instance Segmentation Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Image Classification Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Semantic Segmentation Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Time Series Forecasting Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Anomaly Detection Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Classification Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Small Object Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Multi-label Image Classification \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Anomaly Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Layout Parsing \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Formula Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Seal Recognition \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Pedestrian Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Vehicle Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Face Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7

\u2757Note: The above capabilities are implemented based on GPU/CPU. PaddleX can also perform local inference and custom development on mainstream hardware such as Kunlunxin, Ascend, Cambricon, and Haiguang. The table below details the support status of the pipelines. For specific supported model lists, please refer to the Model List (Kunlunxin XPU)/Model List (Ascend NPU)/Model List (Cambricon MLU)/Model List (Haiguang DCU). We are continuously adapting more models and promoting the implementation of high-performance and service-oriented deployment on mainstream hardware.

\ud83d\udd25\ud83d\udd25 Support for Domestic Hardware Capabilities

Pipeline Ascend 910B Kunlunxin R200/R300 Cambricon MLU370X8 Haiguang Z100 OCR \u2705 \u2705 \u2705 \ud83d\udea7 Table Recognition \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Object Detection \u2705 \u2705 \u2705 \ud83d\udea7 Instance Segmentation \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Classification \u2705 \u2705 \u2705 \u2705 Semantic Segmentation \u2705 \u2705 \u2705 \u2705 Time Series Forecasting \u2705 \u2705 \u2705 \ud83d\udea7 Time Series Anomaly Detection \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Time Series Classification \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7"},{"location":"en/index.html#discussion","title":"\ud83d\udcac Discussion","text":"

We warmly welcome and encourage community members to raise questions, share ideas, and feedback in the Discussions section. Whether you want to report a bug, discuss a feature request, seek help, or just want to keep up with the latest project news, this is a great platform.

"},{"location":"en/index.html#license","title":"\ud83d\udcc4 License","text":"

The release of this project is licensed under the Apache 2.0 license.

"},{"location":"en/CHANGLOG.html","title":"Version Update Information","text":""},{"location":"en/CHANGLOG.html#latest-version-information","title":"Latest Version Information","text":""},{"location":"en/CHANGLOG.html#paddlex-v300beta1-9302024","title":"PaddleX v3.0.0beta1 (9.30/2024)","text":"

PaddleX 3.0 Beta1 offers over 200 models accessible through a streamlined Python API for one-click deployment; realizes full-process model development based on unified commands, and opens source the foundational capabilities of the PP-ChatOCRv3 special model pipeline; supports high-performance inference and service-oriented deployment for over 100 models, as well as edge deployment for 7 key vision models; and fully adapts the development process of over 70 models to Huawei Ascend 910B, and over 15 models to XPU and MLU.

  • Rich Models with One-click Deployment: Integrates over 200 PaddlePaddle models across key domains such as document image intelligent analysis, OCR, object detection, and time series prediction into 13 model pipelines, enabling rapid model experience through a streamlined Python API. Additionally, supports over 20 individual functional modules for convenient model combination.
  • Enhanced Efficiency and Lowered Thresholds: Implements full-process model development based on a graphical interface and unified commands, creating 8 special model pipelines that combine large and small models, leverage large model semi-supervised learning, and multi-model fusion, significantly reducing iteration costs.
  • Flexible Deployment Across Scenarios: Supports various deployment methods including high-performance, service-oriented, and edge deployment, ensuring efficient model operation and rapid response across different application scenarios.
  • Efficient Support for Mainstream Hardware: Seamlessly switches between NVIDIA GPUs, XPU, Ascend, and MLU, ensuring efficient operation.
"},{"location":"en/CHANGLOG.html#paddlex-v300beta-6272024","title":"PaddleX v3.0.0beta (6.27/2024)","text":"

PaddleX 3.0beta integrates the advantages of the PaddlePaddle ecosystem, covering 7 major scenario tasks, constructs 16 model pipelines, and provides a low-code development mode to assist developers in realizing full-process model development on various mainstream hardware.

  • Basic Model Pipelines (Rich Models, Comprehensive Scenarios): Selects 68 high-quality PaddlePaddle models, covering tasks such as image classification, object detection, image segmentation, OCR, text image layout analysis, and time series prediction.
  • Special Model Pipelines (Significant Efficiency Improvement): Provides efficient solutions combining large and small models, large model semi-supervised learning, and multi-model fusion.
  • Low-code Development Mode (Convenient Development and Deployment): Offers both zero-code and low-code development methods.
  • Zero-code Development: Users can interactively submit background training tasks through a graphical user interface (GUI), bridging online and offline deployment, and supporting API-based online service invocation.
  • Low-code Development: Achieves full-process development across 16 model pipelines through unified API interfaces, while supporting user-defined model process serialization.
  • Multi-hardware Local Support (Strong Compatibility): Supports NVIDIA GPUs, XPU, Ascend, and MLU, enabling pure offline usage.
"},{"location":"en/CHANGLOG.html#paddlex-v210-12102021","title":"PaddleX v2.1.0 (12.10/2021)","text":"

Added the ultra-lightweight classification model PPLCNet, achieving approximately 5ms prediction speed for a single image on Intel CPUs, with a Top-1 Accuracy of 80.82% on the ImageNet-1K dataset, surpassing ResNet152's performance. Experience it now! Added the lightweight detection model PP-PicoDet, the first to surpass 30+ mAP(0.5:0.95) within 1M parameters (at 416px input), achieving up to 150FPS prediction on ARM CPUs. Experience it now! Upgraded PaddleX Restful API to support PaddlePaddle's dynamic graph development mode. Experience it now! Added negative sample training strategies for detection models. Experience it now! Added lightweight Python-based service deployment. Experience it now!

"},{"location":"en/CHANGLOG.html#paddlex-v200-9102021","title":"PaddleX v2.0.0 (9.10/2021)","text":"
  • PaddleX API
  • Added visualization of prediction results for detection and instance segmentation tasks, as well as analysis of prediction errors to assist in model effect analysis
  • Introduced negative sample optimization for detection tasks to suppress false detections in background regions
  • Improved prediction results for semantic segmentation tasks, supporting the return of predicted categories and normalized prediction confidence
  • Enhanced prediction results for image classification tasks, supporting the return of normalized prediction confidence
  • Prediction Deployment
  • Completed PaddleX Python prediction deployment, enabling rapid deployment with just 2 APIs
  • Comprehensively upgraded PaddleX C++ deployment, supporting end-to-end unified deployment capabilities for PaddlePaddle vision suites including PaddleDetection, PaddleClas, PaddleSeg, and PaddleX
  • Newly released Manufacture SDK, providing a pre-compiled PaddlePaddle deployment development kit (SDK) for industrial-grade multi-end and multi-platform deployment acceleration, enabling rapid inference deployment through configuring business logic flow files in a low-code manner
  • PaddleX GUI
  • Upgraded PaddleX GUI to support 30-series graphics cards
  • Added PP-YOLO V2 model for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Newly added the ability to export API training scripts for seamless switching to PaddleX API training
  • Industrial Practice Cases
  • Added tutorial cases for steel bar counting and defect detection, focusing on object detection tasks
  • Added tutorial cases for robotic arm grasping, focusing on instance segmentation tasks
  • Added tutorial cases for training and deployment of industrial meter readings, which combines object detection, semantic segmentation, and traditional vision algorithms
  • Added a deployment case tutorial using C# language under Windows system
"},{"location":"en/CHANGLOG.html#paddlex-v200rc0-5192021","title":"PaddleX v2.0.0rc0 (5.19/2021)","text":"
  • Fully supports PaddlePaddle 2.0 dynamic graphs for an easier development mode
  • Added PP-YOLOv2 for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Comprehensive upgrade of C++ deployment module
    • PaddleInference deployment adapted to 2.0 prediction library (Usage Documentation)
    • Supports deployment of models from PaddleDetection, PaddleSeg, PaddleClas, and PaddleX
    • Added multi-GPU prediction based on PaddleInference (Usage Documentation)
    • GPU deployment added TensorRT high-performance acceleration engine deployment method based on ONNX
    • GPU deployment added Triton service-oriented deployment method based on ONNX (Docker Usage Documentation)
"},{"location":"en/CHANGLOG.html#paddlex-v130-12192020","title":"PaddleX v1.3.0 (12.19/2020)","text":"
  • Model Updates

    • Image Classification model ResNet50_vd adds a pre-trained model with 100,000 categories.
    • Object Detection model FasterRCNN adds model pruning support.
    • Object Detection models now support multi-channel image training.
  • Model Deployment Updates

    • Fixed bugs in OpenVINO deployment C++ code.
    • Raspberry Pi deployment adds Arm V8 support.
  • Industry Case Updates

    • Added an industrial quality inspection case, providing GPU and CPU deployment scenarios for industrial quality inspection, along with optimization strategies related to quality inspection.
  • New RESTful API Module A new RESTful API module is added, enabling developers to quickly develop training platforms based on PaddleX.

    • Added an HTML Demo based on RESTful API.
    • Added a Remote version of the visualization client based on RESTful API. Added deployment solutions for models through OpenVINO.
"},{"location":"en/CHANGLOG.html#paddlex-v120-992020","title":"PaddleX v1.2.0 (9.9/2020)","text":"
  • Model Updates

    • Added the object detection model PPYOLO.
    • FasterRCNN, MaskRCNN, YOLOv3, DeepLabv3p, and other models now have pre-trained models on the COCO dataset.
    • Object Detection models FasterRCNN and MaskRCNN add the backbone HRNet_W18.
    • Semantic Segmentation model DeepLabv3p adds the backbone MobileNetV3_large_ssld.
  • Model Deployment Updates

    • Added deployment solutions for models through OpenVINO.
    • Added deployment solutions for models on Raspberry Pi.
    • Optimized data preprocessing and postprocessing code performance for PaddleLite Android deployment.
    • Optimized Paddle Server-side C++ deployment code, added parameters such as use_mkl, significantly improving model prediction performance on CPUs through mkldnn.
  • Industry Case Updates

    • Added an RGB image remote sensing segmentation case.
    • Added a multi-channel remote sensing segmentation case.
  • Others

    • Added a dataset splitting function, supporting command-line splitting of ImageNet, PascalVOC, MSCOCO, and semantic segmentation datasets.

### PaddleX v1.1.0 (7.13/2020) - Model Updates

  • Added new semantic segmentation models: HRNet, FastSCNN
  • Added HRNet backbone for object detection (FasterRCNN) and instance segmentation (MaskRCNN)
  • Pre-trained models on COCO dataset for object detection and instance segmentation
  • Integrated X2Paddle, enabling all PaddleX classification and semantic segmentation models to export to ONNX protocol
  • Model Deployment Updates
  • Added support for model encryption on Windows platform
  • New deployment and prediction solutions for Jetson and PaddleLite
  • C++ deployment code now supports batch prediction and utilizes OpenMP for parallel acceleration of preprocessing
  • Added 2 PaddleX Industrial Cases
  • Portrait segmentation case
  • Industrial meter reading case
  • New data format conversion feature, converting data annotated by LabelMe, Jingling Annotation Assistant, and EasyData platform to formats supported by PaddleX
  • Updated PaddleX documentation, optimizing the document structure
"},{"location":"en/CHANGLOG.html#paddlex-v100-5212020","title":"PaddleX v1.0.0 (5.21/2020)","text":"
  • End-to-End Pipeline
  • Data Preparation: Supports the EasyData Intelligent Data Service Platform data protocol, facilitating intelligent annotation and low-quality data cleaning through the platform. It is also compatible with mainstream annotation tool protocols, helping developers complete data preparation faster.
  • Model Training: Integrates PaddleClas, PaddleDetection, PaddleSeg vision development kits, providing a rich selection of high-quality pre-trained models for faster achievement of industrial-grade model performance.
  • Model Tuning: Built-in model interpretability modules and VisualDL visualization analysis components, providing abundant information for better understanding and optimizing models.
  • Secure Multi-platform Deployment: Integrated with PaddleSlim model compression tools and model encryption deployment modules, facilitating high-performance and secure multi-platform deployment in conjunction with Paddle Inference or Paddle Lite.

  • Integrated Industrial Practices

  • Selects mature model architectures from PaddlePaddle's industrial practices, opening up case study tutorials to accelerate developers' industrial implementation.

  • Easy-to-Use and Easy-to-Integrate

  • Unified and user-friendly end-to-end APIs, enabling model training in 5 steps and high-performance Python/C++ deployment with just 10 lines of code.
  • Provides PaddleX-GUI, a cross-platform visualization tool centered on PaddleX, for a quick experience of the full PaddlePaddle deep learning pipeline.
"},{"location":"en/FAQ.html","title":"FAQ","text":""},{"location":"en/FAQ.html#q-what-is-paddlex","title":"Q: What is PaddleX?","text":"

A: PaddleX is a low-code development tool featuring selected models and pipelines launched by the PaddlePaddle team. It aims to provide developers with a more convenient and efficient development environment. This tool supports model training and inference on multiple mainstream domestic and international hardware, and is compatible with various system configurations, thereby meeting users' needs in different application scenarios. PaddleX has a wide range of applications, covering industries such as industry, energy, finance, transportation, and education, providing professional support and solutions for these industries. By using PaddleX, developers can more easily apply deep learning technology to actual industrial practices, thereby realizing technology implementation and transformation, and promoting digital transformation and intelligent upgrading across industries.

"},{"location":"en/FAQ.html#q-what-is-a-pipeline-what-is-a-module-what-is-the-relationship-between-them","title":"Q: What is a Pipeline? What is a Module? What is the relationship between them?","text":"

A: In PaddleX, a module is defined as the smallest unit that implements basic functions, meaning each module undertakes a specific task, such as text detection. Within this framework, a pipeline is the actual functionality achieved by one or more modules working together, often forming more complex application scenarios, such as Optical Character Recognition (OCR) technology. Therefore, the relationship between modules and pipelines can be understood as the relationship between basics and applications. Modules, as the smallest units, provide the foundation for construction, while pipelines demonstrate the practical application effects of these foundational modules after reasonable combination and configuration. This design approach allows users to flexibly select and combine different modules to achieve the functions they need, significantly enhancing development flexibility and efficiency. The official pipelines also support users with high-performance inference, service-oriented deployment, and other deployment capabilities.

"},{"location":"en/FAQ.html#q-how-to-choose-between-the-wheel-package-installation-mode-and-the-plugin-installation-mode","title":"Q: How to choose between the Wheel package installation mode and the plugin installation mode?","text":"

A: If your application scenario in using PaddleX mainly focuses on model inference and integration, we highly recommend choosing a more convenient and lightweight installation method, namely the Wheel package installation mode. This installation mode aims to provide users with a quick and simple installation experience, especially suitable for scenarios requiring rapid deployment and integration of models. Installing with Wheel packages can significantly reduce the complexity of the installation process, avoid unnecessary configuration issues, and allow developers to focus more time and effort on the practical application and optimization of models. Whether you are a novice or an experienced developer, this lightweight installation method will greatly facilitate your workflow. Therefore, when performing model inference and integration, choosing the Wheel package installation mode will undoubtedly make your entire development process more efficient and smooth.

"},{"location":"en/FAQ.html#q-what-is-the-difference-between-paddlex-and-baidu-aistudio-communitys-zero-code-pipeline","title":"Q: What is the difference between PaddleX and Baidu AIStudio Community's Zero-Code Pipeline?","text":"

A: Baidu AIStudio Community's Zero-Code Pipeline is the cloud-based carrier of PaddleX, with its underlying code consistent with PaddleX, and can be considered as a cloud-based PaddleX. The design philosophy of Baidu AIStudio Community's Zero-Code Pipeline is to enable users to quickly build and deploy model applications without needing to delve deeply into programming and algorithm knowledge. On this basis, Baidu AIStudio Community's Zero-Code Pipeline also provides many special pipelines, such as training high-precision models with a small number of samples and solving complex time-series problems using multi-model fusion schemes. PaddleX, on the other hand, is a local development tool that provides users with powerful functions supporting more in-depth secondary development. This means developers can flexibly adjust and expand based on PaddleX to create solutions that better fit specific application scenarios. Additionally, PaddleX offers a rich set of model interfaces, supporting users in freely combining models for use.

"},{"location":"en/FAQ.html#q-when-i-encounter-problems-while-using-paddlex-how-should-i-provide-feedback","title":"Q: When I encounter problems while using PaddleX, how should I provide feedback?","text":"

A: Welcome to the Discussion Area to communicate with a vast number of developers! If you find errors or deficiencies in PaddleX, you are also welcome to submit an issue, and our on-duty team members will respond to your questions as soon as possible.

"},{"location":"en/quick_start.html","title":"Quick Start","text":""},{"location":"en/quick_start.html#installation","title":"\ud83d\udee0\ufe0f Installation","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

  • Installing PaddlePaddle
# cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

\u2757For more PaddlePaddle versions, please refer to the PaddlePaddle official website.

  • Installing PaddleX
pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n

\u2757For more installation methods, refer to the PaddleX Installation Guide.

"},{"location":"en/quick_start.html#cli-usage","title":"\ud83d\udcbb CLI Usage","text":"

One command can quickly experience the pipeline effect, the unified CLI format is:

paddlex --pipeline [Pipeline Name] --input [Input Image] --device [Running Device]\n

You only need to specify three parameters: * pipeline: The name of the pipeline * input: The local path or URL of the input image to be processed * device: The GPU number used (for example, gpu:0 means using the 0th GPU), you can also choose to use the CPU (cpu)

For example, using the OCR pipeline:

paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png  --device gpu:0\n

{\n'input_path': '/root/.paddlex/predict_input/general_ocr_002.png',\n'dt_polys': [array([[161,  27],\n       [353,  22],\n       [354,  69],\n       [162,  74]], dtype=int16), array([[426,  26],\n       [657,  21],\n       [657,  58],\n       [426,  62]], dtype=int16), array([[702,  18],\n       [822,  13],\n       [824,  57],\n       [704,  62]], dtype=int16), array([[341, 106],\n       [405, 106],\n       [405, 128],\n       [341, 128]], dtype=int16)\n       ...],\n'dt_scores': [0.758478200014338, 0.7021546472698513, 0.8536622648391111, 0.8619181462164781, 0.8321051217096188, 0.8868756173427551, 0.7982964727675609, 0.8289939036796322, 0.8289428877522524, 0.8587063317632897, 0.7786755892491615, 0.8502032769081344, 0.8703346500042997, 0.834490931790065, 0.908291103353393, 0.7614978661708064, 0.8325774055997542, 0.7843421347676149, 0.8680889482955594, 0.8788859304537682, 0.8963341277518075, 0.9364654810069546, 0.8092413027028257, 0.8503743089091863, 0.7920740420391101, 0.7592224394793805, 0.7920547400069311, 0.6641757962457888, 0.8650289477605955, 0.8079483304467047, 0.8532207681055275, 0.8913377034754717],\n'rec_text': ['\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', 'CLASS', '\u200b\u5e8f\u53f7\u200b SERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200b', '\u200b\u65e5\u671f\u200b DATE', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHW', '035', 'MU2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', \u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE10MINUTESBEFOREDEPARTURETIME'],\n'rec_score': [0.9985831379890442, 0.999696917533874512, 0.9985735416412354, 0.9842517971992493, 0.9383274912834167, 0.9943678975105286, 0.9419361352920532, 0.9221674799919128, 0.9555020928382874, 0.9870321154594421, 0.9664073586463928, 0.9988052248954773, 0.9979352355003357, 0.9985110759735107, 0.9943482875823975, 0.9991195797920227, 0.9936401844024658, 0.9974591135978699, 0.9743705987930298, 0.9980487823486328, 0.9874696135520935, 0.9900962710380554, 0.9952947497367859, 0.9950481653213501, 0.989926815032959, 0.9915552139282227, 0.9938777685165405, 0.997239887714386, 0.9963340759277344, 0.9936134815216064, 0.97223961353302]}\n

The visualization result is as follows:

To use the command line for other pipelines, simply adjust the pipeline parameter to the name of the corresponding pipeline. Below are the commands for each pipeline:

Pipeline Name Command Image Classification paddlex --pipeline image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Object Detection paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 Instance Segmentation paddlex --pipeline instance_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png --device gpu:0 Semantic Segmentation paddlex --pipeline semantic_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png --device gpu:0 Image Multi-label Classification paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Small Object Detection paddlex --pipeline small_object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/small_object_detection.jpg --device gpu:0 Image Anomaly Detection paddlex --pipeline anomaly_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_grid.png --device gpu:0 OCR paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 Table Recognition paddlex --pipeline table_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg --device gpu:0 Layout Parsing paddlex --pipeline layout_parsing --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/demo_paper.png --device gpu:0 Formula Recognition paddlex --pipeline formula_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/demo_image/general_formula_recognition.png --device gpu:0 Seal Recognition paddlex --pipeline seal_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/seal_text_det.png --device gpu:0 Time Series Forecasting paddlex --pipeline ts_fc --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv --device gpu:0 Time Series Anomaly Detection paddlex --pipeline ts_ad --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv --device gpu:0 Time Series Classification paddlex --pipeline ts_cls --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv --device gpu:0"},{"location":"en/quick_start.html#python-script-usage","title":"\ud83d\udcdd Python Script Usage","text":"

With just a few lines of code, you can quickly perform inference on a production line. The unified Python script format is as follows:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=[PipelineName])\noutput = pipeline.predict([InputImageName])\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n
The following steps are executed:

  • create_pipeline() instantiates the production line object.
  • An image is passed in and the predict method of the production line object is called for inference and prediction.
  • The prediction results are processed.

For other production lines using the Python script, you only need to adjust the pipeline parameter of the create_pipeline() method to the corresponding production line name. Below is a list of each production line's corresponding parameter name and detailed usage explanation:

Production Line Name Corresponding Parameter Detailed Explanation Document Scene Information Extraction v3 PP-ChatOCRv3-doc Document Scene Information Extraction v3 Python Script Instructions General Image Classification image_classification General Image Classification Python Script Instructions General Object Detection object_detection General Object Detection Python Script Instructions General Instance Segmentation instance_segmentation General Instance Segmentation Python Script Instructions General Semantic Segmentation semantic_segmentation General Semantic Segmentation Python Script Instructions Image Multi-label Classification multi_label_image_classification Image Multi-label Classification Python Script Instructions Small Object Detection small_object_detection Small Object Detection Python Script Instructions Image Anomaly Detection anomaly_detection Image Anomaly Detection Python Script Instructions General OCR OCR General OCR Python Script Instructions General Table Recognition table_recognition General Table Recognition Python Script Instructions General Layout Parsing layout_parsing General Layout Parsing Python Script Instructions Formula Recognition formula_recognition Formula Recognition Python Script Instructions Seal Text Recognition seal_recognition Seal Text Recognition Python Script Instructions Time Series Forecasting ts_fc Time Series Forecasting Python Script Instructions Time Series Anomaly Detection ts_ad Time Series Anomaly Detection Python Script Instructions Time Series Classification ts_cls Time Series Classification Python Script Instructions"},{"location":"en/blog/index.html","title":"Blog","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html","title":"PaddleX Image Classification Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for image classification related single models. Click on the above link to refer to the homepage documentation for installing the data annotation tool and viewing detailed usage procedures.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical interface. It can be used for tasks such as image classification, object detection, and image segmentation. In instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_classification.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt for the dataset to be annotated in the pets folder, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat and dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_classification.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py script to convert the annotated dataset to the ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the path to the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_classification.html#2-data-format","title":"2. Data Format","text":"
  • The dataset defined by PaddleX for image classification tasks is named ClsDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot```bash\nclassname1\nclassname2\nclassname3\n...\n
Modified label.txt:

```bash 0 classname1 1 classname2 2 classname3 ...

"},{"location":"en/data_annotations/cv_modules/image_feature.html","title":"PaddleX Image Feature Task Module Data Annotation Tutorial","text":"

This section will introduce how to use the Labelme annotation tool to complete data annotation for image feature-related single models. Click the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. In image feature annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt in the pets folder for the dataset to be annotated, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat-dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_feature.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select the save path upon the first save. If autosave is enabled, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py to convert the annotated dataset to ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_feature.html#134-data-format-conversion","title":"1.3.4 Data Format Conversion","text":"

After obtaining data in LabelMe format, the data format needs to be converted to ShiTuRecDataset format. Below is a code example that demonstrates how to convert the data labeled using LabelMe according to the previous tutorial.

# Download and unzip the LabelMe format example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n# Convert the LabelMe example dataset\npython main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#3-data-format","title":"3. Data Format","text":"

The dataset defined by PaddleX for image classification tasks is named ShiTuRecDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but should correspond to the content of train.txt, query.txt, gallery.txt\n\u251c\u2500\u2500 gallery.txt   # Annotation file for the gallery set, the file name cannot be changed. Each line gives the path of the image to be retrieved and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_2_side.jpg 3997\n\u2514\u2500\u2500 query.txt     # Annotation file for the query set, the file name cannot be changed. Each line gives the path of the database image and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_1_front.jpg 3997\n

The annotation files use an image feature format. Please refer to the above specifications to prepare your data. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html","title":"PaddleX Instance Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to instance segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is a fruit instance segmentation dataset, covering five different types of fruits, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as fruit.
  • Create an images directory (must be named images) within fruit and store the images to be annotated in the images directory, as shown below:
  • Create a category label file label.txt in the fruit folder for the dataset to be annotated, and write the categories of the dataset to be annotated into label.txt by line. Taking the fruit instance segmentation dataset's label.txt as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/fruit\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* labels is the path to the category labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting labelme, it will look like this:

* Click Edit to select the annotation type, choose Create Polygons. * Create polygons on the image to outline the boundaries of the segmentation areas.

* Click again to select the category of the segmentation area.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

  • Then click Next Image to annotate the next image.

* The final annotated label file will look like this.

  • Adjusting Directory Structure to Obtain a Standard labelme Format Dataset for Fruit Instance Segmentation

  • Prepare the train_anno_list.txt and val_anno_list.txt text files in the root directory of your dataset. Populate these files with the paths of all json files in the annotations directory, distributing them into train_anno_list.txt and val_anno_list.txt at a specified ratio. Alternatively, you can include all paths in train_anno_list.txt and create an empty val_anno_list.txt file, intending to use a zero-code data splitting feature for re-partitioning upon upload. The specific format for filling train_anno_list.txt and val_anno_list.txt is illustrated as follows:

  • The final directory structure after organization should resemble the following:

  • Compress the fruit directory into a .tar or .zip format archive to obtain the standard labelme format dataset for fruit instance segmentation.
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named COCOInstSegDataset for instance segmentation tasks, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Training set annotation file, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Validation set annotation file, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

Annotation files adopt the COCO format. Please refer to the above specifications for data preparation. Additionally, refer to: Example Dataset.

When using PaddleX 2.x version for instance segmentation datasets, please refer to the corresponding format conversion section in Instance Segmentation Module Development Tutorial to convert VOC format datasets to COCO datasets. (Note in module development documentation)

Note:

  • Instance segmentation data requires the use of the COCO data format to annotate the pixel boundaries and categories of each target area in each image in the dataset. The polygon boundaries (segmentation) of objects are represented as [x1,y1,x2,y2,...,xn,yn], where (xn,yn) denotes the coordinates of each corner point of the polygon. Annotation information is stored in json files under the annotations directory, with separate files for the training set (instance_train.json) and validation set (instance_val.json).
  • If you have a batch of unlabeled data, we recommend using LabelMe for data annotation. PaddleX Pipelines support data format conversion for datasets annotated with LabelMe.
  • To ensure successful format conversion, please strictly follow the file naming and organization of the example dataset: LabelMe Example Dataset.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html","title":"PaddleX Multi-Label Classification Task Data Annotation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for multi-label classification tasks with a single model. Click on the above links to install the annotation tools and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is manually collected, covering two categories: safety helmets and human heads, with photos taken from different angles. Image examples:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for image classification, object detection, image segmentation, and other tasks. In object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated into label.txt by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After labeling, click Save. (If the output field is not specified when starting Labelme, it will prompt you to select a save path the first time you save. If the autosave field is used for automatic saving, there is no need to click the Save button).

* Then click Next Image to label the next image.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • It can also be installed with pip in one step
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in the browser after starting. Next, you can start the annotation process based on the task.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#32-annotation-process-with-paddlelabel","title":"3.2 Annotation Process with PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and click on Object Detection.

* Fill in the project name and dataset path. Note that the path is the absolute path on the local machine. Click Create after completion.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding id. Click Add Category to create the required category names. * Start annotating * Select the label you want to annotate with. * Click the rectangular selection button on the left. * Draw a bounding box around the desired region in the image, ensuring semantic partitioning. If there are multiple columns, annotate each separately. * After completing the annotation, the result will appear in the lower-right corner. Check if the annotation is correct. * Once done, click Project Overview.

  • Export Annotated Files

  • In the Project Overview, segment the dataset as needed and click \"Export Dataset\".

  • Fill in the export path and format. The export path should be an absolute path, and the format should be coco.

  • After successful export, the annotated files will be available in the specified path.

  • Adjust directories to obtain COCO-formatted dataset for helmet detection

  • Rename the three json files and the image directory as follows:

Original File/Directory Name Renamed File/Directory Name train.json instance_train.json

|val.json|instance_val.json|

|test.json|instance_test.json| |image|images|

  • Create an annotations directory in the root of the dataset and move all json files into it. The final dataset structure should look like this:

  • Compress the helmet directory into a .tar or .zip file to obtain the COCO-formatted dataset for helmet detection.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#4-image-multi-label-classification-data-format-conversion","title":"4. Image Multi-Label Classification Data Format Conversion","text":"

After obtaining data in COCO format, you need to convert the data format to MLClsDataset format. Below is a code example that follows the previous tutorial to use LabelMe or PaddleLabel annotated data and perform data format conversion:

# Download and unzip the COCO example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n# Convert the COCO example dataset to MLClsDataset\npython main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#5-data-format","title":"5. Data Format","text":"

The dataset defined by PaddleX for image multi-label classification tasks is named MLClsDataset, with the following directory structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot be changed. Each line gives the category ID and category name, for example: 45 wallflower\n\u251c\u2500\u2500 train.txt  # Annotation file for the training set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0041_2456602544.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n\u2514\u2500\u2500 val.txt    # Annotation file for the validation set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0045_845243484.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n

The annotation files use the multi-label classification format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/object_detection.html","title":"PaddleX Object Detection Task Data Preparation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for single-model object detection tasks. Click the above links to install the annotation tools and view detailed usage instructions.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/object_detection.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated, line by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After annotation, click Save. (If output is not specified when starting Labelme, it will prompt to select a save path upon the first save. If autosave is enabled, no need to click Save.)

* Click Next Image to annotate the next.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/object_detection.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • Alternatively, you can install it with pip in one command:
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in your browser after startup. You can then proceed with the annotation process based on your task.
"},{"location":"en/data_annotations/cv_modules/object_detection.html#32-annotation-process-of-paddlelabel","title":"3.2 Annotation Process of PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and then click on Object Detection.

* Fill in the project name and dataset path. Note that the path should be an absolute path on your local machine. Click Create when done.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding ID. Click Add Category to create the required category names. * Start Annotating * First, select the label you need to annotate. * Click the rectangular selection button on the left. * Draw a bounding box around the desired area in the image, paying attention to semantic partitioning. If there are multiple columns, please annotate each separately. * After completing the annotation, the annotation result will appear in the lower right corner. You can check if the annotation is correct. * When all annotations are complete, click Project Overview.

* Export Annotation Files * In Project Overview, divide the dataset as needed, then click Export Dataset.

* Fill in the export path and export format. The export path should also be an absolute path, and the export format should be selected as coco.

* After successful export, you can obtain the annotation files in the specified path.

* Adjust the directory to obtain the standard coco format dataset for helmet detection * Rename the three json files and the image directory according to the following correspondence:

Original File (Directory) Name Renamed File (Directory) Name train.json instance_train.json val.json instance_val.json test.json instance_test.json image images
  • Create an annotations directory in the root directory of the dataset and move all json files to the annotations directory. The final dataset directory structure will look like this:

* Compress the helmet directory into a .tar or .zip format compressed package to obtain the standard coco format dataset for helmet detection.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#4-data-format","title":"4. Data Format","text":"

The dataset defined by PaddleX for object detection tasks is named COCODetDataset, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Annotation file for the training set, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Annotation file for the validation set, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

The annotation files use the COCO format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html","title":"PaddleX Semantic Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to semantic segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":"

This dataset is a manually collected street scene dataset, covering two categories of vehicles and roads, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is an image annotation software written in python with a graphical interface. It can be used for tasks such as image classification, object detection, and semantic segmentation. In semantic segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as seg_dataset
  • Create an images directory within seg_dataset (the directory name can be modified, but ensure the subsequent command's image directory name is correct), and store the images to be annotated in the images directory, as shown below:
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#232-launch-labelme","title":"2.3.2 Launch Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and launch the labelme annotation tool.

# Windows\ncd C:\\path\\to\\seg_dataset\n# Mac/Linux\ncd path/to/seg_dataset\n
labelme images --nodata --autosave --output annotations\n
* nodata stops storing image data in the JSON file * autosave enables automatic saving * output specifies the path for storing label files

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#233-start-image-annotation","title":"2.3.3 Start Image Annotation","text":"
  • After launching labelme, it will look like this:

* Click \"Edit\" to select the annotation type

* Choose to create polygons

* Draw the target contour on the image

  • When the contour line is closed as shown in the left image below, a category selection box will pop up, allowing you to input or select the target category

Typically, only the foreground objects need to be labeled with their respective categories, while other pixels are automatically considered as background. If manual background labeling is required, the category must be set to background, otherwise errors may occur during dataset format conversion. For noisy parts or irrelevant sections in the image that should not participate in model training, the ignore class can be used, and the model will automatically skip those parts during training. For objects with holes, after outlining the main object, draw polygons along the edges of the holes and assign a specific category to the holes. If the hole represents background, assign it as background. An example is shown below:

  • After labeling, click \"Save\". (If the output field is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is enabled, the save button is not required.)

* Then click \"Next Image\" to proceed to the next image for labeling.

  • The final labeled file will look like this:

  • Adjust the directory structure to obtain a standard LabelMe format dataset for safety helmet detection: a. Download and execute the directory organization script in the root directory of your dataset, seg_dataset. After executing the script, the train_anno_list.txt and val_anno_list.txt files will contain content as shown:

    python format_seg_labelme_dataset.py\n
    b. The final directory structure after organization will look like this:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with LabelMe, the data format needs to be converted to the Seg data format. Below is a code example for converting data labeled using LabelMe according to the above tutorial.

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n\npython main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#data-format","title":"Data Format","text":"

The dataset defined by PaddleX for image segmentation tasks is named SegDataset, with the following organizational structure and annotation format:

dataset_dir         # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations     # Directory for storing annotated images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 images          # Directory for storing original images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 train.txt       # Annotation file for the training set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/P0005.jpg annotations/P0005.png\n\u2514\u2500\u2500 val.txt         # Annotation file for the validation set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/N0139.jpg annotations/N0139.png\n
Label images should be single-channel grayscale or single-channel pseudo-color images, and it is recommended to save them in PNG format. Each pixel value in the label image represents a category, and the categories should start from 0 and increase sequentially, for example, 0, 1, 2, 3 represent 4 categories. The pixel storage of the label image is 8bit, so a maximum of 256 categories are supported for labeling.

Please prepare your data according to the above specifications. Additionally, you can refer to: Example Dataset

"},{"location":"en/data_annotations/ocr_modules/table_recognition.html","title":"PaddleX Table Structure Recognition Task Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/table_recognition.html#1-data-annotation","title":"1. Data Annotation","text":"

For annotating table data, use the PPOCRLabelv2 tool. Detailed steps can be found in: \u3010Video Demonstration\u3011

Table annotation focuses on structured extraction of table data, converting tables in images into Excel format. Therefore, annotation requires the use of an external software to open Excel simultaneously. In PPOCRLabel, complete the annotation of text information within the table (text and position), and in the Excel file, complete the annotation of table structure information. The recommended steps are:

  1. Table Recognition: Open the table image, click the Table Recognition button in the upper right corner of the software. The software will call the table recognition model in PP-Structure to automatically label the table, and simultaneously open an Excel file.
  2. Modify Annotation Results: Add annotation boxes with each cell as the unit (i.e., all text within a cell is marked as one box). Right-click on the annotation box and select Cell Re-recognition to automatically recognize the text within the cell using the model.
  3. Adjust Cell Order: Click View - Show Box Number to display the annotation box numbers. Drag all results under the Recognition Results column on the right side of the software interface to arrange the annotation box numbers in order from left to right and top to bottom, annotating by row.
  4. Annotate Table Structure: In an external Excel software, mark cells with text as any identifier (e.g., 1), ensuring that the cell merging in Excel matches the original image (i.e., the text in Excel cells does not need to be identical to the text in the image).
  5. Export JSON Format: Close all Excel files corresponding to the table images, click File - Export Table Annotation, and generate the gt.txt annotation file.
"},{"location":"en/data_annotations/ocr_modules/table_recognition.html#2-data-format","title":"2. Data Format","text":"

The dataset structure and annotation format defined by PaddleX for table recognition tasks are as follows:

```ruby dataset_dir # Root directory of the dataset, the directory name can be changed \u251c\u2500\u2500 images # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt \u251c\u2500\u2500 train.txt # Training set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"\u3001\", \"\u200b\u81ea\u200b\", \"\u200b\u6211\u200b\"], \"bbox\": [[[5, 2], [231, 2], [231, 35], [5, 35]]]}, {\"tokens\": [\"9\"], \"bbox\": [[[168, 68], [231, 68], [231, 98], [168, 98]]]}]}, \"gt\": \"\u3001\u200b\u81ea\u6211\u200bAghas\u200b\u5931\u5434\u200b\u6708\u200b\uff0clonwyCau9\"} \u2514\u2500\u2500 val.txt # Validation set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/no_border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"a"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html","title":"PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#2-ppocrlabel-annotation","title":"2. PPOCRLabel Annotation","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#21-introduction-to-ppocrlabel-annotation-tool","title":"2.1 Introduction to PPOCRLabel Annotation Tool","text":"

PPOCRLabel is a semi-automatic graphical annotation tool tailored for OCR tasks, featuring automatic annotation and re-recognition of data using the built-in PP-OCR model. Written in Python3 and PyQT5, it supports rectangular box annotation, table annotation, irregular text annotation, and key information annotation modes. In OCR annotation tasks, labels are stored as txt files.

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#22-installation-and-running-ppocrlabel","title":"2.2 Installation and Running PPOCRLabel","text":"

PPOCRLabel can be launched through whl packages or Python scripts. The whl package method is more convenient, and only this method is provided here:

  • For Windows:
    pip install PPOCRLabel  # Installation\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n

[!NOTE] Installing PPOCRLabel via whl packages will automatically download the paddleocr whl package. The shapely dependency may encounter a \"[winRrror 126] The specified module could not be found.\" error. It is recommended to download and install the shapely installation package separately.

  • For MacOS:
    pip3 install PPOCRLabel\npip3 install opencv-contrib-python-headless==4.2.0.32 # Add \"-i https://mirror.baidu.com/pypi/simple\" for faster downloads\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n
"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#23-annotation-process-for-text-detection-and-text-recognition","title":"2.3 Annotation Process for Text Detection and Text Recognition","text":"
  1. Installation and Running: Use the above commands to install and run the program.
  2. Open Folder: Click \"File\" - \"Open Directory\" to select the folder containing images to be annotated.

3. Auto Annotation: Click \"Auto Annotation\" to use the PP-OCR ultra-lightweight model to automatically annotate images with a file status of \"X\".

4. Manual Annotation: Click \"Rectangle Annotation\" (recommended to press \"W\" directly in English mode), and users can manually draw bounding boxes for parts undetected by the model in the current image. Press \"Q\" on the keyboard to use the four-point annotation mode (or click \"Edit\" - \"Four-point Annotation\"), and users click 4 points in sequence, double-clicking the left mouse button to indicate completion. 5. After drawing the bounding box, click \"Confirm\", and the detection box will be pre-assigned a \"To Be Recognized\" label. 6. Re-Recognition: After drawing/adjusting all detection boxes in the image, click \"Re-Recognition\", and the PP-OCR model will re-recognize all detection boxes in the current image.

7. Content Modification: Click on the recognition result to manually modify inaccurate recognition results. 8. Confirm Annotation: Click \"Confirm\", the image status changes to \"\u221a\", and proceed to the next image. 9. Deletion: Click \"Delete Image\", and the image will be deleted to the Recycle Bin. 10. Export Results: Users can manually export results through \"File - Export Annotation Results\" or enable automatic export by clicking \"File - Auto Export Annotation Results\". Manually confirmed annotations will be stored in Label.txt under the opened image folder. Clicking \"File - Export Recognition Results\" in the menu bar will save the recognition training data of such images in the crop_img folder, and the recognition labels will be saved in rec_gt.txt.

Notes:

  • PPOCRLabel uses folders as the basic unit for labeling. After opening the folder containing images to be labeled, the images will not be displayed in the window bar. Instead, clicking \"Select Folder\" will directly import the images under the folder into the program.
  • The image status indicates whether the current image has been manually saved by the user. An \"X\" indicates it has not been manually saved, while a \"\u221a\" indicates it has. After clicking the \"Auto Label\" button, PPOCRLabel will not relabel images with a status of \"\u221a\".
  • Clicking \"Re-recognize\" will overwrite the recognition results in the image. Therefore, if manual changes have been made to the recognition results before this, they may be altered after re-recognition.
  • Files generated by PPOCRLabel are placed in the folder containing the labeled images, including the following types. Do not manually modify their contents as it may cause program exceptions.
File Name Description Label.txt Detection labels, which can be directly used for PPOCR detection model training. The program automatically writes to this file every 5 confirmed detection results, or when the application is closed or the file path is changed. fileState.txt Image status marker file, which saves the names of images in the current folder that have been manually confirmed by the user. Cache.cach Cache file, which saves the results of automatic recognition by the model. rec_gt.txt Recognition labels. Can be directly used for PPOCR recognition model training. Generated by manually clicking \"Export Recognition Results\" in the menu bar. crop_img Recognition data. Images cropped according to the detection boxes. Generated simultaneously with rec_gt.txt.

If data partitioning is required, follow these steps:

cd ./PPOCRLabel # Switch to the PPOCRLabel folder\npython gen_ocr_train_val_test.py --trainValTestRatio 7:3:0 --datasetRootPath ../train_data\n
* trainValTestRatio is the ratio for dividing images into training, validation, and test sets. Set it according to your needs. The default is 6:2:2. * datasetRootPath is the full path to the dataset labeled by PPOCRLabel. The default path is PaddleOCR/train_data. Before partitioning the dataset, the structure should be as follows:

|-train_data\n  |-crop_img\n    |- word_001_crop_0.png\n    |- word_002_crop_0.jpg\n    |- word_003_crop_0.jpg\n    | ...\n  | Label.txt\n  | rec_gt.txt\n  |- word_001.png\n  |- word_002.jpg\n  |- word_003.jpg\n  | ...\n
For more tool usage instructions, please refer to Detailed Instructions

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named TextDetDataset specifically for text detection tasks. The organized and annotated data should follow the following file organization and naming conventions:

dataset_dir     # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images      # Directory to store images, the directory name can be changed but should correspond to the content in train.txt and val.txt\n\u251c\u2500\u2500 train.txt   # Annotation file for the training set, the file name cannot be changed. Example content: images/img_0.jpg \\t [{\"transcription\": \"MASA\", \"points\": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]\n\u2514\u2500\u2500 val.txt     # Annotation file for the validation set, the file name cannot be changed. Example content: images/img_61.jpg \\t [{\"transcription\": \"TEXT\", \"points\": [[31, 10], [310, 140], [420, 220], [310, 170]]}, {...}]\n
Place the images in the images directory, and rename the generated Label.txt annotation file to train.txt for the training set. Similarly, rename the Label.txt annotation file for the validation set to val.txt. Both files should be placed in the dataset_dir (the name of which can be changed) directory. Note that the image paths in train.txt/val.txt should be in the format images/xxx.

Each line in the annotation files contains the path to an image and a list of dictionaries. The path and the list must be separated by a tab character \u2018\\t\u2019, not spaces.

For the list of dictionaries, the points key represents the coordinates (x, y) of the four vertices of the text box, starting from the top-left vertex and proceeding clockwise. The transcription key indicates the text within the text box. If the transcription content is \"###\", it indicates that the text box is invalid and will not be used for training. For reference, see the example dataset.

If you use PPOCRLabel to annotate your data, simply rename det_gt_train.txt in the text detection (det) directory to train.txt and det_gt_test.txt to val.txt after dividing your dataset.

"},{"location":"en/data_annotations/time_series_modules/time_series_anomaly_detection.html","title":"PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial","text":"

Time series anomaly detection is an unsupervised learning task, thus there is no need to annotate training data. The collected training samples should ideally consist solely of normal data, i.e., no anomalies (represented by 0 for no anomaly). In the training set, the label column indicating anomalies can be set to 0 or omitted entirely. For the validation set, to evaluate model accuracy, annotations are required. For points that are anomalous at a specific time, set the label for that time point to 1, and the labels for other normal time points to 0.

"},{"location":"en/data_annotations/time_series_modules/time_series_classification.html","title":"PaddleX Time Series Classification Task Data Annotation Tutorial","text":"

When annotating time series classification data, based on the collected real-world data, clearly define the classification objectives of the time series data and establish corresponding classification labels. In the csv file, set a group_id column to represent samples, where the same group_id indicates that the data points belong to the same sample. For example, in stock price prediction, labels might be \"Rise\" (0), \"Flat\" (1), or \"Fall\" (2). For a time series that exhibits an \"upward\" trend over a period, it can be considered as one sample (group), where each time point in this series shares the same group_id, and the label column is set to 0. Similarly, for a time series that exhibits a \"downward\" trend, it forms another sample (group), where each time point shares the same group_id, and the label column is set to 2. As shown in the figure below, the green box represents one sample (group_id=0) with a label of 1, while the red box represents another time series classification sample (group_id=1) with a label of 0. If there are n samples, you can set group_id=0,...,n-1; each sample has a length (time=0,...,9) of 10, and the feature dimensions (dim_0, dim_1) are 2.

"},{"location":"en/data_annotations/time_series_modules/time_series_forecasting.html","title":"PaddleX Time Series Forecasting Task Data Annotation Tutorial","text":"

Data for time series forecasting tasks does not require annotation. Simply collect real-world data and arrange it in a csv file in chronological order. During training, the data will be automatically segmented into multiple time slices to form training samples, as shown in the figure below. The historical time series data and future sequences represent the input data for training the model and its corresponding prediction targets, respectively. To ensure data quality and completeness, missing values can be filled based on expert experience or statistical methods.

"},{"location":"en/installation/installation.html","title":"PaddleX Local Installation Tutorial","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

"},{"location":"en/installation/installation.html#1-quick-installation","title":"1. Quick Installation","text":"

Welcome to PaddleX, Baidu's low-code development tool for AI. Before we dive into the local installation process, please clarify your development needs and choose the appropriate installation mode.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. Below, we introduce their respective application scenarios:

"},{"location":"en/installation/installation.html#11-wheel-package-installation-mode","title":"1.1 Wheel Package Installation Mode","text":"

If your use case for PaddleX involves model inference and integration, we recommend the more convenient and lightweight Wheel package installation mode.

After installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the PaddleX Wheel package by executing the following commands:

\u2757 Note: Please ensure that PaddlePaddle is successfully installed before proceeding to the next step.

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n
"},{"location":"en/installation/installation.html#12-plugin-installation-mode","title":"1.2 Plugin Installation Mode","text":"

If your use case for PaddleX involves custom development (e.g. retraining models, fine-tuning models, customizing model structures, customizing inference codes, etc.), we recommend the more powerful plugin installation mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration with the supported models but also conduct advanced operations such as model training for custom development.

The plugins supported by PaddleX are listed below. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection PP-ChatOCRv3-doc Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionText Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Forecasting Time Series Forecasting Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS Image Multi-Label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin you need to install is PaddleXXX, after installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the corresponding PaddleX plugin by executing the following commands:

git clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\npip install -e .\npaddlex --install PaddleXXX\n

\u2757 Note: The two installation methods are not mutually exclusive, and you can install both simultaneously.

Next, we provide detailed installation tutorials for your reference. If you are using a Linux operating system, please refer to 2. Detailed Tutorial for Installing PaddleX on Linux.

"},{"location":"en/installation/installation.html#2-detailed-tutorial-for-installing-paddlex-on-linux","title":"2. Detailed Tutorial for Installing PaddleX on Linux","text":"

When installing PaddleX on Linux, we strongly recommend using the official PaddleX Docker image. Alternatively, you can use other custom installation methods.

When using the official Docker image, PaddlePaddle, PaddleX (including the wheel package and all plugins), and the corresponding CUDA environment are already pre-installed. You can simply obtain the Docker image and start the container to begin using it.

When using custom installation methods, you need to first install the PaddlePaddle framework, then obtain the PaddleX source code, and finally choose the PaddleX installation mode.

"},{"location":"en/installation/installation.html#21-get-paddlex-based-on-docker","title":"2.1 Get PaddleX based on Docker","text":"

Using the PaddleX official Docker image, create a container called 'paddlex' and map the current working directory to the '/paddle' directory inside the container by following the command.

If your Docker version >= 19.03, please use:

# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • If you want to delve deeper into the principles or usage of Docker, please refer to the Docker Official Website or the Docker Official Tutorial.

"},{"location":"en/installation/installation.html#22-custom-installation-of-paddlex","title":"2.2 Custom Installation of PaddleX","text":"

Before installation, please ensure you have completed the local installation of PaddlePaddle by referring to the PaddlePaddle Local Installation Tutorial.

"},{"location":"en/installation/installation.html#221-obtain-paddlex-source-code","title":"2.2.1 Obtain PaddleX Source Code","text":"

Next, use the following command to obtain the latest PaddleX source code from GitHub:

git clone https://github.com/PaddlePaddle/PaddleX.git\n
If accessing GitHub is slow, you can download from Gitee instead, using the following command:

git clone https://gitee.com/paddlepaddle/PaddleX.git\n
"},{"location":"en/installation/installation.html#222-install-paddlex","title":"2.2.2 Install PaddleX","text":"

After obtaining the latest PaddleX source code, you can choose between Wheel package installation mode or plugin installation mode.

  • If you choose Wheel package installation mode, execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n
  • If you choose plugin installation mode and the plugin you need is named PaddleXXX (there can be multiple), execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX plugins\npaddlex --install PaddleXXX\n

For example, if you need to install the PaddleOCR and PaddleClas plugins, execute the following commands to install the plugins:

# Install PaddleOCR and PaddleClas plugins\npaddlex --install PaddleOCR PaddleClas\n

If you need to install all plugins, you do not need to specify the plugin names, just execute the following command:

# Install all PaddleX plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com as a clone source. You can specify the clone source using --platform.

For example, if you need to use gitee.com as the clone source to install all PaddleX plugins, just execute the following command:

# Install PaddleX plugins\npaddlex --install --platform gitee.com\n

After installation, you will see the following prompt:

All packages are installed.\n

For PaddleX installation on more hardware environments, please refer to the PaddleX Multi-hardware Usage Guide

"},{"location":"en/installation/paddlepaddle_install.html","title":"PaddlePaddle Local Installation Tutorial","text":"

When installing PaddlePaddle, you can choose to install it via Docker or pip.

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-docker","title":"Installing PaddlePaddle via Docker","text":"

If you choose to install via Docker, please refer to the following commands to use the official PaddlePaddle Docker image to create a container named paddlex and map the current working directory to the /paddle directory inside the container:

If your Docker version >= 19.03, please use:

# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\nnvidia-docker run --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • Note: For more official PaddlePaddle Docker images, please refer to the PaddlePaddle official website

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-pip","title":"Installing PaddlePaddle via pip","text":"

If you choose to install via pip, please refer to the following commands to install PaddlePaddle in your current environment using pip:

# CPU\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# GPU, this command is only suitable for machines with CUDA version 11.8\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# GPU, this command is only suitable for machines with CUDA version 12.3\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n
Note: For more PaddlePaddle Wheel versions, please refer to the PaddlePaddle official website.

For installing PaddlePaddle on other hardware, please refer to PaddleX Multi-hardware Usage Guide.

After installation, you can verify if PaddlePaddle is successfully installed using the following command:

python -c \"import paddle; print(paddle.__version__)\"\n
If the installation is successful, the following content will be output:

3.0.0-beta2\n

\u2757 Note: If you encounter any issues during the installation process, feel free to submit an issue in the Paddle repository.

"},{"location":"en/module_usage/instructions/benchmark.html","title":"\u6a21\u578b\u200b\u63a8\u7406\u200b Benchmark","text":"

PaddleX \u200b\u652f\u6301\u200b\u7edf\u8ba1\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff0c\u200b\u9700\u200b\u901a\u8fc7\u200b\u73af\u5883\u53d8\u91cf\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

  • PADDLE_PDX_INFER_BENCHMARK\uff1a\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b True \u200b\u65f6\u5219\u200b\u5f00\u542f\u200b Benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_WARMUP\uff1a\u200b\u8bbe\u7f6e\u200b warm up\uff0c\u200b\u5728\u200b\u5f00\u59cb\u200b\u6d4b\u8bd5\u200b\u524d\u200b\uff0c\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u5faa\u73af\u200b\u8fed\u4ee3\u200b n \u200b\u6b21\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 0\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_DATA_SIZE\uff1a \u200b\u8bbe\u7f6e\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u7684\u200b\u5c3a\u5bf8\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 224\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_ITER\uff1a\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b Benchmark \u200b\u6d4b\u8bd5\u200b\u7684\u200b\u5faa\u73af\u200b\u6b21\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u4e3a\u200b None \u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_OUTPUT\uff1a\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u4fdd\u5b58\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b ./benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b None\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4fdd\u5b58\u200b Benchmark \u200b\u6307\u6807\u200b\uff1b

\u200b\u4f7f\u7528\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

PADDLE_PDX_INFER_BENCHMARK=True \\\nPADDLE_PDX_INFER_BENCHMARK_WARMUP=5 \\\nPADDLE_PDX_INFER_BENCHMARK_DATA_SIZE=320 \\\nPADDLE_PDX_INFER_BENCHMARK_ITER=10 \\\nPADDLE_PDX_INFER_BENCHMARK_OUTPUT=./benchmark \\\npython main.py \\\n    -c ./paddlex/configs/object_detection/PicoDet-XS.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=None \\\n    -o Predict.batch_size=2 \\\n    -o Predict.input=None\n

\u200b\u5728\u200b\u5f00\u542f\u200b Benchmark \u200b\u540e\u200b\uff0c\u200b\u5c06\u200b\u81ea\u52a8\u200b\u6253\u5370\u200b benchmark \u200b\u6307\u6807\u200b\uff1a

+----------------+-----------------+-----------------+------------------------+\n|   Component    | Total Time (ms) | Number of Calls | Avg Time Per Call (ms) |\n+----------------+-----------------+-----------------+------------------------+\n|    ReadCmp     |   100.20136833  |        10       |      10.02013683       |\n|     Resize     |   17.05980301   |        20       |       0.85299015       |\n|   Normalize    |   45.44949532   |        20       |       2.27247477       |\n|   ToCHWImage   |    0.03671646   |        20       |       0.00183582       |\n|    Copy2GPU    |   12.28785515   |        10       |       1.22878551       |\n|     Infer      |   76.59482956   |        10       |       7.65948296       |\n|    Copy2CPU    |    0.39863586   |        10       |       0.03986359       |\n| DetPostProcess |    0.43916702   |        20       |       0.02195835       |\n+----------------+-----------------+-----------------+------------------------+\n+-------------+-----------------+---------------------+----------------------------+\n|    Stage    | Total Time (ms) | Number of Instances | Avg Time Per Instance (ms) |\n+-------------+-----------------+---------------------+----------------------------+\n|  PreProcess |   162.74738312  |          20         |         8.13736916         |\n|  Inference  |   89.28132057   |          20         |         4.46406603         |\n| PostProcess |    0.43916702   |          20         |         0.02195835         |\n|   End2End   |    0.27992606   |          20         |         0.01399630         |\n|    WarmUp   |    5.37562728   |          5          |         1.07512546         |\n+-------------+-----------------+---------------------+----------------------------+\n

\u200b\u5728\u200b Benchmark \u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u7edf\u8ba1\u200b\u8be5\u200b\u6a21\u578b\u200b\u5168\u90e8\u200b\u7ec4\u4ef6\u200b\uff08Component\uff09\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001\u200b\u8c03\u7528\u200b\u6b21\u6570\u200b\uff08Number of Calls\uff09\u3001\u200b\u8c03\u7528\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Call\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u4ee5\u53ca\u200b\u6309\u200b\u9884\u70ed\u200b\uff08WarmUp\uff09\u3001\u200b\u9884\u5904\u7406\u200b\uff08PreProcess\uff09\u3001\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\uff08Inference\uff09\u3001\u200b\u540e\u5904\u7406\u200b\uff08PostProcess\uff09\u200b\u548c\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\uff08End2End\uff09\u200b\u8fdb\u884c\u200b\u5212\u5206\u200b\u7684\u200b\u8017\u65f6\u200b\u7edf\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u6bcf\u4e2a\u200b\u9636\u6bb5\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001**\u200b\u6837\u672c\u6570\u200b\uff08Number of Instances\uff09\u200b\u548c\u200b**\u200b\u5355\u200b\u6837\u672c\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Instance\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u540c\u65f6\u200b\uff0c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5230\u200b\u5230\u200b\u672c\u5730\u200b\uff1a ./benchmark/detail.csv \u200b\u548c\u200b ./benchmark/summary.csv\uff1a

Component,Total Time (ms),Number of Calls,Avg Time Per Call (ms)\nReadCmp,100.20136833190918,10,10.020136833190918\nResize,17.059803009033203,20,0.8529901504516602\nNormalize,45.44949531555176,20,2.272474765777588\nToCHWImage,0.036716461181640625,20,0.0018358230590820312\nCopy2GPU,12.28785514831543,10,1.228785514831543\nInfer,76.59482955932617,10,7.659482955932617\nCopy2CPU,0.3986358642578125,10,0.03986358642578125\nDetPostProcess,0.4391670227050781,20,0.021958351135253906\n
Stage,Total Time (ms),Number of Instances,Avg Time Per Instance (ms)\nPreProcess,162.74738311767578,20,8.137369155883789\nInference,89.28132057189941,20,4.464066028594971\nPostProcess,0.4391670227050781,20,0.021958351135253906\nEnd2End,0.279926061630249,20,0.013996303081512451\nWarmUp,5.375627279281616,5,1.0751254558563232\n
"},{"location":"en/module_usage/instructions/config_parameters_common.html","title":"PaddleX Common Model Configuration File Parameter Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_common.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_common.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; Image classification, pedestrian attribute recognition, vehicle attribute recognition, document orientation classification, object detection, pedestrian detection, vehicle detection, face detection, anomaly detection, text detection, seal text detection, text recognition, table recognition, image rectification, and layout area detection do not support data format conversion; Image multi-label classification supports COCO format conversion; Image feature, semantic segmentation, and instance segmentation support LabelMe format conversion; Object detection and small object detection support VOC and LabelMe format conversion; Formula recognition supports PKL format conversion; Time series prediction, time series anomaly detection, and time series classification support xlsx and xls format conversion False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null split.gallery_percent int Sets the percentage of gallery samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and query_percent is 100; This parameter is only used in the image feature module null split.query_percent int Sets the percentage of query samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and gallery_percent is 100; This parameter is only used in the image feature module null"},{"location":"en/module_usage/instructions/config_parameters_common.html#train","title":"Train","text":"Parameter Name Data Type Description Default Value num_classes int Number of classes in the dataset; If you need to train on a private dataset, you need to set this parameter; Image rectification, text detection, seal text detection, text recognition, formula recognition, table recognition, time series prediction, time series anomaly detection, and time series classification do not support this parameter Number of classes specified in the YAML file epochs_iters int Number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Training batch size Training batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file pretrain_weight_path str Pre-trained weight path null warmup_steps int Warm-up steps Warm-up steps specified in the YAML file resume_path str Model resume path after interruption null log_interval int Training log printing interval Training log printing interval specified in the YAML file eval_interval int Model evaluation interval Model evaluation interval specified in the YAML file save_interval int Model saving interval; not supported for anomaly detection, semantic segmentation, image rectification, time series forecasting, time series anomaly detection, and time series classification Model saving interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights log_interval int Evaluation log printing interval Evaluation log printing interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_common.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html","title":"PaddleX Time Series Task Model Configuration File Parameters Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; time series prediction, anomaly detection, and classification support data conversion from xlsx and xls formats False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#train","title":"Train","text":""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#common-parameters-for-time-series-tasks","title":"Common Parameters for Time Series Tasks","text":"Parameter Name Data Type Description Default Value epochs_iters int The number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Batch size Batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file time_col str Time column, set the column name of the time series dataset's time column based on your data. Time column specified in the YAML file freq str or int Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h. Frequency specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-forecasting-parameters","title":"Time Series Forecasting Parameters","text":"Parameter Name Data Type Description Default Value target_cols str Target variable column(s), set the column name(s) of the target variable(s) in the time series dataset, can be multiple, separated by commas OT input_len int For time series forecasting tasks, this parameter represents the length of historical time series input to the model; the input length should be considered in conjunction with the prediction length, generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy. 96 predict_len int The length of the future sequence that you want the model to predict; the prediction length should be considered in conjunction with the actual scenario, generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy. 96 patience int Early stopping mechanism parameter, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; a larger patience value generally results in longer training time. 10"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-anomaly-detection","title":"Time Series Anomaly Detection","text":"Parameter Name Data Type Description Default Value input_len int For time series anomaly detection tasks, this parameter represents the length of the time series input to the model, which will slice the time series according to this length to predict whether there is an anomaly in this segment of the time series; the input length should be considered in conjunction with the actual scenario. For example, an input length of 96 indicates that you want to predict whether there are anomalies in 96 time points. 96 feature_cols str Feature variables indicating variables related to whether the device is abnormal, e.g., whether the device is abnormal may be related to the heat dissipation during its operation. Set the column name(s) of the feature variable(s) based on your data, can be multiple, separated by commas. feature_0,feature_1 label_col str Represents the number indicating whether a time series point is abnormal, with 1 for abnormal points and 0 for normal points. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-classification","title":"Time Series Classification","text":"Parameter Name Data Type Description Default Value target_cols str Feature variable columns used for category discrimination. You need to set the column names of the target variables in the time series dataset based on your own data. It can be multiple, separated by commas. dim_0,dim_1,dim_2 freq str or int Frequency, which needs to be set based on your own data. Examples of time frequencies include: 1min, 5min, 1h. 1 group_id str A group ID represents a time series sample. Time series sequences with the same ID constitute a sample. Set the column name of the specified group ID based on your own data, e.g., group_id. group_id static_cov_cols str Represents the category number column of the time series. The labels of the same sample are the same. Set the column name of the category based on your own data, e.g., label. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/model_python_API.html","title":"PaddleX Single Model Python Usage Instructions","text":"

Before using Python scripts for single model quick inference, please ensure you have completed the installation of PaddleX following the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/instructions/model_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification model as an example, the usage is as follows:

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, just three steps:

  • Call the create_model() method to instantiate the prediction model object;
  • Call the predict() method of the prediction model object to perform inference prediction;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/module_usage/instructions/model_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/module_usage/instructions/model_python_API.html#1-instantiate-the-prediction-model-object-by-calling-the-create_model-method","title":"1. Instantiate the Prediction Model Object by Calling the create_model() Method","text":"
  • create_model: Instantiate the prediction model object;
  • Parameters:
    • model_name: str type, model name or local inference model file path, such as \"PP-LCNet_x1_0\", \"/path/to/PP-LCNet_x1_0_infer/\";
    • device: str type, used to set the model inference device, such as \"cpu\", \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/module_usage/instructions/model_python_API.html#2-perform-inference-prediction-by-calling-the-predict-method-of-the-prediction-model-object","title":"2. Perform Inference Prediction by Calling the predict() Method of the Prediction Model Object","text":"
  • predict: Use the defined prediction model to predict the input data;
  • Parameters:
    • input: Any type, supports str type representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV models, supports numpy.ndarray representing image data; for TS models, supports pandas.DataFrame type data; also supports list types composed of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/module_usage/instructions/model_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/module_usage/instructions/model_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes_1","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html","title":"Unsupervised Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#i-overview","title":"I. Overview","text":"

Unsupervised anomaly detection is a technology that automatically identifies and detects anomalies or rare samples that are significantly different from the majority of data in a dataset, without labels or with a small amount of labeled data. This technology is widely used in many fields such as industrial manufacturing quality control and medical diagnosis.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link ROCAUC\uff08Avg\uff09 Model Size (M) Description STFPMInference Model/Trained Model 0.962 22.5 An unsupervised anomaly detection algorithm based on representation consists of a pre-trained teacher network and a student network with the same structure. The student network detects anomalies by matching its own features with the corresponding features in the teacher network.

The above model accuracy indicators are measured from the MVTec_AD dataset.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the unsupervised anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the unsupervised anomaly detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"STFPM\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"uad_grid.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better unsupervised anomaly detection models. Before using PaddleX to develop unsupervised anomaly detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mvtec_examples.tar -P ./dataset\ntar -xf ./dataset/mvtec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"train_samples\": 264,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"val_samples\": 57,\n    \"num_classes\": 231\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mvtec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 264;
  • attributes.val_samples: The number of validation samples in this dataset is 57;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of STFPM as an example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is STFPM.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's STFPM.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"uad_grid.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is STFPM.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The unsupervised anomaly detection module can be integrated into PaddleX pipelines such as Image_anomaly_detection. Simply replace the model path to update the unsupervised anomaly detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the unsupervised anomaly detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html","title":"Face Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#i-overview","title":"I. Overview","text":"

Face detection is a fundamental task in object detection, aiming to automatically identify and locate the position and size of faces in input images. It serves as the prerequisite and foundation for subsequent tasks such as face recognition and face analysis. Face detection accomplishes this by constructing deep neural network models that learn the feature representations of faces, enabling efficient and accurate face detection.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 An improved model of BlazeFace, incorporating FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face Detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face Detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the face detection module. You can switch models under this module freely, and you can also integrate the model inference of the face detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet_LCNet_x2_5_face\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_detection.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better face detection models. Before using PaddleX to develop face detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerface_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerface_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_849.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_Parade_0_904.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_799.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_384.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_538.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_429.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerface_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1;
  • attributes.train_samples: The number of training samples in this dataset is 500;
  • attributes.val_samples: The number of validation samples in this dataset is 100;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Face detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet_LCNet_x2_5_face as an example:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet_LCNet_x2_5_face.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet_LCNet_x2_5_face.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_detection.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet_LCNet_x2_5_face.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The face detection module can be integrated into PaddleX pipelines such as Face Recognition. Simply replace the model path to update the face detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the face detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html","title":"Face Feature Module Usage Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#i-overview","title":"I. Overview","text":"

Face feature models typically take standardized face images processed through detection, extraction, and keypoint correction as input. These models extract highly discriminative facial features from these images for subsequent modules, such as face matching and verification tasks.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"\ud83d\udc49Details of Model List ModelModel Download Link Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face feature model trained on MobileFaceNet with MS1Mv3 dataset ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face feature model trained on ResNet50 with MS1Mv3 dataset

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Tutorial

After installing the whl package, a few lines of code can complete the inference of the face feature module. You can switch models under this module freely, and you can also integrate the model inference of the face feature module into your project. Before running the following code, please download the example image to your local machine.

from paddlex import create_model\n\nmodel_name = \"MobileFaceNet\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_recognition_001.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n

For more information on using the PaddleX single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better face feature models. Before developing face feature models with PaddleX, ensure you have installed the PaddleX PaddleClas plugin. The installation process can be found in the PaddleX Local Installation Tutorial

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the official demo data. If you wish to use a private dataset for subsequent model training, the training dataset for the face feature module is organized in a general image classification dataset format. You can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial. If you wish to use a private dataset for subsequent model evaluation, note that the validation dataset format for the face feature module differs from the training dataset format. Please refer to Section 4.1.4 Data Organization Face Feature Module

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_rec_examples.tar -P ./dataset\ntar -xf ./dataset/face_rec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_label_file\": \"../../dataset/face_rec_examples/train/label.txt\",\n    \"train_num_classes\": 995,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/01378592.jpg\",\n      \"check_dataset/demo_img/04331410.jpg\",\n      \"check_dataset/demo_img/03485713.jpg\",\n      \"check_dataset/demo_img/02382123.jpg\",\n      \"check_dataset/demo_img/01722397.jpg\",\n      \"check_dataset/demo_img/02682349.jpg\",\n      \"check_dataset/demo_img/00272794.jpg\",\n      \"check_dataset/demo_img/03151987.jpg\",\n      \"check_dataset/demo_img/01725764.jpg\",\n      \"check_dataset/demo_img/02580369.jpg\"\n    ],\n    \"val_label_file\": \"../../dataset/face_rec_examples/val/pair_label.txt\",\n    \"val_num_classes\": 2,\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/Don_Carcieri_0001.jpg\",\n      \"check_dataset/demo_img/Eric_Fehr_0001.jpg\",\n      \"check_dataset/demo_img/Harry_Kalas_0001.jpg\",\n      \"check_dataset/demo_img/Francis_Ford_Coppola_0001.jpg\",\n      \"check_dataset/demo_img/Amer_al-Saadi_0001.jpg\",\n      \"check_dataset/demo_img/Sergei_Ivanov_0001.jpg\",\n      \"check_dataset/demo_img/Erin_Runnion_0003.jpg\",\n      \"check_dataset/demo_img/Bill_Stapleton_0001.jpg\",\n      \"check_dataset/demo_img/Daniel_Bruehl_0001.jpg\",\n      \"check_dataset/demo_img/Clare_Short_0004.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/face_rec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_num_classes: The number of classes in this training dataset is 995;
  • attributes.val_num_classes: The number of classes in this validation dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 1000;
  • attributes.val_samples: The number of validation samples in this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or adding hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

The face feature module does not support data format conversion or dataset splitting.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#414-data-organization-for-face-feature-module","title":"4.1.4 Data Organization for Face Feature Module","text":"

The format of the validation dataset for the face feature module differs from the training dataset. If you need to evaluate model accuracy on private data, please organize your dataset as follows:

face_rec_dataroot      # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 train              # Directory for saving the training dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500label.txt       # Training set annotation file, the file name cannot be changed. Each line gives the relative path of the image to `train` and the face image class (face identity) id, separated by a space. Example content: images/image_06765.jpg 0\n\u251c\u2500\u2500 val                # Directory for saving the validation dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in pair_label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500 pair_label.txt  # Validation dataset annotation file, the file name cannot be changed. Each line gives the paths of two images to be compared and a 0 or 1 label indicating whether the pair of images belong to the same person, separated by spaces.\n

Example content of the validation set annotation file pair_label.txt:

# Face image 1.jpg Face image 2.jpg Label (0 indicates the two face images do not belong to the same person, 1 indicates they do)\nimages/Angela_Merkel_0001.jpg images/Angela_Merkel_0002.jpg 1\nimages/Bruce_Gebhardt_0001.jpg images/Masao_Azuma_0001.jpg 0\nimages/Francis_Ford_Coppola_0001.jpg images/Francis_Ford_Coppola_0002.jpg 1\nimages/Jason_Kidd_0006.jpg images/Jason_Kidd_0008.jpg 1\nimages/Miyako_Miyazaki_0002.jpg images/Munir_Akram_0002.jpg 0\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here is an example of training MobileFaceNet:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file for the model (here it is MobileFaceNet.yaml)
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or by appending parameters in the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • When training other models, specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU). After completing model training, all outputs are saved in the specified output directory (default is ./output/). Typically, the following outputs are included:
  • train_result.json: A file that records the training results, indicating whether the training task was successfully completed, and includes metrics, paths to related files, etc.
  • train.log: A log file that records changes in model metrics, loss variations, and other details during the training process.
  • config.yaml: A configuration file that logs the hyperparameter settings for the current training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Files related to model weights, including network parameters, optimizer, EMA (Exponential Moving Average), static graph network parameters, and static graph network structure.
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/face_detection/MobileFaceNet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `MobileFaceNet.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to [PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand) During model evaluation, the path to the model weights file needs to be specified. Each configuration file has a default weight save path built in. If you need to change it, you can set it by appending a command line parameter, such as `-o Evaluate.weight_path=\"./output/best_model/best_model/model.pdparams\"`. After completing the model evaluation, an `evaluate_result.json` file will be produced, which records the evaluation results. Specifically, it records whether the evaluation task was completed normally and the model's evaluation metrics, including Accuracy. ### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be implemented through two methods: command line and wheel package. #### 4.4.1 Model Inference * To perform inference predictions through the command line, you only need the following command. Before running the following code, please download the [example image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/face_recognition_001.jpg) to your local machine.
python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the path to the model's `.yaml` configuration file (here it is `MobileFaceNet.yaml`) * Specify the mode as model inference prediction: `-o Global.mode=predict` * Specify the path to the model weights: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the path to the input data: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.md). #### 4.4.2 Model Integration The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The face feature module can be integrated into the PaddleX pipeline for [Face Recognition](../../../pipeline_usage/tutorials/face_recognition_pipelines/face_recognition.en.md). You only need to replace the model path to update the face feature module of the relevant pipeline. In pipeline integration, you can use high-performance deployment and service-oriented deployment to deploy the model you obtained. 2. Module Integration The weights you produced can be directly integrated into the face feature module. You can refer to the Python example code in [Quick Integration](#III.-Quick-Integration) and only need to replace the model with the path to the model you trained."},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html","title":"Human Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#i-overview","title":"I. Overview","text":"

Human detection is a subtask of object detection, which utilizes computer vision technology to identify the presence of pedestrians in images or videos and provide the specific location information for each pedestrian. This information is crucial for various applications such as intelligent video surveillance, human behavior analysis, autonomous driving, and intelligent robots.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Human detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The evaluation set for the above accuracy metrics is CrowdHuman dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform human detection with just a few lines of code. You can easily switch between models in this module and integrate the human detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_human\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"human_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better human detection models. Before using PaddleX to develop human detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerperson_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerperson_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000041.jpg\",\n      \"check_dataset/demo_img/000042.jpg\",\n      \"check_dataset/demo_img/000044.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/001138.jpg\",\n      \"check_dataset/demo_img/001140.jpg\",\n      \"check_dataset/demo_img/001141.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerperson_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Human detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE-S_human as an example:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE-S_human.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE-S_human.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer toPaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"human_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-YOLOE-S_human.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the human detection module. You can refer to the Python sample code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html","title":"Image Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#i-overview","title":"I. Overview","text":"

The image classification module is a crucial component in computer vision systems, responsible for categorizing input images. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. Typically, the image classification module receives an image as input and, through deep learning or other machine learning algorithms, classifies it into predefined categories based on its characteristics and content. For instance, in an animal recognition system, the image classification module might need to classify an input image as \"cat,\" \"dog,\" \"horse,\" etc. The classification results from the image classification module are then output for use by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can complete image classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the image classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better image classification models. Before using PaddleX to develop image classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset\ntar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

One command is all you need to complete data validation:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Results Details (Click to Expand)
{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"dataset/label.txt\",\n    \"num_classes\": 102,\n    \"train_samples\": 1020,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/image_01904.jpg\",\n      \"check_dataset/demo_img/image_06940.jpg\"\n    ],\n    \"val_samples\": 1020,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/image_01937.jpg\",\n      \"check_dataset/demo_img/image_06958.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/cls_flowers_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The above validation results, with check_pass being True, indicate that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 102;
  • attributes.train_samples: The number of training set samples in this dataset is 1020;
  • attributes.val_samples: The number of validation set samples in this dataset is 1020;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Image classification does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
  • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which should be an integer between 0-100, ensuring that the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters also support being set through appending command line arguments:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image classification model PP-LCNet_x1_0 as an example:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml. When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. Using PaddleX for model evaluation, a single command can complete the model evaluation:

python main.py -c  paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
Similar to model training, the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path of the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including val.top1, val.top5;

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_classification_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The image classification module can be integrated into the General Image Classification Pipeline of PaddleX. Simply replace the model path to update the image classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

2.Module Integration

The weights you produce can be directly integrated into the image classification module. You can refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html","title":"Image Feature Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#i-overview","title":"I. Overview","text":"

The image feature module is one of the important tasks in computer vision, primarily referring to the automatic extraction of useful features from image data using deep learning methods, to facilitate subsequent image retrieval tasks. The performance of this module directly affects the accuracy and efficiency of the subsequent tasks. In practical applications, image features typically output a set of feature vectors, which can effectively represent the content, structure, texture, and other information of the image, and will be passed as input to the subsequent retrieval module for processing.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_recInference Model/Trained Model 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: object detection, feature extraction, and vector retrieval. These models are part of the feature extraction module and can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_baseInference Model/Trained Model 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_largeInference Model/Trained Model 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are Recall@1 from AliProducts. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the image feature module. You can switch between models under this module freely, and you can also integrate the model inference of the image feature module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-ShiTuV2_rec\")\noutput = model.predict(\"general_image_recognition_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better image feature models. Before developing image feature models with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Feature Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/Inshop_examples.tar -P ./dataset\ntar -xf ./dataset/Inshop_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/05_1_front.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/04_2_side.jpg\",\n      \"check_dataset/demo_img/12_1_front.jpg\",\n      \"check_dataset/demo_img/07_2_side.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/01_1_front.jpg\"\n    ],\n    \"gallery_samples\": 110,\n    \"gallery_sample_paths\": [\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/01_4_full.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/03_4_full.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\",\n      \"check_dataset/demo_img/03_2_side.jpg\"\n    ],\n    \"query_samples\": 125,\n    \"query_sample_paths\": [\n      \"check_dataset/demo_img/08_7_additional.jpg\",\n      \"check_dataset/demo_img/01_7_additional.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/09_7_additional.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/02_7_additional.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/Inshop_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ShiTuRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 1000; * attributes.gallery_samples: The number of gallery (or reference) samples in this dataset is 110; * attributes.query_samples: The number of query samples in this dataset is 125; * attributes.train_sample_paths: A list of relative paths to the visual images of training samples in this dataset; * attributes.gallery_sample_paths: A list of relative paths to the visual images of gallery (or reference) samples in this dataset; * attributes.query_sample_paths: A list of relative paths to the visual images of query samples in this dataset;

Additionally, the dataset verification also analyzes the number of images and image categories within the dataset, and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is null, optional value is LabelMe;

For example, if you want to convert a LabelMe format dataset to ShiTuRecDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, the dataset will be re-split, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, the type is any integer between 0-100, and it needs to ensure that the sum of gallery_percent and query_percent values is 100;

For example, if you want to re-split the dataset with 70% training set, 20% gallery set, and 10% query set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 70\n    gallery_percent: 20\n    query_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=70 \\\n    -o CheckDataset.split.gallery_percent=20 \\\n    -o CheckDataset.split.query_percent=10\n

\u2757Note: Due to the specificity of image feature model evaluation, data partitioning is meaningful only when the train, query, and gallery sets belong to the same category system. During the evaluation of recognition models, it is imperative that the gallery and query sets belong to the same category system, which may or may not be the same as the train set. If the gallery and query sets do not belong to the same category system as the train set, the evaluation after data partitioning becomes meaningless. It is recommended to proceed with caution.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the image feature model PP-ShiTuV2_rec as an example:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

\u2757 Note: The inference result of the recognition model is a set of vectors, which requires a retrieval module to complete image feature.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image feature module can be integrated into the General Image Recognition Pipeline (comming soon) of PaddleX. Simply replace the model path to update the image feature module of the relevant pipeline. In pipeline integration, you can use service-oriented deployment to deploy your trained model.

2.Module Integration

The weights you produce can be directly integrated into the image feature module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html","title":"Image Multi-Label Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#i-overview","title":"I. Overview","text":"

The image multi-label classification module is a crucial component in computer vision systems, responsible for assigning multiple labels to input images. Unlike traditional image classification tasks that assign a single category to an image, multi-label classification tasks require assigning multiple relevant categories to an image. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The image multi-label classification module typically takes an image as input and, through deep learning or other machine learning algorithms, classifies it into multiple predefined categories based on its characteristics and content. For example, an image containing both a cat and a dog might be labeled as both \"cat\" and \"dog\" by the image multi-label classification module. These classification labels are then output for subsequent processing and analysis by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(%) Model Size (M) Description CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 325.6 M CLIP_ML is an image multi-label classification model based on CLIP, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 M PP-HGNetV2_ML is an image multi-label classification model based on PP-HGNetV2, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 M PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 M PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 M PP-LCNet_ML is an image multi-label classification model based on PP-LCNet, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. ResNet50_MLInference Model/Trained Model 83.50 108.9 M ResNet50_ML is an image multi-label classification model based on ResNet50, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder.

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete multi-label classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the multi-label classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_ML\")\noutput = model.predict(\"multilabel_classification_005.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better multi-label classification models. Before using PaddleX to develop multi-label classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Multi-Label Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mlcls_nus_examples.tar -P ./dataset\ntar -xf ./dataset/mlcls_nus_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/mlcls_nus_examples/label.txt\",\n    \"num_classes\": 33,\n    \"train_samples\": 17463,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0543_4338693.jpg\",\n      \"check_dataset/demo_img/0272_347806939.jpg\",\n      \"check_dataset/demo_img/0069_2291994812.jpg\",\n      \"check_dataset/demo_img/0012_1222850604.jpg\",\n      \"check_dataset/demo_img/0238_53773041.jpg\",\n      \"check_dataset/demo_img/0373_541261977.jpg\",\n      \"check_dataset/demo_img/0567_519506868.jpg\",\n      \"check_dataset/demo_img/0023_289621557.jpg\",\n      \"check_dataset/demo_img/0581_484524659.jpg\",\n      \"check_dataset/demo_img/0325_120753036.jpg\"\n    ],\n    \"val_samples\": 17463,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0546_130758157.jpg\",\n      \"check_dataset/demo_img/0284_2230710138.jpg\",\n      \"check_dataset/demo_img/0090_1491261559.jpg\",\n      \"check_dataset/demo_img/0013_392798436.jpg\",\n      \"check_dataset/demo_img/0246_2248376356.jpg\",\n      \"check_dataset/demo_img/0377_1349296474.jpg\",\n      \"check_dataset/demo_img/0570_2457645006.jpg\",\n      \"check_dataset/demo_img/0027_309333946.jpg\",\n      \"check_dataset/demo_img/0584_132639537.jpg\",\n      \"check_dataset/demo_img/0329_206031527.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/mlcls_nus_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 33;
  • attributes.train_samples: The number of training set samples in this dataset is 17463;
  • attributes.val_samples: The number of validation set samples in this dataset is 17463;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)(2) Dataset Splitting","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

The multi-label image classification supports the conversion of COCO format datasets to MLClsDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Multi-label image classification supports converting COCO format datasets to MLClsDataset format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with the optional value of COCO;

For example, if you want to convert a COCO format dataset to MLClsDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: COCO\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image multi-label classification model PP-LCNet_x1_0_ML as an example:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_ML.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"multilabel_classification_005.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image multi-label classification module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the image multi-label classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the image multi-label classification module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html","title":"Instance Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#i-overview","title":"I. Overview","text":"

The instance segmentation module is a crucial component in computer vision systems, responsible for identifying and marking pixels that contain specific object instances in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The instance segmentation module typically outputs pixel-level masks (masks) for each target instance, which are then passed as input to the object recognition module for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the instance segmentation module. You can switch models under this module freely, and you can also integrate the model inference of the instance segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"Mask-RT-DETR-L\")\noutput = model.predict(\"general_instance_segmentation_004.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better instance segmentation models. Before using PaddleX to develop instance segmentation models, please ensure that you have installed the relevant model training plugins for segmentation in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides data verification functionality for each module, and only data that passes the verification can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the officially provided demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_coco_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#412-data-verification","title":"4.1.2 Data Verification","text":"

Data verification can be completed with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 2,\n    \"train_samples\": 79,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/pexels-photo-634007.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-59576.png\"\n    ],\n    \"val_samples\": 19,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/peasant-farmer-farmer-romania-botiza-47862.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-715546.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/instance_seg_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 79;
  • attributes.val_samples: The number of validation samples in this dataset is 19;
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset; Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The instance segmentation task supports converting LabelMe format to COCO format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Below are some example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Set to True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. The available source format is LabelMe; For example, if you want to convert a LabelMe dataset to COCO format, you need to modify the configuration file as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset will be re-split. The default is False;
  • train_percent: If the dataset is to be re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After data splitting, the original annotation files will be renamed as xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete model training. Taking the training of the instance segmentation model Mask-RT-DETR-L as an example:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
The following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is Mask-RT-DETR-L.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify the first 2 GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters Instructions.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is Mask-RT-DETR-L.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_instance_segmentation_004.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's Mask-RT-DETR-L.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX Pipeline or into your own project.

1.Pipeline Integration

The instance segmentation module can be integrated into the General Instance Segmentation Pipeline of PaddleX. Simply replace the model path to update the instance segmentation module of the relevant pipeline.

2.Module Integration The weights you produce can be directly integrated into the instance segmentation module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html","title":"Mainbody detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#i-overview","title":"I. Overview","text":"

Mainbody detection is a fundamental task in object detection, aiming to identify and extract the location and size of specific target objects, people, or entities from images and videos. By constructing deep neural network models, mainbody detection learns the feature representations of image subjects to achieve efficient and accurate detection.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_detInference Model/Trained Model 41.5 62.0 33.7 537.0 27.54 A mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common subjects simultaneously.

Note: The evaluation set for the above accuracy metrics is PaddleClas mainbody detection dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform mainbody detection inference with just a few lines of code. You can easily switch between models under this module, and integrate the mainbody detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-ShiTuV2_det\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better mainbody detection models. Before developing mainbody detection models with PaddleX, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mainbody_det_examples.tar -P ./dataset\ntar -xf ./dataset/mainbody_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mainbody_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 701.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 176.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Mainbody detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-ShiTuV2_det as an example:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-ShiTuV2_det.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-ShiTuV2_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The main body detection module can be integrated into PaddleX pipelines such as General Object Detection (comming soon). Simply replace the model path to update the main body detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the main body detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html","title":"Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#i-overview","title":"I. Overview","text":"

The object detection module is a crucial component in computer vision systems, responsible for locating and marking regions containing specific objects in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The object detection module typically outputs bounding boxes for the target regions, which are then passed as input to the object recognition module for further processing.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before proceeding with quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can perform object detection inference with just a few lines of code. You can easily switch between models within the module and integrate the object detection inference into your projects. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PicoDet-S\")\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher precision from existing models, you can leverage PaddleX's custom development capabilities to develop better object detection models. Before developing object detection models with PaddleX, ensure you have installed the object detection related training plugins. For installation instructions, refer to the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, prepare the corresponding dataset for the task module. PaddleX provides a data validation feature for each module, and only datasets that pass validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Object Detection Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Validate your dataset with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\",\n      \"check_dataset/demo_img/road237.png\",\n      \"check_dataset/demo_img/road733.png\",\n      \"check_dataset/demo_img/road861.png\",\n      \"check_dataset/demo_img/road762.png\",\n      \"check_dataset/demo_img/road515.png\",\n      \"check_dataset/demo_img/road754.png\",\n      \"check_dataset/demo_img/road173.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\",\n      \"check_dataset/demo_img/road544.png\",\n      \"check_dataset/demo_img/road596.png\",\n      \"check_dataset/demo_img/road857.png\",\n      \"check_dataset/demo_img/road203.png\",\n      \"check_dataset/demo_img/road589.png\",\n      \"check_dataset/demo_img/road655.png\",\n      \"check_dataset/demo_img/road245.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 704;
  • attributes.val_samples: The number of validation samples in this dataset is 176;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes in the dataset and generates a histogram (histogram.png) for visualization:

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, dataset splitting is performed. Default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After dataset splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the object detection model PicoDet-S as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The object detection module can be integrated into the General Object Detection Pipeline of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the object detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Pedestrian attribute recognition is a crucial component in computer vision systems, responsible for locating and labeling specific attributes of pedestrians in images or videos, such as gender, age, clothing color, and type. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The pedestrian attribute recognition module typically outputs attribute information for each pedestrian, which is then passed as input to other modules (e.g., pedestrian tracking, pedestrian re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the pedestrian attribute recognition module. You can easily switch models under this module and integrate the model inference of pedestrian attribute recognition into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_pedestrian_attribute\")\noutput = model.predict(\"pedestrian_attribute_006.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

Note: The index of the output value represents the following attributes: index 0 indicates whether a hat is worn, index 1 indicates whether glasses are worn, indexes 2-7 represent the style of the upper garment, indexes 8-13 represent the style of the lower garment, index 14 indicates whether boots are worn, indexes 15-17 represent the type of bag carried, index 18 indicates whether an object is held in front, indexes 19-21 represent age, index 22 represents gender, and indexes 23-25 represent orientation. Specifically, the attributes include the following types:

- Gender: Male, Female\n- Age: Under 18, 18-60, Over 60\n- Orientation: Front, Back, Side\n- Accessories: Glasses, Hat, None\n- Holding Object in Front: Yes, No\n- Bag: Backpack, Shoulder Bag, Handbag\n- Upper Garment Style: Striped, Logo, Plaid, Patchwork\n- Lower Garment Style: Striped, Patterned\n- Short-sleeved Shirt: Yes, No\n- Long-sleeved Shirt: Yes, No\n- Long Coat: Yes, No\n- Pants: Yes, No\n- Shorts: Yes, No\n- Skirt: Yes, No\n- Boots: Yes, No\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better pedestrian attribute recognition models. Before developing pedestrian attribute recognition with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/pedestrian_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/pedestrian_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/pedestrian_attribute_examples/label.txt\",\n    \"num_classes\": 26,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/020907.jpg\",\n      \"check_dataset/demo_img/004274.jpg\",\n      \"check_dataset/demo_img/009412.jpg\",\n      \"check_dataset/demo_img/026873.jpg\",\n      \"check_dataset/demo_img/030560.jpg\",\n      \"check_dataset/demo_img/022846.jpg\",\n      \"check_dataset/demo_img/009055.jpg\",\n      \"check_dataset/demo_img/015399.jpg\",\n      \"check_dataset/demo_img/006435.jpg\",\n      \"check_dataset/demo_img/055307.jpg\"\n    ],\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/080381.jpg\",\n      \"check_dataset/demo_img/080469.jpg\",\n      \"check_dataset/demo_img/080146.jpg\",\n      \"check_dataset/demo_img/080003.jpg\",\n      \"check_dataset/demo_img/080283.jpg\",\n      \"check_dataset/demo_img/080104.jpg\",\n      \"check_dataset/demo_img/080149.jpg\",\n      \"check_dataset/demo_img/080313.jpg\",\n      \"check_dataset/demo_img/080131.jpg\",\n      \"check_dataset/demo_img/080412.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/pedestrian_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 26;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Pedestrian attribute recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command-line arguments:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Taking the training of the PP-LCNet pedestrian attribute recognition model (PP-LCNet_x1_0_pedestrian_attribute) as an example:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"pedestrian_attribute_006.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" . Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The pedestrian attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the pedestrian attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the pedestrian attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html","title":"Semantic Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#i-overview","title":"I. Overview","text":"

Semantic segmentation is a technique in computer vision that classifies each pixel in an image, dividing the image into distinct semantic regions, with each region corresponding to a specific category. This technique generates detailed segmentation maps, clearly revealing objects and their boundaries in the image, providing powerful support for image analysis and understanding.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Semantic Segmentation module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Semantic Segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LiteSeg-T\")\noutput = model.predict(\"general_semantic_segmentation_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Semantic Segmentation models. Before developing a Semantic Segmentation model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Semantic Segmentation Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset\ntar -xf ./dataset/seg_optic_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/P0005.jpg\",\n      \"check_dataset/demo_img/P0050.jpg\"\n    ],\n    \"train_samples\": 267,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/N0139.jpg\",\n      \"check_dataset/demo_img/P0137.jpg\"\n    ],\n    \"val_samples\": 76,\n    \"num_classes\": 2\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/seg_optic_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 267;
  • attributes.val_samples: The number of validation samples in this dataset is 76;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Semantic segmentation supports converting LabelMe format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting LabelMe format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null, and the supported source dataset format is LabelMe;

For example, if you want to convert a LabelMe format dataset, you can download a sample LabelMe format dataset as follows:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n

After downloading, modify the paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the semantic segmentation model (PP-LiteSeg-T) as an example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mIoU.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model\" \\\n    -o Predict.input=\"general_semantic_segmentation_002.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document semantic segmentation module can be integrated into PaddleX pipelines such as the Semantic Segmentation Pipeline (Seg). Simply replace the model path to update the The document semantic segmentation module's model.

  1. Module Integration

The weights you produce can be directly integrated into the semantic segmentation module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html","title":"Small Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#i-overview","title":"I. Overview","text":"

Small object detection typically refers to accurately detecting and locating small-sized target objects in images or videos. These objects often have a small pixel size in images, typically less than 32x32 pixels (as defined by datasets like MS COCO), and may be obscured by the background or other objects, making them difficult to observe directly by the human eye. Small object detection is an important research direction in computer vision, aiming to precisely detect small objects with minimal visual features in images.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description (VisDrone) PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 52.1 57.1 1007.0 324.93 PP-YOLOE_plus small object detection model trained on VisDrone. VisDrone is a benchmark dataset specifically for unmanned aerial vehicle (UAV) visual data, which is used for small object detection due to the small size of the targets and the inherent challenges they pose. PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 42.8 65.5 324.4 77.29 PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 65.9 458.5 11172.7 340.42

Note: The evaluation set for the above accuracy metrics is VisDrone-DET dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete the inference of the small object detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the small object detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE_plus_SOD-S\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"small_object_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better small object detection models. Before using PaddleX to develop small object detection models, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/small_det_examples.tar -P ./dataset\ntar -xf ./dataset/small_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 1610,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/9999938_00000_d_0000352.jpg\",\n      \"check_dataset/demo_img/9999941_00000_d_0000014.jpg\",\n      \"check_dataset/demo_img/9999973_00000_d_0000043.jpg\"\n    ],\n    \"val_samples\": 548,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0000330_00801_d_0000804.jpg\",\n      \"check_dataset/demo_img/0000103_00180_d_0000026.jpg\",\n      \"check_dataset/demo_img/0000291_04001_d_0000888.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/small_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 10.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 1610.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 548.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Small object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Small object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE_plus_SOD-S as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o Train.num_classes=10\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE_plus_SOD-S.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"small_object_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Explanation.
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own projects.

  1. Pipeline Integration

The small object detection module can be integrated into the Small Object Detection Pipeline of PaddleX. Simply replace the model path to update the small object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the small object detection module. You can refer to the Python example code in Quick Integration, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, license plate number, etc. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The vehicle attribute recognition module typically outputs bounding boxes (Bounding Boxes) containing vehicle attribute information, which are then passed as input to other modules (e.g., vehicle tracking, vehicle re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the vehicle attribute recognition module. You can easily switch models under this module, and you can also integrate the model inference of the vehicle attribute recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_vehicle_attribute\")\noutput = model.predict(\"vehicle_attribute_007.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

Note: In the output, values indexed from 0-9 represent color attributes, corresponding to the following colors respectively: yellow, orange, green, gray, red, blue, white, golden, brown, black. Indices 10-18 represent vehicle type attributes, corresponding to the following vehicle types: sedan, suv, van, hatchback, mpv, pickup, bus, truck, estate.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better vehicle attribute recognition models. Before using PaddleX to develop vehicle attribute recognition models, ensure you have installed the classification-related model training plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/vehicle_attribute_examples/label.txt\",\n    \"num_classes\": 19,\n    \"train_samples\": 1200,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0018_c017_00033140_0.jpg\",\n      \"check_dataset/demo_img/0010_c019_00034275_0.jpg\",\n      \"check_dataset/demo_img/0015_c019_00068660_0.jpg\",\n      \"check_dataset/demo_img/0016_c017_00049590_1.jpg\",\n      \"check_dataset/demo_img/0018_c016_00052280_0.jpg\",\n      \"check_dataset/demo_img/0023_c001_00006995_0.jpg\",\n      \"check_dataset/demo_img/0022_c004_00065910_0.jpg\",\n      \"check_dataset/demo_img/0007_c019_00048655_1.jpg\",\n      \"check_dataset/demo_img/0022_c007_00072970_0.jpg\",\n      \"check_dataset/demo_img/0022_c008_00065785_0.jpg\"\n    ],\n    \"val_samples\": 300,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0025_c003_00054095_0.jpg\",\n      \"check_dataset/demo_img/0023_c013_00006350_1.jpg\",\n      \"check_dataset/demo_img/0024_c003_00046320_0.jpg\",\n      \"check_dataset/demo_img/0025_c005_00054795_2.jpg\",\n      \"check_dataset/demo_img/0024_c012_00041770_0.jpg\",\n      \"check_dataset/demo_img/0024_c007_00060845_1.jpg\",\n      \"check_dataset/demo_img/0023_c017_00013150_0.jpg\",\n      \"check_dataset/demo_img/0024_c014_00040410_0.jpg\",\n      \"check_dataset/demo_img/0025_c002_00050685_1.jpg\",\n      \"check_dataset/demo_img/0025_c005_00032645_0.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/vehicle_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 19;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1200;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 300;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle attribute recognition does not support dataset format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Training a model can be done with a single command, taking the training of the PP-LCNet vehicle attribute recognition model (PP-LCNet_x1_0_vehicle_attribute) as an example:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_vehicle_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_attribute_007.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The vehicle attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the vehicle attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the vehicle attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html","title":"Vehicle Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#i-overview","title":"I. Overview","text":"

Vehicle detection is a subtask of object detection, specifically referring to the use of computer vision technology to determine the presence of vehicles in images or videos and provide specific location information for each vehicle (such as the coordinates of the bounding box). This information is of great significance for various fields such as intelligent transportation systems, autonomous driving, and video surveillance.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicle 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicle 63.9 32.6 775.6 196.02 Note: The evaluation set for the above accuracy metrics is PPVehicle dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision. ## III. Quick Integration > \u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the [PaddleX Local Installation Guide](../../../installation/installation.en.md) After installing the wheel package, you can complete the inference of the vehicle detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the vehicle detection module into your project. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_vehicle\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"vehicle_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the [PaddleX Single-Model Python Script Usage Instructions](../../instructions/model_python_API.en.md). ## IV. Custom Development If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better vehicle detection models. Before using PaddleX to develop vehicle detection models, please ensure that you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the [PaddleX Local Installation Guide](../../../installation/installation.en.md). ### 4.1 Data Preparation Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to [PaddleX Object Detection Task Module Data Annotation Tutorial](../../../data_annotations/cv_modules/object_detection.en.md). #### 4.1.1 Demo Data Download You can download the demo dataset to a specified folder using the following commands:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_coco_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_coco_examples.tar -C ./dataset/\n
#### 4.1.2 Data Validation You can complete data validation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message `Check dataset passed !`. The validation result file will be saved in `./output/check_dataset_result.json`, and related outputs will be saved in the `./output/check_dataset` directory of the current directory. The output directory includes visualized example images and histograms of sample distributions. \ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20011__img00001.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00005.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00009.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20032__img00401.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00405.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00409.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/vehicle_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 4.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

#### 4.1.3 Dataset Format Conversion / Dataset Splitting (Optional) After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters. \ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
### 4.2 Model Training Model training can be completed with a single command, taking the training of `PP-YOLOE-S_vehicle` as an example:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
The steps required are: * Specify the `.yaml` configuration file path for the model (here it is `PP-YOLOE-S_vehicle.yaml`,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the [PaddleX Model List (CPU/GPU)](../../../support_list/models_list.en.md)) * Specify the mode as model training: `-o Global.mode=train` * Specify the training dataset path: `-o Global.dataset_dir` Other related parameters can be set by modifying the `Global` and `Train` fields in the `.yaml` configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: `-o Global.device=gpu:0,1`; to set the number of training epochs to 10: `-o Train.epochs_iters=10`. For more modifiable parameters and their detailed explanations, refer to the [PaddleX Common Configuration Parameters for Model Tasks](../../instructions/config_parameters_common.en.md). \ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `PP-YOLOE-S_vehicle.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to[PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package. #### 4.4.1 Model Inference The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The object detection module can be integrated into the [General Object Detection Pipeline](../../../pipeline_usage/tutorials/cv_pipelines/object_detection.en.md) of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model. 2. Module Integration The weights you produced can be directly integrated into the object detection module. You can refer to the Python example code in [Quick Integration](#\u200b\u4e09\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b), simply replace the model with the path to your trained model. * To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_detection.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the `.yaml` configuration file path of the model (here it is `PP-YOLOE-S_vehicle.yaml`) * Set the mode to model inference prediction: `-o Global.mode=predict` * Specify the model weight path: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the input data path: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.en.md). #### 4.4.2 Model Integration The weights you produced can be directly integrated into the vehicle detection module. You can refer to the Python example code in [Quick Integration](#iii-quick-integration), simply replace the model with the path to your trained model."},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html","title":"Document Image Orientation Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#i-overview","title":"I. Overview","text":"

The document image orientation classification module is aim to distinguish the orientation of document images and correct them through post-processing. In processes such as document scanning and ID card photography, capturing devices are sometimes rotated to obtain clearer images, resulting in images with varying orientations. Standard OCR pipelines cannot effectively handle such data. By utilizing image classification technology, we can pre-judge the orientation of document or ID card images containing text regions and adjust their orientations, thereby enhancing the accuracy of OCR processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as IDs and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

Just a few lines of code can complete the inference of the document image orientation classification module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the document image orientation classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_doc_ori\")\noutput = model.predict(\"img_rot180_demo.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/demo.png\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better document image orientation classification models. Before developing a document image orientation classification model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Classification Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/text_image_orientation.tar -P ./dataset\ntar -xf ./dataset/text_image_orientation.tar  -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"..\\/..\\/text_image_orientation\\/label.txt\",\n    \"num_classes\": 4,\n    \"train_samples\": 1553,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_10351.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_3908.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_7712.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_7480.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot270_9599.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_10323.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4885.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_3939.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7153.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1747.jpg\"\n    ],\n    \"val_samples\": 2593,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_3190.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_10272.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_9930.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_918.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_2079.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_8574.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7595.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_1751.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1573.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4401.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/text_image_orientation\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 1552;
  • attributes.val_samples: The number of validation samples in this dataset is 2593;
  • attributes.train_sample_paths: A list of relative paths to visual sample images for the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Document image orientation classification does not currently support dataset format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the document image orientation classification model (PP-LCNet_x1_0_doc_ori) as an example:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

You need to follow these steps:

  • Specify the path to the model's .yaml configuration file (here, PP-LCNet_x1_0_doc_ori.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train.
  • Specify the training dataset path: -o Global.dataset_dir.

Other relevant parameters can be set by modifying fields under Global and Train in the .yaml configuration file, or by appending arguments to the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and detailed explanations, refer to the PaddleX General Model Configuration File Parameters.

\ud83d\udc49 More Information (click to expand)
  • During model training, PaddleX automatically saves the model weight files, defaulting to output. If you want to specify a different save path, you can set it using the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concept of dynamic graph weights and static graph weights. During model training, it produces both dynamic and static graph weights. For model inference, it defaults to using static graph weights.
  • After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which records whether the training task was completed normally, as well as the output weight metrics and related file paths.

  • train.log: Training log file, which records changes in model metrics and loss during training.
  • config.yaml: Training configuration file, which records the hyperparameter configuration for this training.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. With PaddleX, model evaluation can be done with just one command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_doc_ori.yaml).
  • Set the mode to model inference prediction: -o Global.mode=predict.
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/best_model/inference\".
  • Specify the input data path: -o Predict.input=\"...\". Other relevant parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Description.
\ud83d\udc49 More Information (click to expand)
  • When conducting model evaluation, it is necessary to specify the model weight file path. Each configuration file has a built-in default path for saving weights. If you need to change this path, you can simply append a command line argument to set it, for example: -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

  • After the model evaluation is completed, typically, the following outputs are generated:

  • Upon finishing the model evaluation, an evaluate_result.json file is produced, which records the results of the evaluation. Specifically, it logs whether the evaluation task was successfully completed and the evaluation metrics of the model, including Top1 Accuracy (Top1 Acc).

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"img_rot180_demo.jpg\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

1.Pipeline Integration

The document image classification module can be integrated into PaddleX pipelines such as the Document Scene Information Extraction Pipeline (PP-ChatOCRv3). Simply replace the model path to update the The document image classification module's model.

2.Module Integration

The weights you produce can be directly integrated into the document image orientation classification module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html","title":"Formula Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#i-overview","title":"I. Overview","text":"

The formula recognition module is a crucial component of OCR (Optical Character Recognition) systems, responsible for converting mathematical formulas in images into editable text or computer-readable formats. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The module typically outputs LaTeX or MathML codes of mathematical formulas, which are then passed on to the text understanding module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Normed Edit Distance BLEU Score ExpRate (%) Model Size (M) Description LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 89.7 M LaTeX-OCR is a formula recognition algorithm based on an autoregressive large model. By adopting Hybrid ViT as the backbone network and transformer as the decoder, it significantly improves the accuracy of formula recognition.

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, a few lines of code can complete the inference of the formula recognition module. You can switch models under this module freely, and you can also integrate the model inference of the formula recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"LaTeX_OCR_rec\")\noutput = model.predict(\"general_formula_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better formula recognition models. Before developing formula recognition models with PaddleX, ensure you have installed the PaddleOCR-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the LaTeX-OCR Formula Recognition Project.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_latexocr_dataset_example.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_latexocr_dataset_example.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 9452,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0109284.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0217434.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0166758.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0022294.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0071799.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0017043.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0026204.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0209202.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0157332.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0232582.png\"\n    ],\n    \"val_samples\": 1050,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0070221.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0157901.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0085392.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0196480.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0096180.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0136149.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0143310.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0004560.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0115191.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0015323.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_latexocr_dataset_example\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"LaTeXOCRDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 9452; * attributes.val_samples: The number of validation samples in this dataset is 1050; * attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset; * attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format ( PKL format ). The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format, default is True;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is MSTextRecDataset;

For example, if you want to convert a MSTextRecDataset format dataset to LaTeXOCRDataset format, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: MSTextRecDataset\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=MSTextRecDataset\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, dataset splitting is performed, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, which is an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% for the training set and 10% for the validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the formula recognition model LaTeX_OCR_rec as an example:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_formula_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the formula recognition module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html","title":"Layout Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#i-overview","title":"I. Overview","text":"

The core task of structure analysis is to parse and segment the content of input document images. By identifying different elements in the image (such as text, charts, images, etc.), they are classified into predefined categories (e.g., pure text area, title area, table area, image area, list area, etc.), and the position and size of these regions in the document are determined.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the structure analysis module. You can switch models under this module freely, and you can also integrate the model inference of the structure analysis module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet-L_layout_3cls\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"layout.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better structure analysis models. Before developing a structure analysis model with PaddleX, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_layout_examples.tar -P ./dataset\ntar -xf ./dataset/det_layout_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 11,\n    \"train_samples\": 90,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/train_0077.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0028.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0012.jpg\"\n    ],\n    \"val_samples\": 20,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/val_0007.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0019.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0010.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/det_layout_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 11;
  • attributes.train_samples: The number of training samples in this dataset is 90;
  • attributes.val_samples: The number of validation samples in this dataset is 20;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Layout detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet-L_layout_3cls as an example:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet-L_layout_3cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet-L_layout_3cls.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"layout.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet-L_layout_3cls.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own project. To integrate, simply add the model_dir=\"/output/best_model/inference\" parameter to the create_model(model_name=model_name, kernel_option=kernel_option) function in the quick integration method from Step 3.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into PaddleX pipelines or into your own projects.

  1. Pipeline Integration The structure analysis module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the layout area localization module. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  2. Module Integration The weights you produce can be directly integrated into the layout area localization module. You can refer to the Python example code in the Quick Integration section, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html","title":"Seal Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#i-overview","title":"I. Overview","text":"

The seal text detection module typically outputs multi-point bounding boxes around text regions, which are then passed as inputs to the distortion correction and text recognition modules for subsequent processing to identify the textual content of the seal. Recognizing seal text is an integral part of document processing and finds applications in various scenarios such as contract comparison, inventory access auditing, and invoice reimbursement verification. The seal text detection module serves as a subtask within OCR (Optical Character Recognition), responsible for locating and marking the regions containing seal text within an image. The performance of this module directly impacts the accuracy and efficiency of the entire seal text OCR system.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Hmean\uff08%\uff09 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 M The server-side seal text detection model of PP-OCRv4 boasts higher accuracy and is suitable for deployment on better-equipped servers. PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 M The mobile-side seal text detection model of PP-OCRv4, on the other hand, offers greater efficiency and is suitable for deployment on end devices.

Note: The evaluation set for the above accuracy metrics is a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Seal Text Detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Seal Text Detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_server_seal_det\")\noutput = model.predict(\"seal_text_det.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Seal Text Detection models. Before developing a Seal Text Detection model with PaddleX, ensure you have installed PaddleOCR plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Text Detection and Recognition Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_curve_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_curve_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 606,\n    \"train_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07834.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09943.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04079.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05701.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08324.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07451.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09562.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08237.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug01788.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06481.png\"\n    ],\n    \"val_samples\": 152,\n    \"val_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03724.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06456.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04029.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03603.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05454.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06269.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00624.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug02818.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00538.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04935.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/ocr_curve_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 606;
  • attributes.val_samples: The number of validation samples in this dataset is 152;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Seal text detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Seal Text Detection model (PP-OCRv4_server_seal_det) as an example:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including precision, recall and Hmean.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"seal_text_det.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_server_seal_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document Seal Text Detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text detection module of the relevant pipeline.

  1. Module Integration

The weights you produce can be directly integrated into the Seal Text Detection module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html","title":"Table Structure Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#i-overview","title":"I. Overview","text":"

Table structure recognition is a crucial component in table recognition systems, converting non-editable table images into editable table formats (e.g., HTML). The goal of table structure recognition is to identify the rows, columns, and cell positions of tables. The performance of this module directly impacts the accuracy and efficiency of the entire table recognition system. The module typically outputs HTML or LaTeX code for the table area, which is then passed to the table content recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddlePaddle Vision Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddlePaddle's Vision Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the table structure recognition module. You can easily switch models within this module and integrate the model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"SLANet\")\noutput = model.predict(\"table_recognition.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better table structure recognition models. Before developing table structure recognition models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Table Structure Recognition Task Module Data Annotation Tutorial

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/table_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/table_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 2000,\n    \"train_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_right_7384_X9UFEPKVMLALY7DDB11A.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_13708_VE2DGBD4DCQU2ITLBTEA.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_6490_14Z6ZN6G52GG4XA0K4XU.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_14236_DG96EX0EDKIIDK8P6ENG.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_19648_SV8B7X34RTYRAT2T5CPI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_7186_HODBC25HISMCSVKY0HJ9.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_5773_4K4H9OVK9X9YVHE4Y1BQ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_7760_8C62CCH5T57QUGE0NTHZ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_15707_B1YVOU3X4NHHB6TL269O.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_5223_HLG406UK35UD5EUYC2AV.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_2945_L7MSRHBZRW6Y347G39O6.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_4825_LH9WI6X104CP3VFXPSON.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_16837_79KHWU9WDM9ZQHNBGQAL.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_10107_9ENLLC29SQ6XI8WZY53E.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_16668_JIS0YFDZKTKETZIEKCKX.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_18653_J9SSKHLFTRJD4J8W17OW.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_8396_VJ3QJ3I0DP63P4JR77FE.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_9017_K2V7QBWSU2BA4R3AJSO7.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_19494_SDFMWP92NOB2OT7109FI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_288_6LK683JUCMOQ38V5BV29.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/table_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"PubTabTableRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 2000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 100;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Table structure recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the table structure recognition model SLANet as an example:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is SLANet.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc ;

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/table_recognition/SLANet.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"table_recognition.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The table structure recognition module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the table structure recognition module in the relevant pipelines. For pipeline integration, you can deploy your obtained model using high-performance inference and service-oriented deployment.

2.Module Integration

The model weights you produce can be directly integrated into the table structure recognition module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html","title":"Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#i-overview","title":"I. Overview","text":"

The text detection module is a crucial component in OCR (Optical Character Recognition) systems, responsible for locating and marking regions containing text within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text detection module typically outputs bounding boxes for text regions, which are then passed on to the text recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#ii-supported-models","title":"II. Supported Models","text":"ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

Just a few lines of code can complete the inference of the text detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_det\")\noutput = model.predict(\"general_ocr_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek even higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better text detection models. Before developing text detection models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After executing the above command, PaddleX will validate the dataset and gather basic information about it. Once the command runs successfully, Check dataset passed ! will be printed in the log. The validation result file is saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory in the current directory. The output directory includes sample images and histograms of sample distribution.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 200,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/train_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/train_img_289.jpg\"\n    ],\n    \"val_samples\": 50,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/val_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/val_img_137.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. The explanation of other metrics is as follows:

  • attributes.train_samples: The number of training samples in the dataset is 200;
  • attributes.val_samples: The number of validation samples in the dataset is 50;
  • attributes.train_sample_paths: List of relative paths for visualizing training sample images in the dataset;
  • attributes.val_sample_paths: List of relative paths for visualizing validation sample images in the dataset;

Additionally, the dataset validation also analyzed the distribution of the length and width of all images in the dataset and plotted a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Text detection does not support data format conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Below are some example explanations for the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text detection model (PP-OCRv4_mobile_det):

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (in this case, PP-OCRv4_mobile_det.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Instructions.

\ud83d\udc49 More Instructions (Click to Expand)

During model evaluation, you need to specify the path to the model weight file. Each configuration file has a built-in default weight save path. If you need to change it, you can set it by adding a command line argument, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including precision, recall, and hmean.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_mobile_det.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline, Table Recognition Pipeline, and PP-ChatOCRv3-doc. Simply replace the model path to update the text detection module of the relevant pipeline.

2.Module Integration

The model weights you produce can be directly integrated into the text detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html","title":"Text Image Unwarping Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#i-overview","title":"I. Overview","text":"

The primary purpose of Text Image Unwarping is to perform geometric transformations on images in order to correct issues such as document distortion, tilt, perspective deformation, etc., enabling more accurate recognition by subsequent text recognition modules.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link MS-SSIM \uff08%\uff09 Model Size (M) information UVDocInference Model/Trained Model 54.40 30.3 M High-precision Text Image Unwarping Model

The accuracy metrics of the above models are measured on the DocUNet benchmark dataset.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Text Image Unwarping module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Text Image Unwarping module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"UVDoc\")\noutput = model.predict(\"doc_test.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iv-custom-development","title":"IV. Custom Development","text":"

The current module temporarily does not support fine-tuning training and only supports inference integration. Fine-tuning training for this module is planned to be supported in the future.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html","title":"Text Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#i-overview","title":"I. Overview","text":"

The text recognition module is the core component of an OCR (Optical Character Recognition) system, responsible for extracting text information from text regions within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text recognition module typically receives bounding boxes of text regions output by the text detection module as input. Through complex image processing and deep learning algorithms, it converts the text in images into editable and searchable electronic text. The accuracy of text recognition results is crucial for subsequent applications such as information extraction and data mining.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 4 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the text recognition module. You can switch models under this module freely, and you can also integrate the model inference of the text recognition module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_rec\")\noutput = model.predict(\"general_ocr_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better text recognition models. Before using PaddleX to develop text recognition models, please ensure that you have installed the relevant model training plugins for OCR in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX offers Demo datasets for each module, allowing you to complete subsequent development based on the officially provided Demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can use the following commands to download the Demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 4468,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_10.png\"\n    ],\n    \"val_samples\": 2077,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_10.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 4468;
  • attributes.val_samples: The number of validation set samples in this dataset is 2077;
  • attributes.train_sample_paths: A list of relative paths to the visualized training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation set samples in this dataset; Additionally, the dataset validation also analyzes the distribution of character length ratios in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Text recognition does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and it must sum up to 100 with val_percent; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n

After data splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text recognition model (PP-OCRv4_mobile_rec):

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

```bash\npython main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Information (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc\u3001norm_edit_dis\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text recognition module can be integrated into PaddleX pipelines such as the General OCR Pipeline, General Table Recognition Pipeline, and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text recognition module of the relevant pipeline.

2.Module Integration

The weights you produce can be directly integrated into the text recognition module. Refer to the Quick Integration Python example code. Simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#i-overview","title":"I. Overview","text":"

Time series anomaly detection focuses on identifying abnormal points or periods in time series data that do not conform to expected patterns, trends, or periodic regularities. These anomalies can be caused by system failures, external shocks, data entry errors, or rare events, and are of great significance for timely response, risk assessment, and business decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Precision Recall F1-Score Model Size (M) Description AutoEncoder_ad_adInference Model/Trained Model 0.9898 0.9396 0.9641 72.8K AutoEncoder_ad_ad is a simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_adInference Model/Trained Model 0.9855 0.8895 0.9351 1.5MB Based on the transformer structure, optimized for anomaly detection in non-stationary time series AutoEncoder_adInference Model/Trained Model 0.9936 0.8436 0.9125 32K AutoEncoder_ad is a classic autoencoder-based, efficient, and easy-to-use time series anomaly detection model PatchTST_adInference Model/Trained Model 0.9878 0.9070 0.9457 164K PatchTST is a high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_adInference Model/Trained Model 0.9837 0.9480 0.9656 732K Through multi-period analysis, TimesNet is an adaptive and high-precision time series anomaly detection model

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the time series anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the time series anomaly detection module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"AutoEncoder_ad\")\noutput = model.predict(\"ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better time series anomaly detection models. Before developing time series anomaly models with PaddleX, please ensure that the PaddleTS plugin is installed. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to the PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_anomaly_examples.tar -P ./dataset\ntar -xf ./dataset/ts_anomaly_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22032,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        0.0,\n        0.7326893750079723,\n        \"...\",\n        0.1382488479262673,\n        0.0\n      ]\n    ],\n    \"val_samples\": 198290,\n    \"val_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        22032.0,\n        0.8604795809835284,\n        \"...\",\n        0.1428571428571428,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_anomaly_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 22032;
  • attributes.val_samples: The number of validation samples in this dataset is 198290;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset. Note: Only data that has passed validation can be used for training and evaluation.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time series anomaly detection supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, supporting xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, time series anomaly detection only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (AutoEncoder_ad) as an example:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's AutoEncoder_ad.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, the following outputs are typically generated:

Upon completion of model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically indicating whether the evaluation task was completed successfully and the model's evaluation metrics, including f1, recall, and precision.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions through the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_ad.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Anomaly Detection. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series anomaly detection module. Refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html","title":"Time Series Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#i-overview","title":"I. Overview","text":"

Time series classification involves identifying and categorizing different patterns in time series data by analyzing trends, periodicity, seasonality, and other factors that vary over time. This technique is widely used in medical diagnosis and other fields, effectively classifying key information in time series data to provide robust support for decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Acc(%) Model Size (M) Description TimesNet_clsInference Model/Trained Model 87.5 792K TimesNet is an adaptive and high-accuracy time series classification model through multi-period analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform inference for the time series classification module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the time series classification module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better time series classification models. Before using PaddleX to develop time series classification models, ensure you have installed the PaddleTS plugin. Refer to the PaddleX Local Installation Guide for the installation process.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to PaddleX Time Series Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.000949,\n        ...,\n        0.12107,\n        1.0,\n        0.0\n      ]\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.004578,\n        ...,\n        0.15728,\n        1.0,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;

Furthermore, the dataset validation also involved an analysis of the distribution of sample numbers across all categories within the dataset, and a distribution histogram (histogram.png) was generated accordingly.

Note: Only data that has passed validation can be used for training and evaluation.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time-series classification supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, supporting conversion from xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, True to enable, default is False;
  • src_dataset_type: If dataset format conversion is performed, time-series classification only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (TimesNet_cls) as an example:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's TimesNet_cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other relevant parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, an evaluate_result.json file is produced, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including Top-1 Accuracy and F1 score.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_cls.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml - Note: This should likely be TimesNet_cls.yaml for consistency)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other relevant parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipeline or directly into your own projects.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Classification. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series classification module. Refer to the Python example code in Quick Integration (Note: This section header is in Chinese and should be translated or removed for consistency), simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html","title":"Time Series Forecasting Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#i-overview","title":"I. Overview","text":"

Time series forecasting aims to predict the possible values or states at a future point in time or within a future time period by analyzing patterns, trends, periodicity, and other characteristics in historical data. This helps enterprises and organizations make more accurate decisions, optimize resource allocation, reduce risks, and seize potential market opportunities. These time series data typically originate from various sensors, economic activities, social behaviors, and other real-world application scenarios. For example, stock prices, temperature changes, website traffic, sales data, and the like are all typical examples of time series data.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mse mae Model Size (M) Introduce DLinearInference Model/Trained Model 0.382 0.394 76k Simple structure, high efficiency and easy-to-use time series prediction model NonstationaryInference Model/Trained Model 0.600 0.515 60.3M Based on the transformer structure, targeted optimization of long-term time series prediction models for non-stationary time series PatchTSTInference Model/Trained Model 0.385 0.397 2.2M High-precision long-term time series prediction model that takes into account both local patterns and global dependencies TiDEInference Model/Trained Model 0.405 0.412 34.9M High-precision model suitable for handling multivariate, long-term time series prediction problems TimesNetInference Model/Trained Model 0.417 0.431 5.2M Through multi-period analysis, TimesNet is a highly adaptable high-precision time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset, with an input sequence length of 96, and a prediction sequence length of 96 for all models except TiDE, which has a prediction sequence length of 720.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Time Series Forecasting module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Time Series Forecasting module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Time Series Forecasting models. Before developing a Time Series Forecasting model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Time Series Forecasting Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ts_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 12194,\n    \"train_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2016-07-01 00:00:00\",\n        5.827000141143799,\n        2.009000062942505,\n        1.5989999771118164,\n        0.4620000123977661,\n        4.203000068664552,\n        1.3400000333786009,\n        30.5310001373291\n      ],\n      [\n        \"2016-07-01 01:00:00\",\n        5.692999839782715,\n        2.075999975204468,\n        1.4919999837875366,\n        0.4259999990463257,\n        4.142000198364259,\n        1.371000051498413,\n        27.78700065612793\n      ]\n    ],\n    \"val_samples\": 3484,\n    \"val_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2017-11-21 02:00:00\",\n        12.994000434875488,\n        4.889999866485597,\n        10.055999755859377,\n        2.878000020980835,\n        2.559000015258789,\n        1.2489999532699585,\n        4.7129998207092285\n      ],\n      [\n        \"2017-11-21 03:00:00\",\n        11.92199993133545,\n        4.554999828338623,\n        9.097000122070312,\n        3.0920000076293945,\n        2.559000015258789,\n        1.2790000438690186,\n        4.8540000915527335\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_dataset_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Time Series Forecasting supports converting xlsx and xls format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting xlsx and xls format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null.

Modify the paddlex/configs/ts_forecast/DLinear.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (DLinear) as an example:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mse and mae.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_fc.csv\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's DLinear.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The Time Series Forecasting module can be integrated into PaddleX pipelines such as the Time Series Forecasting Pipeline (ts_fc). Simply replace the model path to update the Time Series Forecasting module's model.

  1. Module Integration

The weights you produce can be directly integrated into the Time Series Forecasting module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html","title":"PaddleX Multi-Hardware Usage Guide","text":"

This document focuses on the usage guide of PaddleX for Huawei Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU hardware platforms.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#1-installation","title":"1. Installation","text":""},{"location":"en/other_devices_support/multi_devices_use_guide.html#11-paddlepaddle-installation","title":"1.1 PaddlePaddle Installation","text":"

First, please complete the installation of PaddlePaddle according to your hardware platform. The installation tutorials for each hardware are as follows:

Ascend NPU: Ascend NPU PaddlePaddle Installation Guide

Cambricon MLU: Cambricon MLU PaddlePaddle Installation Guide

Kunlun XPU: Kunlun XPU PaddlePaddle Installation Guide

Hygon DCU: Hygon DCU PaddlePaddle Installation Guide

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#12-paddlex-installation","title":"1.2 PaddleX Installation","text":"

Welcome to use PaddlePaddle's low-code development tool, PaddleX. Before we officially start the local installation, please clarify your development needs and choose the appropriate installation mode based on your requirements.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. The following details the application scenarios and installation methods for these two modes.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#121-wheel-package-installation-mode","title":"1.2.1 Wheel Package Installation Mode","text":"

If your application scenario for PaddleX is model inference and integration, we recommend using the more convenient and lightweight Wheel Package Installation Mode.

After installing PaddlePaddle, you can directly execute the following commands to quickly install the PaddleX Wheel package:

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b1-py3-none-any.whl\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#122-plugin-installation-mode","title":"1.2.2 Plugin Installation Mode","text":"

If your application scenario for PaddleX is secondary development, we recommend using the more powerful Plugin Installation Mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration on the models supported by the plugins but also conduct more advanced operations such as model training for secondary development.

The plugins supported by PaddleX are as follows. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR General Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection Document Scene Information Extraction v3 Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionDocument Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Prediction Time Series Prediction Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS General Multi-label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin(s) you need to install is/are PaddleXXX (can be multiple), after installing PaddlePaddle, you can directly execute the following commands to quickly install the corresponding PaddleX plugin(s):

# obtain PaddleX source code\ngit clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX Plugins\npaddlex --install PaddleXXX\n
For example, if you need to install the PaddleOCR and PaddleClas plugins, you can execute the following command:

# Install PaddleOCR and PaddleClas Plugins\npaddlex --install PaddleOCR PaddleClas\n

If you wish to install all plugins, you do not need to specify the plugin names. Simply execute the following command:

# Install All PaddleX Plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com. You can specify the clone source using --platform.

For instance, if you want to install all PaddleX plugins using the gitee.com clone source, execute the following command:

# Install PaddleX Plugins using gitee.com\npaddlex --install --platform gitee.com\n

Upon successful installation, you will see the following prompt:

All packages are installed.\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#2-usage","title":"2. Usage","text":"

The usage of PaddleX model pipeline development tool on hardware platforms such as Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU is identical to that on GPU. You only need to modify the device configuration parameters according to your hardware platform. For detailed usage tutorials, please refer to PaddleX Pipeline Development Tool Local Usage Guide.

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html","title":"Hygon DCU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Haiguang Z100 series chips. Considering environmental differences, we recommend using the officially released Haiguang DCU development image by PaddlePaddle, which is pre-installed with the Haiguang DCU basic runtime library (DTK).

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. Note that this image is only for development environments and does not include pre-compiled PaddlePaddle installation packages.

docker pull registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-dcu-dev -v `pwd`:/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#2-install-paddlepaddle-package","title":"2. Install PaddlePaddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle's official website. Note: The DCU version of PaddlePaddle framework only supports Hygon C86 architecture.

# Download and install the wheel package\npip install paddlepaddle-rocm -i https://www.paddlepaddle.org.cn/packages/nightly/dcu\n

After the installation package is installed, run the following command to verify it:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is as follows:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html","title":"Cambricon MLU Installation Tutorial for PaddlePaddle","text":"

Currently, PaddleX supports the Cambricon MLU370X8 chip. Considering environmental differences, we recommend using the Cambricon MLU development image provided by PaddlePaddle to prepare your environment.

"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is for development only and does not include a pre-compiled PaddlePaddle installation package.

# Applicable to X86 architecture, Arch64 architecture image is not provided for now\ndocker pull registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-mlu-dev -v $(pwd):/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v /usr/bin/cnmon:/usr/bin/cnmon \\\n  registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle. Currently, Python 3.10 wheel packages are provided. If you require other Python versions, refer to the PaddlePaddle official documentation for compilation and installation instructions.

# Download and install the wheel package\n# Note: You need to install the CPU version of PaddlePaddle first\npython -m pip install paddlepaddle==3.0.0.dev20240624 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython -m pip install paddle-custom-mlu==3.0.0.dev20240806 -i https://www.paddlepaddle.org.cn/packages/nightly/mlu/\n

Verify the installation. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 mlu.\nPaddlePaddle works well on 16 mlus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html","title":"Ascend NPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports the Ascend 910B chip (more models are under support. If you have a related need for other models, please submit an issue to inform us). The Ascend driver version is 23.0.3. Considering the differences in environments, we recommend using the Ascend development image provided by PaddlePaddle to complete the environment preparation.

"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"
  • Pull the image. This image is only for the development environment and does not contain a pre-compiled PaddlePaddle installation package. The image has CANN-8.0.T13, the Ascend operator library, installed by default.
    # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-x86_64-gcc84-py39\n# For Aarch64 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-aarch64-gcc84-py39\n
  • Start the container with the following command. ASCEND_RT_VISIBLE_DEVICES specifies the visible NPU card numbers.
    docker run -it --name paddle-npu-dev -v $(pwd):/work \\\n    --privileged --network=host --shm-size=128G -w=/work \\\n    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \\\n    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\\n    -v /usr/local/dcmi:/usr/local/dcmi \\\n    -e ASCEND_RT_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" \\\n    registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-$(uname -m)-gcc84-py39 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python 3.9 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

  • Download and install the Python 3.9 wheel installation package
    # Note: You need to install the CPU version of PaddlePaddle first\npython3.9 -m pip install paddlepaddle==3.0.0.dev20240520 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython3.9 -m pip install paddle_custom_npu==3.0.0.dev20240719 -i https://www.paddlepaddle.org.cn/packages/nightly/npu/\n
  • After verifying that the installation package is installed, run the following command
    python -c \"import paddle; paddle.utils.run_check()\"\n
    The expected output is as follows
Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 npu.\nPaddlePaddle works well on 8 npus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html","title":"Kunlun XPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Kunlun R200/R300 and other chips. Considering environmental differences, we recommend using the Kunlun XPU development image officially released by PaddlePaddle, which is pre-installed with the Kunlun basic runtime environment library (XRE).

"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is only for the development environment and does not include a pre-compiled PaddlePaddle installation package.

docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # For ARM architecture\n
Refer to the following command to start the container:

docker run -it --name=xxx -m 81920M --memory-swap=81920M \\\n    --shm-size=128G --privileged --net=host \\\n    -v $(pwd):/workspace -w /workspace \\\n    registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python3.10 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

Install the Python3.10 wheel installation package:

pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # For X86 architecture\npip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # For ARM architecture\n

Verify the installation package. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/pipeline_deploy/edge_deploy.html","title":"PaddleX Edge Deployment Demo Usage Guide","text":"
  • PaddleX Edge Deployment Demo Usage Guide
  • Installation Process and Usage
    • Environment Preparation
    • Material Preparation
    • Deployment Steps
  • Reference Materials
  • Feedback Section

This guide mainly introduces the operation method of the PaddleX edge deployment demo on the Android shell. This guide applies to 8 models across 6 modules:

Module Specific Model CPU GPU Object Detection PicoDet-S \u2705 \u2705 PicoDet-L \u2705 \u2705 Layout Area Detection PicoDet_layout_1x \u2705 \u2705 Semantic Segmentation PP-LiteSeg-T \u2705 \u2705 Image Classification PP-LCNet_x1_0 \u2705 \u2705 MobileNetV3_small_x1_0 \u2705 \u2705 Text Detection PP-OCRv4_mobile_det \u2705 Text Recognition PP-OCRv4_mobile_rec \u2705

Note - GPU refers to mapping computations to GPU execution using OpenCL to fully utilize GPU hardware computing power and improve inference performance.

"},{"location":"en/pipeline_deploy/edge_deploy.html#installation-process-and-usage","title":"Installation Process and Usage","text":""},{"location":"en/pipeline_deploy/edge_deploy.html#environment-preparation","title":"Environment Preparation","text":"
  1. Install CMake build tool locally and download the required version of NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK official website.

    Environment Requirements - CMake >= 3.10 (Minimum version not verified, recommend 3.20 and above) - Android NDK >= r17c (Minimum version not verified, recommend r20b and above)

    Tested Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Locate Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install ADB tool on your computer for debugging. ADB installation methods:

    3.1. For Mac:

    brew cask install android-platform-tools\n

    3.2. For Linux:

    # Debian-based Linux distributions\nsudo apt update\nsudo apt install -y wget adb\n\n# Red Hat-based Linux distributions\nsudo yum install adb\n

    3.3. For Windows:

    Install ADB by downloading the ADB software package from Google's Android platform: Link

    Open a terminal, connect your phone to the computer, and enter in the terminal:

     adb devices\n

    If there is an output from the device, it indicates that the installation was successful.

     List of devices attached\n 744be294    device\n
"},{"location":"en/pipeline_deploy/edge_deploy.html#material-preparation","title":"Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified unzip directory, switch to the specified unzip directory, and execute the unzip command.

    • Object Detection Survey
    • Semantic Segmentation Survey
    • Image Classification Survey
    • OCR Survey

    Below is an example of the unzip operation for object_detection. Refer to the table below for other pipelines.

    # 1. Switch to the specified unzip directory\ncd PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection\n\n# 2. Execute the unzip command\nunzip object_detection.zip\n

    Pipeline Name Unzip Directory Unzip Command Object Detection PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection unzip object_detection.zip Semantic Segmentation PaddleX-Lite-Deploy/semantic_segmentation/android/shell/cxx/semantic_segmentation unzip semantic_segmentation.zip Image Classification PaddleX-Lite-Deploy/image_classification/android/shell/cxx/image_classification unzip image_classification.zip OCR PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo unzip ocr.zip

"},{"location":"en/pipeline_deploy/edge_deploy.html#deployment-steps","title":"Deployment Steps","text":"
  1. Switch the working directory to PaddleX_Lite_Deploy/libs and run the download.sh script to download the necessary Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/assets, run the download.sh script to download the paddle_lite_opt tool optimized model, test images, label files, etc.

  3. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the build.sh script to complete the compilation and execution of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the run.sh script to complete the prediction on the edge.

    Note: - {Pipeline_Name} and {Demo_Name} are placeholders. Refer to the table at the end of this section for specific values. - download.sh and run.sh support passing in model names to specify models. If not specified, the default model will be used. Refer to the Model_Name column in the table at the end of this section for currently supported models. - To use your own trained model, refer to the Model Conversion Method to obtain the .nb model, place it in the PaddleX_Lite_Deploy/{Pipeline_Name}/assets/{Model_Name} directory, where {Model_Name} is the model name, e.g., PaddleX_Lite_Deploy/object_detection/assets/PicoDet-L. - Before running the build.sh script, change the path specified by NDK_ROOT to the actual installed NDK path. - Keep ADB connected when running the build.sh script. - On Windows systems, you can use Git Bash to execute the deployment steps. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME to windows in CMakeLists.txt. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME to darwin in CMakeLists.txt.

Below is an example for object_detection. For other demos, change the directories switched in steps 2 and 3 according to the table at the end of this section.

# 1. Download the necessary Paddle Lite prediction library\ncd PaddleX_Lite_Deploy/libs\nsh download.sh\n\n# 2. Download the paddle_lite_opt tool optimized model, test images, and label files\ncd ../object_detection/assets\nsh download.sh\n# Supports passing in model names to specify the downloaded model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh download.sh PicoDet-L\n\n# 3. Complete the compilation of the executable file\ncd ../android/app/shell/cxx/picodet_detection\nsh build.sh\n\n# 4. Prediction\nsh run.sh\n# Supports passing in model names to specify the prediction model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh run.sh PicoDet-L\n

The run results are shown below, and a result image named dog_picodet_detection_result.jpg is generated:

======= benchmark summary =======\ninput_shape(s) (NCHW): {1, 3, 320, 320}\nmodel_dir:./models/PicoDet-S/model.nb\nwarmup:1\nrepeats:10\npower_mode:1\nthread_num:0\n<b>* time info(ms) </b>*\n1st_duration:320.086\nmax_duration:277.331\nmin_duration:272.67\navg_duration:274.91\n\n====== output summary ======\ndetection, image size: 768, 576, detect object: bicycle, score: 0.905929, location: x=125, y=1\n

This section describes the deployment steps applicable to the demos listed in the following table:

Pipeline Pipeline_Name Module Demo_Name Specific Model Model_Name General Object Detection object_detection Object Detection picodet_detection PicoDet-S PicoDet-S\uff08default\uff09PicoDet-S_gpu PicoDet-L PicoDet-LPicoDet-L_gpu PicoDet_layout_1x PicoDet_layout_1xPicoDet_layout_1x_gpu General Semantic Segmentation semantic_segmentation Semantic Segmentation semantic_segmentation PP-LiteSeg-T PP-LiteSeg-T\uff08default\uff09PP-LiteSeg-T_gpu General Image Classification image_classification Image Classification image_classification PP-LCNet_x1_0 PP-LCNet_x1_0\uff08default\uff09PP-LCNet_x1_0_gpu MobileNetV3_small_x1_0 MobileNetV3_small_x1_0MobileNetV3_small_x1_0_gpu General OCR ocr Text Detection ppocr_demo PP-OCRv4_mobile_det PP-OCRv4_mobile_det Text Recognition PP-OCRv4_mobile_rec PP-OCRv4_mobile_rec

Note - Currently, there is no demo for deploying the Layout Area Detection module on the edge, so the picodet_detection demo is reused to deploy the PicoDet_layout_1x model.

"},{"location":"en/pipeline_deploy/edge_deploy.html#reference-materials","title":"Reference Materials","text":"

This guide only introduces the basic installation and usage process of the edge deployment demo. If you want to learn more detailed information, such as code introduction, code explanation, updating models, updating input and output preprocessing, updating prediction libraries, etc., please refer to the following documents:

  • Object Detection
  • Semantic Segmentation
  • Image Classification
  • OCR
"},{"location":"en/pipeline_deploy/edge_deploy.html#feedback-section","title":"Feedback Section","text":"

The edge deployment capabilities are continuously optimized. Welcome to submit issue to report problems and needs, and we will follow up promptly.

"},{"location":"en/pipeline_deploy/high_performance_inference.html","title":"PaddleX High-Performance Inference Guide","text":"

In real-world production environments, many applications have stringent standards for deployment strategy performance metrics, particularly response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins designed to deeply optimize model inference and pre/post-processing, achieving significant speedups in the end-to-end process. This document will first introduce the installation and usage of the high-performance inference plugins, followed by a list of pipelines and models currently supporting the use of these plugins.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#1-installation-and-usage-of-high-performance-inference-plugins","title":"1. Installation and Usage of High-Performance Inference Plugins","text":"

Before using the high-performance inference plugins, ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial, and have successfully run the quick inference of the pipeline using either the PaddleX pipeline command line instructions or the Python script instructions.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#11-installing-high-performance-inference-plugins","title":"1.1 Installing High-Performance Inference Plugins","text":"

Find the corresponding installation command based on your processor architecture, operating system, device type, and Python version in the table below and execute it in your deployment environment. Please replace {paddlex version number} with the actual paddlex version number, such as the current latest stable version 3.0.0b2. If you need to use the version corresponding to the development branch, replace {paddlex version number} with 0.0.0.dev0.

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0(CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • For Linux systems, execute the installation instructions using Bash.
  • When using NVIDIA GPUs, please use the installation instructions corresponding to the CUDA and cuDNN versions that match your environment. Otherwise, you will not be able to use the high-performance inference plugin properly.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/pipeline_deploy/high_performance_inference.html#12-obtaining-serial-numbers-and-activation","title":"1.2 Obtaining Serial Numbers and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Platform page, under the \"Open-source Pipeline Deployment Serial Number Inquiry and Acquisition\" section, select \"Acquire Now\" as shown in the following image:

Select the pipeline you wish to deploy and click \"Acquire\". Afterwards, you can find the acquired serial number in the \"Open-source Pipeline Deployment SDK Serial Number Management\" section at the bottom of the page:

After using the serial number to complete activation, you can utilize high-performance inference plugins. PaddleX provides both online and offline activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and enable online activation to automatically complete the process.
  • Offline Activation: Follow the instructions in the serial number management interface (click \"Offline Activation\" under \"Operations\") to obtain the device fingerprint of your machine. Bind the serial number with the device fingerprint to obtain a certificate and complete the activation. For this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI.

Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

For Linux systems, if using the high-performance inference plugin in a Docker container, please mount the host machine's /dev/disk/by-uuid and ${HOME}/.baidu/paddlex/licenses directories to the container.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate the license online, specify --update_license when using the serial number for the first time. Taking the general image classification pipeline as an example:

paddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number} \\\n    --update_license\n

For PaddleX Python API, enabling the high-performance inference plugin is similar. Still taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"image_classification\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": \"{serial_number}\"},\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\n

The inference results obtained with the high-performance inference plugin enabled are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache the relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent runs to improve initialization speed.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#14-modifying-high-performance-inference-configurations","title":"1.4 Modifying High-Performance Inference Configurations","text":"

PaddleX combines model information and runtime environment information to provide default high-performance inference configurations for each model. These default configurations are carefully prepared to be applicable in several common scenarios and achieve relatively optimal performance. Therefore, users typically may not need to be concerned with the specific details of these configurations. However, due to the diversity of actual deployment environments and requirements, the default configuration may not yield ideal performance in certain scenarios and could even result in inference failures. In cases where the default configuration does not meet the requirements, users can manually adjust the configuration by modifying the Hpi field in the inference.yml file within the model directory (if this field does not exist, it needs to be added). The following are two common situations:

  • Switching inference backends:

    When the default inference backend is not available, the inference backend needs to be switched manually. Users should modify the selected_backends field (if it does not exist, it needs to be added).

    Hpi:\n  ...\n  selected_backends:\n    cpu: paddle_infer\n    gpu: onnx_runtime\n  ...\n

    Each entry should follow the format {device type}: {inference backend name}.

    The currently available inference backends are:

    • paddle_infer: The Paddle Inference engine. Supports CPU and GPU. Compared to the PaddleX quick inference, TensorRT subgraphs can be integrated to enhance inference performance on GPUs.
    • openvino: OpenVINO, a deep learning inference tool provided by Intel, optimized for model inference performance on various Intel hardware. Supports CPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • onnx_runtime: ONNX Runtime, a cross-platform, high-performance inference engine. Supports CPU and GPU. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • tensorrt: TensorRT, a high-performance deep learning inference library provided by NVIDIA, optimized for NVIDIA GPUs to improve speed. Supports GPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
  • Modifying dynamic shape configurations for Paddle Inference or TensorRT:

    Dynamic shape is the ability of TensorRT to defer specifying parts or all of a tensor\u2019s dimensions until runtime. If the default dynamic shape configuration does not meet requirements (e.g., the model may require input shapes beyond the default range), users need to modify the trt_dynamic_shapes or dynamic_shapes field in the inference backend configuration:

    Hpi:\n  ...\n  backend_configs:\n    # Configuration for the Paddle Inference backend\n    paddle_infer:\n      ...\n      trt_dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n    # Configuration for the TensorRT backend\n    tensorrt:\n      ...\n      dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n

    In trt_dynamic_shapes or dynamic_shapes, each input tensor requires a specified dynamic shape in the format: {input tensor name}: [{minimum shape}, [{optimal shape}], [{maximum shape}]]. For details on minimum, optimal, and maximum shapes and further information, please refer to the official TensorRT documentation.

    After completing the modifications, please delete the cache files in the model directory (shape_range_info.pbtxt and files starting with trt_serialized).

"},{"location":"en/pipeline_deploy/high_performance_inference.html#2-pipelines-and-models-supporting-high-performance-inference-plugins","title":"2. Pipelines and Models Supporting High-Performance Inference Plugins","text":"Pipeline Pipeline Module Specific Models General Image Classification Image Classification ResNet18ResNet34 moreResNet50ResNet101ResNet152ResNet18_vdResNet34_vdResNet50_vdResNet101_vdResNet152_vdResNet200_vdPP-LCNet_x0_25PP-LCNet_x0_35PP-LCNet_x0_5PP-LCNet_x0_75PP-LCNet_x1_0PP-LCNet_x1_5PP-LCNet_x2_0PP-LCNet_x2_5PP-LCNetV2_smallPP-LCNetV2_basePP-LCNetV2_largeMobileNetV3_large_x0_35MobileNetV3_large_x0_5MobileNetV3_large_x0_75MobileNetV3_large_x1_0MobileNetV3_large_x1_25MobileNetV3_small_x0_35MobileNetV3_small_x0_5MobileNetV3_small_x0_75MobileNetV3_small_x1_0MobileNetV3_small_x1_25ConvNeXt_tinyConvNeXt_smallConvNeXt_base_224ConvNeXt_base_384ConvNeXt_large_224ConvNeXt_large_384MobileNetV1_x0_25MobileNetV1_x0_5MobileNetV1_x0_75MobileNetV1_x1_0MobileNetV2_x0_25MobileNetV2_x0_5MobileNetV2_x1_0MobileNetV2_x1_5MobileNetV2_x2_0SwinTransformer_tiny_patch4_window7_224SwinTransformer_small_patch4_window7_224SwinTransformer_base_patch4_window7_224SwinTransformer_base_patch4_window12_384SwinTransformer_large_patch4_window7_224SwinTransformer_large_patch4_window12_384PP-HGNet_smallPP-HGNet_tinyPP-HGNet_basePP-HGNetV2-B0PP-HGNetV2-B1PP-HGNetV2-B2PP-HGNetV2-B3PP-HGNetV2-B4PP-HGNetV2-B5PP-HGNetV2-B6CLIP_vit_base_patch16_224CLIP_vit_large_patch14_224 General Object Detection Object Detection PP-YOLOE_plus-SPP-YOLOE_plus-M morePP-YOLOE_plus-LPP-YOLOE_plus-XYOLOX-NYOLOX-TYOLOX-SYOLOX-MYOLOX-LYOLOX-XYOLOv3-DarkNet53YOLOv3-ResNet50_vd_DCNYOLOv3-MobileNetV3RT-DETR-R18RT-DETR-R50RT-DETR-LRT-DETR-HRT-DETR-XPicoDet-SPicoDet-L General Semantic Segmentation Semantic Segmentation Deeplabv3-R50Deeplabv3-R101 moreDeeplabv3_Plus-R50Deeplabv3_Plus-R101PP-LiteSeg-TOCRNet_HRNet-W48OCRNet_HRNet-W18SeaFormer_tinySeaFormer_smallSeaFormer_baseSeaFormer_largeSegFormer-B0SegFormer-B1SegFormer-B2SegFormer-B3SegFormer-B4SegFormer-B5 General Instance Segmentation Instance Segmentation Mask-RT-DETR-LMask-RT-DETR-H Seal Text Recognition Layout Analysis PicoDet-S_layout_3clsPicoDet-S_layout_17cls morePicoDet-L_layout_3clsPicoDet-L_layout_17clsRT-DETR-H_layout_3clsRT-DETR-H_layout_17cls Seal Text Detection PP-OCRv4_server_seal_detPP-OCRv4_mobile_seal_det Text Recognition PP-OCRv4_mobile_recPP-OCRv4_server_rec General OCR Text Detection PP-OCRv4_server_detPP-OCRv4_mobile_det Text Recognition PP-OCRv4_server_recPP-OCRv4_mobile_recch_RepSVTR_recch_SVTRv2_rec General Table Recognition Layout Detection PicoDet_layout_1x Table Recognition SLANet SLANet_plus Text Detection PP-OCRv4_server_detPP-OCRv4_mobile_det Text Recognition PP-OCRv4_server_recPP-OCRv4_mobile_recch_RepSVTR_recch_SVTRv2_rec Document Scene Information Extraction v3 Table Recognition SLANet SLANet_plus Layout Detection PicoDet_layout_1x Text Detection PP-OCRv4_server_det PP-OCRv4_mobile_det Text Recognition PP-OCRv4_server_rec PP-OCRv4_mobile_rec ch_RepSVTR_rec ch_SVTRv2_rec Seal Text Detection PP-OCRv4_server_seal_det PP-OCRv4_mobile_seal_det Text Image Rectification UVDoc Document Image Orientation Classification PP-LCNet_x1_0_doc_ori"},{"location":"en/pipeline_deploy/service_deploy.html","title":"PaddleX Serving Deployment Guide","text":"

Serving deployment is a common form of deployment in real-world production environments. By encapsulating inference capabilities as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost serving deployment for production lines. This document will first introduce the basic process of serving deployment using PaddleX, followed by considerations and potential operations when using the service in a production environment.

Note - Serving deployment provides services for model pipelines, not specific to individual pipeline modules.

Serving Deployment Example Diagram:

"},{"location":"en/pipeline_deploy/service_deploy.html#1-basic-process","title":"1. Basic Process","text":""},{"location":"en/pipeline_deploy/service_deploy.html#11-install-the-serving-deployment-plugin","title":"1.1 Install the Serving Deployment Plugin","text":"

Execute the following command to install the serving deployment plugin:

paddlex --install serving\n
"},{"location":"en/pipeline_deploy/service_deploy.html#12-start-the-service","title":"1.2 Start the Service","text":"

Start the service through the PaddleX CLI with the following command format:

paddlex --serve --pipeline {pipeline_name_or_path} [{other_command_line_options}]\n

Taking the General Image Classification Pipeline as an example:

paddlex --serve --pipeline image_classification\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or the path to a local pipeline configuration file. PaddleX uses this to build the pipeline and deploy it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General Image Classification Pipeline Tutorial.

Command-line options related to serving deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Defaults to cpu (If GPU is unavailable) or gpu (If GPU is available). --host Hostname or IP address bound to the server. Defaults to 0.0.0.0. --port Port number listened to by the server. Defaults to 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Activates the license online if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/pipeline_deploy/service_deploy.html#13-call-the-service","title":"1.3 Call the Service","text":"

Please refer to the \"Development Integration/Deployment\" section in the usage tutorials for each pipeline. You can find the pipeline tutorials here.

"},{"location":"en/pipeline_deploy/service_deploy.html#2-deploy-services-for-production","title":"2. Deploy Services for Production","text":"

When deploying services into production environments, the stability, efficiency, and security of the services are of paramount importance. Below are some recommendations for deploying services into production.

"},{"location":"en/pipeline_deploy/service_deploy.html#21-utilize-paddlex-high-performance-inference-plugin","title":"2.1 Utilize PaddleX high-performance inference Plugin","text":"

In scenarios where strict response time requirements are imposed on applications, the PaddleX high-performance inference Plugin can be used to accelerate model inference and pre/post-processing, thereby reducing response time and increasing throughput.

To use the PaddleX high-performance inference Plugin, please refer to the PaddleX High-Performance Inference Guide for installing the high-performance inference plugin, obtaining serial numbers, and activating the plugin. Additionally, not all pipelines, models, and environments support the use of the high-performance inference plugin. For detailed support information, please refer to the section on pipelines and models that support the high-performance inference plugin.

When starting the PaddleX pipeline service, you can specify --use_hpip along with the serial number to use the high-performance inference plugin. If you wish to perform online activation, you should also specify --update_license. Example usage:

paddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number} --update_license\n
"},{"location":"en/pipeline_deploy/service_deploy.html#22-consider-security","title":"2.2 Consider Security","text":"

A typical scenario involves an application accepting inputs from the network, with the PaddleX pipeline service acting as a module within the application, interacting with other modules through APIs. In this case, the position of the PaddleX pipeline service within the application is crucial. The service-oriented deployment solution provided by PaddleX focuses on efficiency and ease of use but does not perform sufficient security checks on request bodies. Malicious requests from the network, such as excessively large images or carefully crafted data, can lead to severe consequences like service crashes. Therefore, it is recommended to place the PaddleX pipeline service within the application's internal network, avoiding direct processing of external inputs, and ensuring it only processes trustworthy requests. Appropriate protective measures, such as input validation and authentication, should be added at the application's outer layer.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html","title":"Overview of PaddleX Model Pipeline Usage","text":"

If you have already experienced the pre-trained model pipeline effects in PaddleX and wish to proceed directly with model fine-tuning, you can jump to Model Selection.

The complete PaddleX model pipeline development process is illustrated in the following diagram:

PaddleX Model Pipeline Development Flowchart

graph LR\n    select_pipeline(Select Pipeline) --> online_experience[Quick Experience]\n    online_experience --> online_ok{Satisfied with Results?}\n    online_ok --No--> select_model[Select Model]\n    select_model --> model_finetune[Model Fine-tuning]\n    online_ok --Yes--> development_integration(Development Integration/Deployment)\n    model_finetune --> pipeline_test[Pipeline Testing]\n    pipeline_test --> test_ok{Satisfied with Results?}\n    test_ok --No--> select_model\n    test_ok --Yes--> development_integration

The pre-trained model pipelines provided by PaddleX allow for quick experience of effects. If the pipeline effects meet your requirements, you can directly proceed with development integration/deployment of the pre-trained model pipeline. If the effects are not as expected, you can use your private data to fine-tune the models within the pipeline until satisfactory results are achieved.

Below, let's take the task of boarding pass recognition as an example to introduce the local usage process of the PaddleX model pipeline tool. Before use, please ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#1-select-pipeline","title":"1. Select Pipeline","text":"

Each pipeline in PaddleX can solve specific task scenarios such as object detection, time series prediction, semantic segmentation, etc. You need to select the pipeline for subsequent development based on the specific task. For example, for the boarding pass recognition task, the corresponding PaddleX pipeline is the General OCR Pipeline. More task-pipeline correspondences can be found in the PaddleX Models List (CPU/GPU).

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#2-quick-start","title":"2. Quick Start","text":"

Each pipeline in PaddleX integrates numerous pre-trained models. You can first experience the effects of the PaddleX pre-trained model pipeline. If the effects of the pre-trained model pipeline meet your expectations, you can proceed directly with Development Integration/Deployment. If not, optimize the pipeline effects according to the subsequent steps.

PaddleX provides three ways to quickly experience pipeline effects. You can choose the appropriate method based on your needs:

  • Online Quick Experience URL: PaddleX Pipeline List (CPU/GPU)
  • Command Line Quick Experience: PaddleX Pipeline Command Line Usage Instructions
  • Python Script Quick Experience: PaddleX Pipeline Python API Usage Instructions

To demonstrate the OCR pipeline for the boarding pass recognition task, you can quickly experience the pipeline's effect in three ways:

\ud83c\udf10 Online Experience

You can experience the effects of the universal OCR pipeline in AI Studio online. Use the official demo image provided for recognition, for example:

\ud83d\udcbb Command Line Experience

A single command can quickly experience the pipeline effects. Use the test file, and replace --input with a local path for prediction:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter description:

--pipeline: Pipeline name, which is the OCR pipeline in this case.\n--input: Local path or URL of the input image to be processed.\n--device: GPU serial number used (for example, gpu:0 means using the 0th GPU, gpu:1,2 means using the 1st and 2nd GPUs), or you can choose to use CPU (--device cpu).\n
\ud83d\udc49Click to view the running results

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [array([[ 6, 13],\n       [64, 13],\n       [64, 31],\n       [ 6, 31]], dtype=int16), array([[210,  14],\n       [238,  14],\n       ...\n       [830, 445],\n       [830, 464],\n       [338, 473]], dtype=int16)], 'dt_scores': [0.7629529090100092, 0.7717284653547034, 0.7139251666762622, 0.8057611181556994, 0.8840947658872964, 0.793295938183885, 0.8342027855884783, 0.8081378522874861, 0.8436969344212185, 0.8500845646497226, 0.7932189714842249, 0.8875924621248228, 0.8827884273639948, 0.8322404317386042, 0.8614796803023563, 0.8804252994596097, 0.9069978945305474, 0.8383917914190059, 0.8495824076580516, 0.8825556800041383, 0.852788927706737, 0.8379584696974435, 0.8633519228646618, 0.763234473595298, 0.8602154244410916, 0.9206341882426813, 0.6341425973804049, 0.8490156149797171, 0.758314821564747, 0.8757849788793592, 0.772485060565334, 0.8404023012596349, 0.8190037953773427, 0.851908529295617, 0.6126112758079643, 0.7324388418218587], 'rec_text': ['www.9', '5', 'boarding pass', 'BOARDING', 'PASS', 'cabin class', '', 'CLASS', 'SERIAL NO', 'seat number', 'SEAT NO', 'flight FLIGHT', 'date DATE', '03DEC', 'W', '035', 'MU 2379', 'departure city', 'FROM', 'boarding gate', 'GATE', 'boarding time BDT', 'destination TO', 'Fuzhou', 'Taiyuan', 'G11', 'FUZHOU', 'ID NO', 'NAME', 'ZHANGQIWEI', 'ticket number TKTNO', 'Zhang Qiwei', 'fare FARE', 'ETKT7813699238489/1', 'The boarding gate closes 10 minutes before departure', 'GATES CLOSE 10 MINUTES BEFORE DEPARTURE TIME'], 'rec_score': [0.683099627494812, 0.23417049646377563, 0.9969978928565979, 0.9945957660675049, 0.9787729382514954, 0.9983421564102173, 0.0, 0.9896272420883179, 0.9927973747253418, 0.9976049065589905, 0.9330753684043884, 0.9562691450119019, 0.9312669038772583, 0.9749765396118164, 0.9749416708946228, 0.9988260865211487, 0.9319792985916138, 0.9979889988899231, 0.9956836700439453, 0.9991750717163086, 0.9938803315162659, 0.9982991218566895, 0.9701204299926758, 0.9986245632171631, 0.9888408780097961, 0.9793729782104492, 0.9952947497367859, 0.9945247173309326, 0.9919753670692444, 0.991995632648468, 0.9937331080436707, 0.9963390827178955, 0.9954304695129395, 0.9934715628623962, 0.9974429607391357, 0.9529641270637512]}\n

The visualization result is as follows:

When executing the above command, the default OCR pipeline configuration file is loaded. If you need a custom configuration file, you can follow the steps below:

\ud83d\udc49Click to expand

Get the OCR pipeline configuration file:

paddlex --get_pipeline_config OCR\n

After execution, the OCR pipeline configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ocr.yaml, just execute:

paddlex --pipeline ./ocr.yaml --input general_ocr_002.png\n

Parameters such as --model, --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will prevail.

\ud83d\udcbb Python Script Experience

A few lines of code can quickly experience the pipeline effects:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

The following steps are executed:

  • create_pipeline() instantiates the pipeline object
  • Passes the image and calls the predict method of the pipeline object for inference prediction
  • Processes the prediction results

\u2757 The results obtained from running the Python script are the same as those from the command line method.

If the pre-trained model pipeline meets your expectations, you can proceed directly to development integration/deployment. If not, optimize the pipeline effects according to the following steps.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#3-model-selection-optional","title":"3. Model Selection (Optional)","text":"

Since a pipeline may contain one or more models, when fine-tuning models, you need to determine which model to fine-tune based on testing results. Taking the OCR pipeline for boarding pass recognition as an example, this pipeline includes a text detection model (e.g., PP-OCRv4_mobile_det) and a text recognition model (e.g., PP-OCRv4_mobile_rec). If the text positioning is inaccurate, you need to fine-tune the text detection model. If the text recognition is inaccurate, you need to fine-tune the text recognition model. If you are unsure which models are included in the pipeline, you can refer to the PaddleX Models List (CPU/GPU)

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#4-model-fine-tuning-optional","title":"4. Model Fine-tuning (Optional)","text":"

After determining the model to fine-tune, you need to train the model with your private dataset. PaddleX provides a single-model development tool that can complete model training with a single command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=your/dataset_dir\n
In addition, PaddleX provides detailed tutorials for preparing private datasets for model fine-tuning, single-model inference, and more. For details, please refer to the PaddleX Modules Tutorials

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#5-pipeline-testing-optional","title":"5. Pipeline Testing (Optional)","text":"

After fine-tuning your model with a private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n
Then, refer to the command line method or Python script method to load the modified pipeline configuration file.

If the results are satisfactory, proceed with Development Integration/Deployment. If not, return to Model Selection to continue fine-tuning other task modules until you achieve satisfactory results.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#6-development-integration-and-deployment","title":"6. Development Integration and Deployment","text":"

If the pre-trained pipeline meets your requirements for inference speed and accuracy, you can proceed directly to development integration/deployment.

If you need to apply the pipeline directly in your Python project, you can refer to the PaddleX Pipeline Python Script Usage Guide and the Python example code in the Quick Start section.

In addition, PaddleX also provides three other deployment methods, with detailed instructions as follows:

\ud83d\ude80 high-performance inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

\u2757 PaddleX provides detailed usage instructions for each pipeline. You can choose according to your needs. Here are all the pipelines and their corresponding detailed instructions:

Pipeline Name Detailed Description PP-ChatOCR-doc v3 PP-ChatOCR-doc v3 Pipeline Usage Tutorial Image Classification Image Classification Pipeline Usage Tutorial Object Detection Object Detection Pipeline Usage Tutorial Instance Segmentation Instance Segmentation Pipeline Usage Tutorial Semantic Segmentation Semantic Segmentation Pipeline Usage Tutorial Image Multi-label Classification Image Multi-label Classification Pipeline Usage Tutorial Small Object Detection Small Object Detection Pipeline Usage Tutorial Image Anomaly Detection Image Anomaly Detection Pipeline Usage Tutorial OCR OCR Pipeline Usage Tutorial Table Recognition Table Recognition Pipeline Usage Tutorial Layout Parsing Layout Parsing Pipeline Usage Tutorial Formula Recognition Formula Recognition Pipeline Usage Tutorial Seal Recognition Seal Recognition Pipeline Usage Tutorial Time Series Forecasting Time Series Forecasting Pipeline Usage Tutorial Time Series Anomaly Detection Time Series Anomaly Detection Pipeline Usage Tutorial Time Series Classification Time Series Classification Pipeline Usage Tutorial"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html","title":"PaddleX Pipeline CLI Usage Instructions","text":"

Before using the CLI command line for rapid inference of the pipeline, please ensure that you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#i-usage-example","title":"I. Usage Example","text":""},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#1-quick-experience","title":"1. Quick Experience","text":"

Taking the image classification pipeline as an example, the usage is as follows:

paddlex --pipeline image_classification \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --device gpu:0 \\\n        --save_path ./output/\n
This single step completes the inference prediction and saves the prediction results. Explanations for the relevant parameters are as follows:

  • pipeline: The name of the pipeline or the local path to the pipeline configuration file, such as the pipeline name \"image_classification\", or the path to the pipeline configuration file \"path/to/image_classification.yaml\";
  • input: The path to the data file to be predicted, supporting local file paths, local directories containing data files to be predicted, and file URL links;
  • device: Used to set the model inference device. If set for GPU, you can specify the card number, such as \"cpu\", \"gpu:2\". When not specified, if GPU is available, it will be used; otherwise, CPU will be used;
  • save_path: The save path for prediction results. When not specified, the prediction results will not be saved;
"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#2-custom-pipeline-configuration","title":"2. Custom Pipeline Configuration","text":"

If you need to modify the pipeline configuration, you can retrieve the configuration file and modify it. Still taking the image classification pipeline as an example, the way to retrieve the configuration file is as follows:

paddlex --get_pipeline_config image_classification\n\n# Please enter the path that you want to save the pipeline config file: (default `./`)\n./configs/\n\n# The pipeline config has been saved to: configs/image_classification.yaml\n

After modifying the production line configuration file configs/image_classification.yaml, such as the content for the image classification configuration file:

Global:\n  pipeline_name: image_classification\n  input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\n\nPipeline:\n  model: PP-LCNet_x0_5\n  batch_size: 1\n  device: \"gpu:0\"\n

Once the modification is completed, you can use this configuration file to perform model pipeline inference prediction as follows:

paddlex --pipeline configs/image_classification.yaml \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --save_path ./output/\n\n# {'input_path': '/root/.paddlex/predict_input/general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': array([0.62817, 0.03729, 0.03262, 0.03247, 0.03196]), 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html","title":"PaddleX Model Pipeline Python Usage Instructions","text":"

Before using Python scripts for rapid inference on model pipelines, please ensure you have installed PaddleX following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification pipeline as an example, the usage is as follows:

from paddlex import create_pipeline\npipeline = create_pipeline(\"image_classification\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, there are only three steps:

  • Call the create_pipeline() method to instantiate the prediction model pipeline object;
  • Call the predict() method of the prediction model pipeline object for inference;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#1-instantiate-the-prediction-model-pipeline-object-by-calling-create_pipeline","title":"1. Instantiate the Prediction Model Pipeline Object by Calling create_pipeline()","text":"
  • create_pipeline: Instantiates the prediction model pipeline object;
  • Parameters:
    • pipeline_name: str type, the pipeline name or the local pipeline configuration file path, such as \"image_classification\", \"/path/to/image_classification.yaml\";
    • device: str type, used to set the model inference device, such as \"cpu\" or \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#2-perform-inference-by-calling-the-predict-method-of-the-prediction-model-pipeline-object","title":"2. Perform Inference by Calling the predict() Method of the Prediction Model Pipeline Object","text":"
  • predict: Uses the defined prediction model pipeline to predict input data;
  • Parameters:
    • input: Any type, supporting str representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV tasks, supports numpy.ndarray representing image data; for TS tasks, supports pandas.DataFrame type data; also supports lists of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results of the model pipeline support access, visualization, and saving, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes","title":"Attributes:","text":"
  • str: str type representation of the prediction result;
  • Return Value: str type, string representation of the prediction result;
  • json: Prediction result in JSON format;
  • Return Value: dict type;
  • img: Visualization image of the prediction result;
  • Return Value: PIL.Image type;
  • html: HTML representation of the prediction result;
  • Return Value: str type;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results_1","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_1","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_2","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html","title":"Face Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#1-introduction-to-the-face-recognition-pipeline","title":"1. Introduction to the Face Recognition Pipeline","text":"

Face recognition is a crucial component in the field of computer vision, aiming to automatically identify individuals by analyzing and comparing facial features. This task involves not only detecting faces in images but also extracting and matching facial features to find corresponding identity information in a database. Face recognition is widely used in security authentication, surveillance systems, social media, smart devices, and other scenarios.

The face recognition pipeline is an end-to-end system dedicated to solving face detection and recognition tasks. It can quickly and accurately locate face regions in images, extract facial features, and retrieve and compare them with pre-established features in a feature database to confirm identity information.

The face recognition pipeline includes a face detection module and a face feature module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model size, choose models with smaller storage requirements.

Face Detection Module:

ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 Improved BlazeFace with FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640x640. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Face Recognition Module:

ModelModel Download Link Output Feature Dimension AP (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face recognition model trained on MS1Mv3 based on MobileFaceNet ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face recognition model trained on MS1Mv3 based on ResNet50

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can experience the effects of the face recognition pipeline online or locally using command-line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Oneline Experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the facial recognition pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Command line experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

Please download the test image for testing. In the example of running this pipeline, you need to pre-build a facial feature library. You can refer to the following instructions to download the official demo data to be used for subsequent construction of the facial feature library. You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_demo_gallery.tar\ntar -xf ./face_demo_gallery.tar\n

If you wish to build a facial feature library using a private dataset, please refer to Section 2.3: Data Organization for Building a Feature Library. Afterward, you can complete the establishment of the facial feature library and quickly perform inference with the facial recognition pipeline using just a few lines of code.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a face recognition pipeline object. The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the build_index method of the face recognition pipeline object to build the facial feature library. The specific parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset, with data organization referring to Section 2.3: Data Organization for Building a Feature Library str None index_dir The save path for the feature library. After successfully calling the build_index method, two files will be generated in this path: \"id_map.pkl\" saves the mapping relationship between image IDs and image feature labels; \"vector.index\" stores the feature vectors of each image. str None

(3) Call the predict method of the face recognition pipeline object for inference prediction: The predict method parameter is x, used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory containing the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(4) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(5) Process the prediction results: The prediction result for each sample is of type dict, and it supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: Boolean, whether to format the output with JSON indentation, default is True; - indent: Integer, JSON formatting setting, effective only when format_json is True, default is 4; - ensure_ascii: Boolean, JSON formatting setting, effective only when format_json is True, default is False; save_to_json Save results as a JSON file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name; - indent: Integer, JSON formatting setting, default is 4; - ensure_ascii: Boolean, JSON formatting setting, default is False; save_to_img Save results as an image file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name;

If you have obtained the configuration file, you can customize various settings of the facial recognition pipeline by simply modifying the pipeline parameter value in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/face_recognition.yaml, you just need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/face_recognition.yaml\")\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#223-adding-and-deleting-operations-in-the-face-feature-library","title":"2.2.3 Adding and Deleting Operations in the Face Feature Library","text":"

If you wish to add more face images to the feature library, you can call the add_index method; to delete face image features, you can call the delete_index method.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.add_index(data_root=\"add_gallery\", index_dir=\"face_gallery_index\")\n\npipeline.delete_index(data_root=\"delete_gallery\", index_dir=\"face_gallery_index\")\n

The add_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be added. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library to which features are added. After successfully calling the add_index method, the face image features in data_root will be added to the face feature library originally saved at index_dir. str None

The delete_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be deleted. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library from which features are deleted. After successfully calling the delete_index method, the face image features in data_root will be deleted from the face feature library originally saved at index_dir. str None"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#23-data-organization-for-feature-library-construction","title":"2.3 Data Organization for Feature Library Construction","text":"

The face recognition pipeline example in PaddleX requires a pre-constructed feature library for face feature retrieval. If you wish to build a face feature library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u251c\u2500\u2500 ID0           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502       ...\n\u2502   \u251c\u2500\u2500 ID1           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the face image to be retrieved and the image feature label, separated by a space. Example content: images/Chandler/Chandler00037.jpg Chandler\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the face recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the face recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is successfully processed, the response status code is 200, and the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result attribute of type object, which stores the operation result information.

  • When the request is not successfully processed, the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • infer

Obtain OCR results for an image.

POST /ocr

  • The attributes of the request body are as follows:
Name Type Meaning Required image string The URL of an accessible image file or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The attributes of```markdown

Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image to Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64 encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // Encode the local image to Base64\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // Call the API\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // Process the response data\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outputImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outputImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n\n
``````markdown # Tutorial on Artificial Intelligence and Computer Vision This tutorial, intended for numerous developers, covers the basics and applications of AI and Computer Vision. Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // Service URL\n        String imagePath = \"./demo.jpg\"; // Local image path\n        String outputImagePath = \"./out.jpg\"; // Output image path\n\n        // Encode the local image to Base64\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64-encoded file content or image URL\n\n        // Create an OkHttpClient instance\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // Call the API and process the response\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // Encode the local image to Base64\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64-encoded file content or image URL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // Call the API\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // Process the response\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }```markdown\n# An English Tutorial on Artificial Intelligence and Computer Vision\n\nThis tutorial document is intended for numerous developers and covers content related to artificial intelligence and computer vision.\n\n<details>\n<summary>C#</summary>\n\n```csharp\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\nstatic readonly string API_URL = \"http://localhost:8080/ocr\";\nstatic readonly string imagePath = \"./demo.jpg\";\nstatic readonly string outputImagePath = \"./out.jpg\";\n\nstatic async Task Main(string[] args)\n{\nvar httpClient = new HttpClient();\n\n// Encode the local image to Base64\nbyte[] imageBytes = File.ReadAllBytes(imagePath);\nstring image_data = Convert.ToBase64String(imageBytes);\n\nvar payload = new JObject{ { \"image\", image_data } }; // Base64 encoded file content or image URL\nvar content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n// Call the API\nHttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\nresponse.EnsureSuccessStatusCode();\n\n// Process the API response\nstring responseBody = await response.Content.ReadAsStringAsync();\nJObject jsonResponse = JObject.Parse(responseBody);\n\nstring base64Image = jsonResponse[\"result\"][\"image\"].ToString();\nbyte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\nFile.WriteAllBytes(outputImagePath, outputImageBytes);\nConsole.WriteLine($\"Output image saved at {outputImagePath}\");\nConsole.WriteLine(\"\\nDetected texts:\");\nConsole.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n}\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr';\nconst imagePath = './demo.jpg';\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64 encoded file content or image URL\n  })\n};\n\n// Encode the local image to Base64\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// Call the API\naxios.request(config)\n.then((response) => {\n    // Process the API response\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP ```php $image_data); // Base64 encoded file content or image URL // Call the API $ch = curl_init($API_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process the API response $result = json_decode($response, true)[\"result\"]; file_put_contents($output ``` \ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the [PaddleX Edge Deployment Guide](../../../pipeline_deploy/edge_deploy.en.md). You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration. ## 4. Custom Development If the default model weights provided by the Face Recognition Pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the pipeline in your scenario. ### 4.1 Model Fine-tuning Since the Face Recognition Pipeline consists of two modules (face detection and face recognition), the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If you find that many faces are not detected during the analysis, it may indicate deficiencies in the face detection model. In this case, you need to refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_detection.en.md#IV.-Custom-Development) section in the [Face Detection Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_detection.en.md) and use your private dataset to fine-tune the face detection model. If matching errors occur in detected faces, it suggests that the face feature model needs further improvement. You should refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_feature.en.md#IV.-Custom-Development) section in the [Face Feature Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_feature.en.md) to fine-tune the face feature model. ### 4.2 Model Application After completing fine-tuning training with your private dataset, you will obtain local model weight files. To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the pipeline configuration file: ```bash ...... Pipeline: device: \"gpu:0\" det_model: \"BlazeFace\" # Can be modified to the local path of the fine-tuned face detection model rec_model: \"MobileFaceNet\" # Can be modified to the local path of the fine-tuned face recognition model det_batch_size: 1 rec_batch_size: 1 device: gpu ...... ``` Subsequently, refer to the command-line method or Python script method in [2.2 Local Experience](#22-Local-Experience) to load the modified pipeline configuration file. Note: Currently, setting separate `batch_size` for face detection and face recognition models is not supported. ## 5. Multi-hardware Support PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the `--device` parameter allows seamless switching between different hardware. For example, when running the face recognition pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the `device` in the script to `npu`: ```python from paddlex import create_pipeline pipeline = create_pipeline( pipeline=\"face_recognition\", device=\"npu:0\" # gpu:0 --> npu:0 ) ``` If you want to use the face recognition pipeline on more types of hardware, please refer to the [PaddleX Multi-device Usage Guide](../../../other_devices_support/multi_devices_use_guide.en.md)."},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html","title":"General Image Recognition Pipeline Usage Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#1-introduction-to-the-general-image-recognition-pipeline","title":"1. Introduction to the General Image Recognition Pipeline","text":"

The General Image Recognition Pipeline aims to solve the problem of open-domain object localization and recognition. Currently, PaddleX's General Image Recognition Pipeline supports PP-ShiTuV2.

PP-ShiTuV2 is a practical general image recognition system mainly composed of three modules: mainbody detection module, image feature module, and vector retrieval module. The system integrates and improves various strategies in multiple aspects, including backbone network, loss function, data augmentation, learning rate scheduling, regularization, pre-trained model, and model pruning and quantization. It optimizes each module and ultimately achieves better performance in multiple application scenarios.

The General Image Recognition Pipeline includes the mainbody detection module and the image feature module, with several models to choose. You can select the model to use based on the benchmark data below. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Object Detection Module:

Model mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_det 41.5 62.0 33.7 537.0 27.54 An mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common objects simultaneously.

Note: The above accuracy metrics are based on the private mainbody detection dataset.

Image Feature Module:

Model Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: mainbody detection, feature extraction, and vector retrieval. These models are part of the feature extraction module, and different models can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are based on AliProducts Recall@1. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can use Python to experience locally.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General Image Recognition Pipeline locally, please ensure you have installed the PaddleX wheel package according to the PaddleX Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

The pipeline does not support command line experience at this time.

By default, the built-in General Image Recognition Pipeline configuration file is used. If you want to change it, you can run the following command to obtain:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config PP-ShiTuV2\n

After execution, the General Image Recognition Pipeline configuration file will be saved in the current directory. If you want to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ShiTuV2 --save_path ./my_path\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"
  • In the example of using this pipeline, a feature vector library needs to be built beforehand. You can download the officially provided drink recognition test dataset drink_dataset_v2.0 to build the feature vector library. If you want to use a private dataset, you can refer to Section 2.3 Data Organization for Building the Feature Library. After that, you can quickly build the feature vector library and predict using the General Image Recognition Pipeline with just a few lines of code.
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"PP-ShiTuV2\")\n\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\", index_dir=\"index_dir\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n\n````\n\nIn the above Python script, the following steps are executed:\n\n(1) Call the `create_pipeline` function to create a general image recognition pipeline object. The specific parameter descriptions are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>pipeline</code></td>\n<td>The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, <code>index_dir</code> needs to be specified in <code>predict()</code>.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>device</code></td>\n<td>The inference device for the pipeline model. Supports: \"gpu\", \"cpu\".</td>\n<td><code>str</code></td>\n<td><code>gpu</code></td>\n</tr>\n<tr>\n<td><code>use_hpip</code></td>\n<td>Whether to enable high-performance inference, which is only available when the pipeline supports it.</td>\n<td><code>bool</code></td>\n<td><code>False</code></td>\n</tr>\n</tbody>\n</table>\n\n(2) Call the `build_index` function of the general image recognition pipeline object to build the feature vector library. The specific parameters are described as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>data_root</code></td>\n<td>The root directory of the dataset. The data organization method refers to <a href=\"#2.3-Data-Organization-for-Building-the-Feature-Library\">Section 2.3 Data Organization for Building the Feature Library</a></td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The save path for the feature library. After successfully calling the <code>build_index</code> function, two files will be generated in this path: <code>\"id_map.pkl\"</code> saves the mapping relationship between image IDs and image feature labels; <code>\"vector.index\"</code> stores the feature vectors of each image.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n</tbody>\n</table>\n\n(3) Call the `predict` function of the general image recognition pipeline object for inference prediction: The `predict` function parameter is `input`, which is used to input the data to be predicted, supporting multiple input methods. Specific examples are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Python Var</td>\n<td>Supports directly passing in Python variables, such as <code>numpy.ndarray</code> representing image data.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the file path of the data to be predicted, such as the local path of an image file: <code>/root/data/img.jpg</code>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: <a href=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/yuanqisenlin.jpeg\">Example</a>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in a local directory that contains the data files to be predicted, such as the local path: <code>/root/data/</code>.</td>\n</tr>\n<tr>\n<td>dict</td>\n<td>Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: <code>{\"img\": \"/root/data1\"}</code>.</td>\n</tr>\n<tr>\n<td>list</td>\n<td>Supports passing in a list, where the elements of the list need to be the above types of data, such as <code>[numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]</code>, <code>[\"/root/data1\", \"/root/data2\"]</code>, <code>[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]</code>.</td>\n</tr>\n</tbody>\n</table>\n\nAdditionally, the `predict` method supports the `index_dir` parameter for setting the retrieval database:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, the default retrieval database specified through the <code>index_dir</code> parameter in <code>create_pipeline()</code> will be used.</td>\n</tr>\n</tbody>\n</table>\n\n(4) Obtain the prediction results by calling the `predict` method: The `predict` method is a `generator`, so prediction results need to be obtained by iteration. The `predict` method predicts data in batches.\n\n(5) Process the prediction results: The prediction result for each sample is of `dict` type and supports printing or saving to a file. The supported save types are related to the specific pipeline, such as:\n\n<table>\n<thead>\n<tr>\n<th>Method</th>\n<th>Description</th>\n<th>Method Parameters</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>print</td>\n<td>Print the results to the terminal</td>\n<td><code>- format_json</code>: bool type, whether to use json indentation formatting for the output content, default is True;<br><code>- indent</code>: int type, json formatting setting, only effective when format_json is True, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, only effective when format_json is True, default is False;</td>\n</tr>\n<tr>\n<td>save_to_json</td>\n<td>Save the results as a json-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;<br><code>- indent</code>: int type, json formatting setting, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, default is False;</td>\n</tr>\n<tr>\n<td>save_to_img</td>\n<td>Save the results as an image-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;</td>\n</tr>\n</tbody>\n</table>\n\nIf you have a configuration file, you can customize the configurations for the general image recognition pipeline by modifying the `pipeline` parameter value in the `create_pipeline` method to the path of the pipeline configuration file.\n\nFor example, if your configuration file is saved at `./my_path/PP-ShiTuV2.yaml`, you only need to execute:\n\n```python\nfrom paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/PP-ShiTuV2.yaml\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#223-add-or-remove-features-from-the-feature-library","title":"2.2.3 Add or Remove Features from the Feature Library","text":"

If you want to add more images to the feature library, you can call the append_index function; to remove image features, you can call the remove_index function.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\"PP-ShiTuV2\")\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.append_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.remove_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\n

The parameter descriptions for the above methods are as follows:

Parameter Description Type Default Value data_root The root directory of the dataset to be added. The data organization should be the same as when building the feature library, refer to Section 2.3 Data Organization for Building the Feature Library str None index_dir The storage directory for the feature library. In append_index and remove_index, it is also the path of the feature library to be modified (or deleted). str None index_type Supports HNSW32, IVF, Flat. Among them, HNSW32 has faster retrieval speed and higher accuracy but does not support the remove_index() operation; IVF has faster retrieval speed but relatively lower accuracy, and supports append_index() and remove_index() operations; Flat has lower retrieval speed but higher accuracy, and supports append_index() and remove_index() operations. str HNSW32 metric_type Supports: IP, Inner Product; L2, Euclidean Distance. str IP"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#23-data-organization-for-building-the-feature-library","title":"2.3 Data Organization for Building the Feature Library","text":"

The PaddleX general image recognition pipeline requires a pre-built feature library for feature retrieval. If you want to build a feature vector library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the image to be retrieved and the image label, separated by a space, for example: \u201c0/0.jpg label\u201d\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result property, which is an object type that stores operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • buildIndex

Build feature vector index.

POST /shitu-index-build

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning indexKey string The key corresponding to the index, used to identify the established index. Can be used as input for other operations. idMap object Mapping from vector ID to label.
  • addImagesToIndex

Add images (corresponding feature vectors) to the index.

POST /shitu-index-add

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • removeImagesFromIndex

Remove images (corresponding feature vectors) from the index.

POST /shitu-index-remove

  • The properties of the request body are as follows:
Name Type Meaning Required ids array IDs of the vectors to be removed from the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • infer

Perform image recognition.

POST /shitu-infer

  • The properties of the request body are as follows:
Name Type Meaning Required image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning detectedObjects array Information of the detected targets. image string Recognition result image. The image is in JPEG format, encoded with Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Meaning bbox array Target location. The elements in the array are the x-coordinate of the upper-left corner, the y-coordinate of the upper-left corner, the x-coordinate of the lower-right corner, and the y-coordinate of the lower-right corner, respectively. recResults array Recognition results. score number Detection score.

Each element in recResults is an object with the following properties:

Name Type Meaning label string Label. score number Recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\n\nbase_image_label_pairs = [\n    {\"image\": \"./demo0.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo1.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo2.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nimage_label_pairs_to_add = [\n    {\"image\": \"./demo3.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nids_to_remove = [1]\ninfer_image_path = \"./demo4.jpg\"\noutput_image_path = \"./out.jpg\"\n\nfor pair in base_image_label_pairs:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": base_image_label_pairs}\nresp_index_build = requests.post(f\"{API_BASE_URL}/shitu-index-build\", json=payload)\nif resp_index_build.status_code != 200:\n    print(f\"Request to shitu-index-build failed with status code {resp_index_build}.\")\n    pprint.pp(resp_index_build.json())\n    sys.exit(1)\nresult_index_build = resp_index_build.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_build['idMap'])}\")\n\nfor pair in image_label_pairs_to_add:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": image_label_pairs_to_add, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_add = requests.post(f\"{API_BASE_URL}/shitu-index-add\", json=payload)\nif resp_index_add.status_code != 200:\n    print(f\"Request to shitu-index-add failed with status code {resp_index_add}.\")\n    pprint.pp(resp_index_add.json())\n    sys.exit(1)\nresult_index_add = resp_index_add.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_add['idMap'])}\")\n\npayload = {\"ids\": ids_to_remove, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_remove = requests.post(f\"{API_BASE_URL}/shitu-index-remove\", json=payload)\nif resp_index_remove.status_code != 200:\n    print(f\"Request to shitu-index-remove failed with status code {resp_index_remove}.\")\n    pprint.pp(resp_index_remove.json())\n    sys.exit(1)\nresult_index_remove = resp_index_remove.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_remove['idMap'])}\")\n\nwith open(infer_image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_infer = requests.post(f\"{API_BASE_URL}/shitu-infer\", json=payload)\nif resp_infer.status_code != 200:\n    print(f\"Request to shitu-infer failed with status code {resp_infer}.\")\n    pprint.pp(resp_infer.json())\n    sys.exit(1)\nresult_infer = resp_infer.json()[\"result\"]\n\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result_infer[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\npprint.pp(result_infer[\"detectedObjects\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Image Recognition Pipeline do not meet your expectations in terms of precision or speed. You can further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-Tuning","text":"

Since the General Image Recognition Pipeline consists of two modules (the mainbody detection module and the image feature module), the suboptimal performance of the pipeline may stem from either module.

You can analyze images with poor recognition results. After analysising, if you find that many mainbody objects are not detected, it may indicate deficiencies in the mainbody detection model. You need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the mainbody detection model. If there are mismatches in the detected mainbody objects, it suggests that the image feature model requires further improvement. You should refer to the Custom Development section in the Image Feature Module Development Tutorial and fine-tune the image feature model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After you complete the fine-tuning training with your private dataset, you will obtain local model files.

To use the fine-tuned model, you only need to modify the pipeline configuration file by replacing with the paths to your fine-tuned model:

Pipeline:\n  device: \"gpu:0\"\n  det_model: \"./PP-ShiTuV2_det_infer/\"        # Can be modified to the local path of the fine-tuned mainbody detection model\n  rec_model: \"./PP-ShiTuV2_rec_infer/\"        # Can be modified to the local path of the fine-tuned image feature model\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n
Subsequently, refer to the command-line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply by modifying the --device parameter, seamless switching between different hardware can be achieved.

For example, when running the General Image Recognition Pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the device in the script to npu:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ShiTuV2\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n)\n

If you want to use the General Image Recognition Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html","title":"Image Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#1-introduction-to-image-anomaly-detection-pipeline","title":"1. Introduction to Image Anomaly Detection Pipeline","text":"

Image anomaly detection is an image processing technique that identifies unusual or non-conforming patterns within images through analysis. It is widely applied in industrial quality inspection, medical image analysis, and security monitoring. By leveraging machine learning and deep learning algorithms, image anomaly detection can automatically recognize potential defects, anomalies, or abnormal behaviors in images, enabling us to promptly identify issues and take corresponding actions. The image anomaly detection system is designed to automatically detect and mark anomalies in images, enhancing work efficiency and accuracy.

The image anomaly detection pipeline includes an unsupervised anomaly detection module, with the following model benchmarks:

Model NameModel Download Link Avg (%) Model Size (M) STFPMInference Model/Trained Model 96.2 21.5 M

Note: The above accuracy metrics are the average anomaly scores on the MVTec AD validation set. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the anomaly detection pipeline, allowing for quick experience of its effects. You can use the command line or Python to experience the image anomaly detection pipeline locally.

Before using the image anomaly detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config anomaly_detection\n

After execution, the image anomaly detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config anomaly_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./anomaly_detection.yaml, simply execute:

paddlex --pipeline ./anomaly_detection.yaml --input uad_grid.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'uad_grid.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference using the pipeline. Taking the image anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"anomaly_detection\")\n\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n

The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the pipeline object for inference prediction: The predict method takes x as its parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path to the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/anomaly_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/anomaly_detection.yaml\")\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs anomaly detection on images.

POST /image-anomaly-detection

  • Request body properties:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order), where 255 represents an anomaly point, and 0 represents a non-anomaly point. size array Image shape. The elements in the array are the height and width of the image in order. image string Anomaly detection result image. The image is in JPEG format and encoded in Base64.

Example of result:

{\n\"labelMap\": [\n0,\n0,\n255,\n0\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-anomaly-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-anomaly-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-anomaly-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-anomaly-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-anomaly-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-anomaly-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the image anomaly detection pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the image anomaly detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the image anomaly detection pipeline includes an unsupervised image anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Unsupervised Anomaly Detection Module Tutorial and use your private dataset to fine-tune the image anomaly detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding position in the pipeline configuration file:

......\nPipeline:\n  model: STFPM   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the image anomaly detection pipeline, the Python command is:

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline anomaly_detection --input uad_grid.png --device npu:0\n
If you want to use the image anomaly detection pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html","title":"General Image Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#1-introduction-to-the-general-image-classification-pipeline","title":"1. Introduction to the General Image Classification Pipeline","text":"

Image classification is a technique that assigns images to predefined categories. It is widely applied in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification.

The General Image Classification Pipeline includes an image classification module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Image Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Image Classification Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config image_classification\n

After execution, the image classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file take effect. For example, if the configuration file's save path is ./image_classification.yaml, simply execute:

paddlex --pipeline ./image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If you still specify parameters, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': [0.62736, 0.03752, 0.03256, 0.0323, 0.03194], 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the results. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string The image classification result image. The image is in JPEG format and encoded using Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image classification pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using data from your specific domain or application scenario to improve the recognition performance of the general image classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image classification pipeline includes an image classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Classification Module Development Tutorial and use your private dataset to fine-tune the image classification model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the image classification pipeline, the Python command is:

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Classification Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html","title":"General Image Multi-Label Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#1-introduction-to-the-general-image-multi-label-classification-pipeline","title":"1. Introduction to the General Image Multi-Label Classification Pipeline","text":"

Image multi-label classification is a technique that assigns multiple relevant categories to a single image simultaneously, widely used in image annotation, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, for example, an image containing both \"dog\" and \"outdoor\" labels. By leveraging deep learning models, image multi-label classification automatically extracts image features and performs accurate classification, providing users with more comprehensive information. This technology is of great significance in applications such as intelligent search engines and automatic content generation.

The General Image Multi-Label Classification Pipeline includes a module for image multi-label classification. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link mAP (%) Model Storage Size (M) CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 - PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 ResNet50_MLInference Model/Trained Model 83.50 108.9

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017. The GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the General Image Multi-Label Classification Pipeline locally using command line or Python.

Before using the General Image Multi-Label Classification Pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the effects of the image multi-label classification pipeline with a single command:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image multi-label classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default configuration file for the image multi-label classification pipeline is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config multi_label_image_classification\n

After execution, the configuration file for the image multi-label classification pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config multi_label_image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./multi_label_image_classification.yaml, simply execute:

paddlex --pipeline ./multi_label_image_classification.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n

Where --model, --device, and other parameters are not specified, the parameters in the configuration file will be used. If parameters are specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [21, 0, 30, 24], 'scores': [0.99257, 0.70596, 0.63001, 0.57852], 'label_names': ['bear', 'person', 'skis', 'backpack']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general image multi-label classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"multi_label_image_classification\")\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result visualization image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path of the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the multi-label classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the file path of the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key of the dictionary needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/multi_label_image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/multi_label_image_classification.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have strict standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed to 0. errorMsg string Error message. Fixed to \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /multilabel-image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the result. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string Image classification result image. The image is in JPEG format and encoded in Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/multilabel-image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/multilabel-image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/multilabel-image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/multilabel-image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/multilabel-image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/multilabel-image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/multilabel-image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a way to place computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image multi-label classification pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general image multi-label classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image multi-label classification pipeline includes an image multi-label classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Multi-Label Classification Module Development Tutorial to fine-tune the image multi-label classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0_ML   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the image multi-label classification pipeline, the Python command is:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/padd\n

At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the Python command to npu:0:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Multi-label Classification Pipeline on more diverse hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html","title":"General Instance Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#1-introduction-to-the-general-instance-segmentation-pipeline","title":"1. Introduction to the General Instance Segmentation Pipeline","text":"

Instance segmentation is a computer vision task that not only identifies the object categories in an image but also distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately label each car, person, or animal in an image, ensuring they are independently processed at the pixel level. For example, in a street scene image containing multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robotic vision, often relying on deep learning models (such as Mask R-CNN) to achieve efficient pixel classification and instance differentiation through Convolutional Neural Networks (CNNs), providing powerful support for understanding complex scenes.

The General Instance Segmentation Pipeline includes a Object Detection module. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of the effects. You can experience the effects of the General Instance Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Instance Segmentation Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline instance_segmentation --input  general_instance_segmentation_004.png --device gpu:0\n

Parameter Description:

--pipeline: The name of the pipeline, here it refers to the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default instance segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config instance_segmentation\n

After execution, the instance segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config instance_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./instance_segmentation.yaml, simply execute:

paddlex --pipeline ./instance_segmentation.yaml --input general_instance_segmentation_004.png --device gpu:0\n

Where --model, --device, and other parameters do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_instance_segmentation_004.png', 'boxes': [{'cls_id': 0, 'label': 'person', 'score': 0.8698326945304871, 'coordinate': [339, 0, 639, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8571141362190247, 'coordinate': [0, 0, 195, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8202633857727051, 'coordinate': [88, 113, 401, 574]}, {'cls_id': 0, 'label': 'person', 'score': 0.7108577489852905, 'coordinate': [522, 21, 767, 574]}, {'cls_id': 27, 'label': 'tie', 'score': 0.554280698299408, 'coordinate': [247, 311, 355, 574]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general instance segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"instance_segmentation\")\n\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualization image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/instance_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/instance_segmentation.yaml\")\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs instance segmentation on an image.

POST /instance-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description instances array Information about the locations and categories of instances. image string The result image of instance segmentation. The image is in JPEG format and encoded in Base64.

Each element in instances is an object with the following properties:

Name Type Description bbox array The location of the instance. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the instance category. score number The score of the instance. mask object The segmentation mask of the instance.

The properties of mask are as follows:

Name Type Description rleResult str The run-length encoding result of the mask. size array The shape of the mask. The elements in the array are the height and width of the mask, respectively.

An example of result is as follows:

{\n\"instances\": [\n{\n\"bbox\": [\n162.39381408691406,\n83.88176727294922,\n624.0797119140625,\n343.4986877441406\n],\n\"categoryId\": 33,\n\"score\": 0.8691174983978271,\n\"mask\": {\n\"rleResult\": \"xxxxxx\",\n\"size\": [\n259,\n462\n]\n}\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/instance-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nInstances:\")\nprint(result[\"instances\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/instance-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto instances = result[\"instances\"];\n        std::cout << \"\\nInstances:\" << std::endl;\n        for (const auto& inst : instances) {\n            std::cout << inst << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/instance-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode instances = result.get(\"instances\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nInstances: \" + instances.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/instance-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Instances []map[string]interface{} `json:\"instances\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nInstances:\")\n    for _, inst := range respData.Result.Instances {\n        fmt.Println(inst)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/instance-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nInstances:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"instances\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/instance-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nInstances:\");\n    console.log(result[\"instances\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/instance-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nInstances:\\n\";\nprint_r($result[\"instances\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#4-ccustom-development","title":"4. CCustom Development","text":"

If the default model weights provided by the general instance segmentation pipeline do not meet your requirements for accuracy or speed in your scenario, you can try to further fine-tune the existing model using data specific to your domain or application scenario to improve the recognition effect of the general instance segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general instance segmentation pipeline includes an instance segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Instance Segmentation Module Development Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: Mask-RT-DETR-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n

Then, refer to the command line method or Python script method in the local experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for instance segmentation pipeline inference, the Python command is:

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device npu:0\n

If you want to use the General Instance Segmentation Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html","title":"General Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#1-introduction-to-general-object-detection-pipeline","title":"1. Introduction to General Object Detection Pipeline","text":"

Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only requires recognizing what objects are present in an image, such as people, cars, and animals, but also accurately determining the specific position of each object within the image, typically represented by rectangular boxes. This technology is widely used in autonomous driving, surveillance systems, smart photo albums, and other fields, relying on deep learning models (e.g., YOLO, Faster R-CNN) that can efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.

ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Object Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Object Detection Pipeline online using the demo images provided by the official source, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Object Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command can quickly experience the effects of the object detection pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

Click to expand \ud83d\udc49
paddlex --get_pipeline_config object_detection\n

After execution, the object detection pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is ./object_detection.yaml, simply execute:

paddlex --pipeline ./object_detection.yaml --input general_object_detection_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_object_detection_002.png', 'boxes': [{'cls_id': 49, 'label': 'orange', 'score': 0.8188097476959229, 'coordinate': [661, 93, 870, 305]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7743489146232605, 'coordinate': [76, 274, 330, 520]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7270504236221313, 'coordinate': [285, 94, 469, 297]}, {'cls_id': 46, 'label': 'banana', 'score': 0.5570532083511353, 'coordinate': [310, 361, 685, 712]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5484835505485535, 'coordinate': [764, 285, 924, 440]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5160726308822632, 'coordinate': [853, 169, 987, 303]}, {'cls_id': 60, 'label': 'dining table', 'score': 0.5142655968666077, 'coordinate': [0, 0, 1072, 720]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5101479291915894, 'coordinate': [57, 23, 213, 176]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#222-integration-via-python-scripts","title":"2.2.2 Integration via Python Scripts","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking General Object Detection as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"object_detection\")\n\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method parameter x is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/object_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/object_detection.yaml\")\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Object Detection pipeline do not meet your requirements for precision or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the General Object Detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Object Detection pipeline includes an object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PicoDet-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the General Object Detection pipeline, the Python command is:

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline object_detection --input general_object_detection_002.png --device npu:0\n
If you want to use the General Object Detection Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#1-introduction-to-pedestrian-attribute-recognition-pipeline","title":"1. Introduction to Pedestrian Attribute Recognition Pipeline","text":"

Pedestrian attribute recognition is a key function in computer vision systems, used to locate and label specific characteristics of pedestrians in images or videos, such as gender, age, clothing color, and style. This task not only requires accurately detecting pedestrians but also identifying detailed attribute information for each pedestrian. The pedestrian attribute recognition pipeline is an end-to-end serial system for locating and recognizing pedestrian attributes, widely used in smart cities, security surveillance, and other fields, significantly enhancing the system's intelligence level and management efficiency.

The pedestrian attribute recognition pipeline includes a pedestrian detection module and a pedestrian attribute recognition module, with several models in each module. Which models to use specifically can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Pedestrian Detection Module:

ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Pedestrian detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Pedestrian Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories.

Note: The above accuracy metrics are mA on PaddleX's internally built dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can quickly demonstrate their effectiveness. You can experience the pedestrian attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the pedestrian attribute recognition pipeline locally, ensure you have completed the installation of the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

You can quickly experience the pedestrian attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the pedestrian attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default pedestrian attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config pedestrian_attribute_recognition\n

After execution, the pedestrian attribute recognition pipeline configuration file will be saved in the current path. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config pedestrian_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./pedestrian_attribute_recognition.yaml, simply execute:

paddlex --pipeline ./pedestrian_attribute_recognition.yaml --input pedestrian_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference of the pipeline. Taking the pedestrian attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"pedestrian_attribute_recognition\")\n\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized image of the result\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the pedestrian attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the pedestrian attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of type dict and supports printing or saving as a file. The supported save types are related to the specific pipeline, such as:

Method Description Method Parameters print Print the results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save the results as a json-formatted file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file name;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save the results as an image file

If you have obtained the configuration file, you can customize various configurations for the pedestrian attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved as ./my_path/pedestrian_attribute_recognition*.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/pedestrian_attribute_recognition.yaml\")\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pedestrian attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pedestrian attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get pedestrian attribute recognition results.

POST /pedestrian-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description pedestrians array Information about the pedestrian's location and attributes. image string The pedestrian attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in pedestrians is an object with the following properties:

Name Type Description bbox array The location of the pedestrian. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The pedestrian attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/pedestrian-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected pedestrians:\")\nprint(result[\"pedestrians\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the pedestrian attribute recognition pipeline includes both a pedestrian attribute recognition module and a pedestrian detection module, the unexpected performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the pedestrian detection model. In this case, you need to refer to the Secondary Development section in the Human Detection Module Development Tutorial and use your private dataset to fine-tune the pedestrian detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Secondary Development section in the Pedestrian Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the pedestrian attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning training with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-YOLOE-L_human\n  cls_model: PP-LCNet_x1_0_pedestrian_attribute  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports multiple mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference in the pedestrian attribute recognition pipeline, the command used is:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device npu:0\n
If you want to use the pedestrian attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html","title":"General Semantic Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#1-introduction-to-the-general-semantic-segmentation-pipeline","title":"1. Introduction to the General Semantic Segmentation Pipeline","text":"

Semantic segmentation is a computer vision technique that aims to assign each pixel in an image to a specific category, enabling a detailed understanding of the image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing regions of the same category to be fully labeled. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, the sky, and roads pixel by pixel, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (such as SegFormer, etc.) to extract features by CNN or Transformer, and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effects of the General Semantic Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Semantic Segmentation Pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Semantic Segmentation Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the semantic segmentation pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n

Parameter Explanation:

--pipeline: The name of the pipeline, here it is the semantic segmentation pipeline\n--input: The local path or URL of the input image to be processed\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs), or choose to use CPU (--device cpu)\n

When executing the above command, the default semantic segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config semantic_segmentation\n

After execution, the semantic segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./semantic_segmentation.yaml, simply execute:

paddlex --pipeline ./semantic_segmentation.yaml --input makassaridn-road_demo.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_object_detection_002.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general semantic segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"semantic_segmentation\")\n\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by calling it. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/semantic_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs semantic segmentation on an image.

POST /semantic-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order). size array Image shape. The elements in the array are the height and width of the image, respectively. image string The semantic segmentation result image. The image is in JPEG format and encoded using Base64.

An example of result is as follows:

{\n\"labelMap\": [\n0,\n0,\n1,\n2\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/semantic-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/semantic-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/semantic-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/semantic-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/semantic-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/semantic-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/semantic-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general semantic segmentation pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general semantic segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general semantic segmentation pipeline includes a semantic segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Semantic Segmentation Module Development Tutorial (GitHub can directly link to headings) and use your private dataset to fine-tune the semantic segmentation model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LiteSeg-T  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for semantic segmentation pipeline inference, the Python command is:

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device npu:0\n
If you want to use the General Semantic Segmentation Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html","title":"Small Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#1-introduction-to-small-object-detection-pipeline","title":"1. Introduction to Small Object Detection Pipeline","text":"

Small object detection is a specialized technique for identifying tiny objects within images, widely applied in fields such as surveillance, autonomous driving, and satellite image analysis. It can accurately locate and classify small-sized objects like pedestrians, traffic signs, or small animals within complex scenes. By leveraging deep learning algorithms and optimized Convolutional Neural Networks (CNNs), small object detection significantly enhances the recognition capabilities for small objects, ensuring no critical information is overlooked in practical applications. This technology plays a pivotal role in enhancing safety and automation levels.

The small object detection pipeline includes a small object detection module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, opt for a model with a smaller storage size.

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 458.521 11172.7 340.5 M

Note: The above accuracy metrics are based on the VisDrone-DET validation set mAP(0.5:0.95). All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the small object detection pipeline's effects through command line or Python locally.

Before using the small object detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the small object detection pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline small_object_detection --input small_object_detection.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the small object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, you can choose to use CPU (--device cpu).\n

When executing the above command, the default small object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config small_object_detection\n

After execution, the small object detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config small_object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file's save path is ./small_object_detection.yaml, simply execute:

paddlex --pipeline ./small_object_detection.yaml --input small_object_detection.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file.```markdown

After running, the result will be:

{'input_path': 'small_object_detection.jpg', 'boxes': [{'cls_id': 3, 'label': 'car', 'score': 0.9243856072425842, 'coordinate': [624, 638, 682, 741]}, {'cls_id': 3, 'label': 'car', 'score': 0.9206348061561584, 'coordinate': [242, 561, 356, 613]}, {'cls_id': 3, 'label': 'car', 'score': 0.9194547533988953, 'coordinate': [670, 367, 705, 400]}, {'cls_id': 3, 'label': 'car', 'score': 0.9162291288375854, 'coordinate': [459, 259, 523, 283]}, {'cls_id': 4, 'label': 'van', 'score': 0.9075379371643066, 'coordinate': [467, 213, 498, 242]}, {'cls_id': 4, 'label': 'van', 'score': 0.9066920876502991, 'coordinate': [547, 351, 577, 397]}, {'cls_id': 3, 'label': 'car', 'score': 0.9041045308113098, 'coordinate': [502, 632, 562, 736]}, {'cls_id': 3, 'label': 'car', 'score': 0.8934890627861023, 'coordinate': [613, 383, 647, 427]}, {'cls_id': 3, 'label': 'car', 'score': 0.8803309202194214, 'coordinate': [640, 280, 671, 309]}, {'cls_id': 3, 'label': 'car', 'score': 0.8727016448974609, 'coordinate': [1199, 256, 1259, 281]}, {'cls_id': 3, 'label': 'car', 'score': 0.8705748915672302, 'coordinate': [534, 410, 570, 461]}, {'cls_id': 3, 'label': 'car', 'score': 0.8654043078422546, 'coordinate': [669, 248, 702, 271]}, {'cls_id': 3, 'label': 'car', 'score': 0.8555219769477844, 'coordinate': [525, 243, 550, 270]}, {'cls_id': 3, 'label': 'car', 'score': 0.8522038459777832, 'coordinate': [526, 220, 553, 243]}, {'cls_id': 3, 'label': 'car', 'score': 0.8392605185508728, 'coordinate': [557, 141, 575, 158]}, {'cls_id': 3, 'label': 'car', 'score': 0.8353804349899292, 'coordinate': [537, 120, 553, 133]}, {'cls_id': 3, 'label': 'car', 'score': 0.8322211503982544, 'coordinate': [585, 132, 603, 147]}, {'cls_id': 3, 'label': 'car', 'score': 0.8298957943916321, 'coordinate': [701, 283, 736, 313]}, {'cls_id': 3, 'label': 'car', 'score': 0.8217393159866333, 'coordinate': [885, 347, 943, 377]}, {'cls_id': 3, 'label': 'car', 'score': 0.820313572883606, 'coordinate': [493, 150, 511, 168]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.8183429837226868, 'coordinate': [203, 701, 224, 743]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.815082848072052, 'coordinate': [185, 710, 201, 744]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7892289757728577, 'coordinate': [311, 371, 344, 407]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7812919020652771, 'coordinate': [345, 380, 388, 405]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7748346328735352, 'coordinate': [295, 500, 309, 532]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7688500285148621, 'coordinate': [851, 436, 863, 466]}, {'cls_id': 3, 'label': 'car', 'score': 0.7466475367546082, 'coordinate': [565, 114, 580, 128]}, {'cls_id': 3, 'label': 'car', 'score': 0.7156463265419006, 'coordinate': [483, 66, 495, 78]}, {'cls_id': 3, 'label': 'car', 'score': 0.704211950302124, 'coordinate': [607, 138, 642, 152]}, {'cls_id': 3, 'label': 'car', 'score': 0.7021926045417786, 'coordinate': [505, 72, 518, 83]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6897469162940979, 'coordinate': [802, 460, 815, 488]}, {'cls_id': 3, 'label': 'car', 'score': 0.671891450881958, 'coordinate': [574, 123, 593, 136]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.6712754368782043, 'coordinate': [445, 317, 472, 334]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6695684790611267, 'coordinate': [479, 309, 489, 332]}, {'cls_id': 3, 'label': 'car', 'score': 0.6273623704910278, 'coordinate': [654, 210, 677, 234]}, {'cls_id': 3, 'label': 'car', 'score': 0.6070230603218079, 'coordinate': [640, 166, 667, 185]}, {'cls_id': 3, 'label': 'car', 'score': 0.6064521670341492, 'coordinate': [461, 59, 476, 71]}, {'cls_id': 3, 'label': 'car', 'score': 0.5860581398010254, 'coordinate': [464, 87, 484, 100]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.5792551636695862, 'coordinate': [390, 390, 419, 408]}, {'cls_id': 3, 'label': 'car', 'score': 0.5559225678443909, 'coordinate': [481, 125, 496, 140]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5531904697418213, 'coordinate': [869, 306, 880, 331]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5468509793281555, 'coordinate': [895, 294, 904, 319]}, {'cls_id': 3, 'label': 'car', 'score': 0.5451828241348267, 'coordinate': [505, 94, 518, 108]}, {'cls_id': 3, 'label': 'car', 'score': 0.5398445725440979, 'coordinate': [657, 188, 681, 208]}, {'cls_id': 4, 'label': 'van', 'score': 0.5318890810012817, 'coordinate': [518, 88, 534, 102]}, {'cls_id': 3, 'label': 'car', 'score': 0.5296525359153748, 'coordinate': [527, 71, 540, 81]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.5168400406837463, 'coordinate': [528, 320, 563, 346]}, {'cls_id': 3, 'label': 'car', 'score': 0.5088561177253723, 'coordinate': [511, 84, 530, 95]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.502006471157074, 'coordinate': [841, 266, 850, 283]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can quickly enable inference on the production line. Taking the General Small Object Detection Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"small_object_detection\")\n\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/small_object_detection, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/small_object_detection.yaml\")\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment directly.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /small-object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/small-object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/small-object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/small-object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/small-object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/small-object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/small-object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/small-object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Small Object Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the small object detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Small Object Detection Pipeline includes a small object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Small Object Detection Module Tutorial and use your private dataset to fine-tune the small object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-YOLOE_plus_SOD-L  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the small object detection pipeline, the Python command would be:

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline multilabel_classification --input small_object_detection.jpg --device npu:0\n

If you want to use the General Small Object Detection Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#1-introduction-to-vehicle-attribute-recognition-pipeline","title":"1. Introduction to Vehicle Attribute Recognition Pipeline","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, and license plate number. This task not only requires accurately detecting vehicles but also identifying detailed attribute information for each vehicle. The vehicle attribute recognition pipeline is an end-to-end serial system for locating and recognizing vehicle attributes, widely used in traffic management, intelligent parking, security surveillance, autonomous driving, and other fields. It significantly enhances system efficiency and intelligence levels, driving the development and innovation of related industries.

The vehicle attribute recognition pipeline includes a vehicle detection module and a vehicle attribute recognition module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Vehicle Detection Module:

ModelModel Download Link mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicleInference Model/Trained Model 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicleInference Model/Trained Model 63.9 32.6 775.6 196.02

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Vehicle Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained models provided by PaddleX can quickly demonstrate results. You can experience the effects of the vehicle attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the vehicle attribute recognition pipeline locally, ensure you have installed the PaddleX wheel package according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#221-experience-via-command-line","title":"2.2.1 Experience via Command Line","text":"

You can quickly experience the vehicle attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the vehicle attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The index of the GPU to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs). You can also choose to use the CPU (--device cpu).\n

When executing the above Python script, the default vehicle attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config vehicle_attribute_recognition\n

After execution, the vehicle attribute recognition pipeline configuration file will be saved in the current directory. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config vehicle_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the saved path of the configuration file is ./vehicle_attribute_recognition.yaml, just execute:

paddlex --pipeline ./vehicle_attribute_recognition.yaml --input vehicle_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#222-integrating-via-python-script","title":"2.2.2 Integrating via Python Script","text":"

A few lines of code suffice for rapid inference on the production line, taking the vehicle attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"vehicle_attribute_recognition\")\n\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized result image\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the vehicle attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the vehicle attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

(4) Processing the Prediction Results: The prediction result for each sample is in dict format, which supports printing or saving to a file. The supported file types for saving depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save results as a json file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save results as an image file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;

If you have obtained the configuration file, you can customize the configurations for the vehicle attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved at ./my_path/vehicle_attribute_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/vehicle_attribute_recognition.yaml\")\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the vehicle attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the vehicle attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get vehicle attribute recognition results.

POST /vehicle-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description vehicles array Information about the vehicle's location and attributes. image string The vehicle attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in vehicles is an object with the following properties:

Name Type Description bbox array The location of the vehicle. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The vehicle attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/vehicle-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected vehicles:\")\nprint(result[\"vehicles\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the vehicle attribute recognition pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the vehicle attribute recognition pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the vehicle attribute recognition pipeline includes both a vehicle attribute recognition module and a vehicle detection module, the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the vehicle detection model. In this case, you need to refer to the Custom Development section in the Vehicle Detection Module Development Tutorial and use your private dataset to fine-tune the vehicle detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Custom Development section in the Vehicle Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the vehicle attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the path to the default model weights with the local path to the fine-tuned model weights:

......\nPipeline:\n  det_model: PP-YOLOE-L_vehicle\n  cls_model: PP-LCNet_x1_0_vehicle_attribute   # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line or Python script methods in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference with the vehicle attribute recognition pipeline, the command is:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device npu:0\n
If you want to use the vehicle attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html","title":"PP-ChatOCRv3-doc Pipeline utorial","text":""},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#1-introduction-to-pp-chatocrv3-doc-pipeline","title":"1. Introduction to PP-ChatOCRv3-doc Pipeline","text":"

PP-ChatOCRv3-doc is a unique intelligent analysis solution for documents and images developed by PaddlePaddle. It combines Large Language Models (LLM) and OCR technology to provide a one-stop solution for complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating with ERNIE Bot, it fuses massive data and knowledge to achieve high accuracy and wide applicability.

The PP-ChatOCRv3-doc pipeline includes modules for Table Structure Recognition, Layout Region Detection, Text Detection, Text Recognition, Seal Text Detection, Text Image Rectification, and Document Image Orientation Classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference speed. If you prioritize model storage size, choose a model with a smaller storage size. Some benchmarks for these models are as follows:

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effect of the Document Scene Information Extraction v3 pipeline online or locally using Python.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effect of the Document Scene Information Extraction v3 pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the PP-ChatOCRv3 pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

A few lines of code are all you need to complete the quick inference of the pipeline. Using the test file, taking the PP-ChatOCRv3-doc pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

After running, the output is as follows:

{'chat_res': {'\u200b\u4e59\u65b9\u200b': '\u200b\u80a1\u4efd\u200b\u6d4b\u8bd5\u200b\u6709\u9650\u516c\u53f8\u200b', '\u200b\u624b\u673a\u53f7\u200b': '19331729920'}, 'prompt': ''}\n

In the above Python script, the following steps are executed:

(1) Call the create_pipeline to instantiate a PP-ChatOCRv3-doc pipeline object, related parameters descriptions are as follows:

Parameter Type Default Description pipeline str None Pipeline name or pipeline configuration file path. If it's a pipeline name, it must be supported by PaddleX; llm_name str \"ernie-3.5\" Large Language Model name, we support ernie-4.0 and ernie-3.5, with more models on the way. llm_params dict {} API configuration; device(kwargs) str/None None Running device, support cpu, gpu, gpu:0, etc. None meaning automatic selection;

(2) Call the visual_predict of the PP-ChatOCRv3-doc pipeline object to visual predict, related parameters descriptions are as follows:

Parameter Type Default Description input Python Var - Support to pass Python variables directly, such as numpy.ndarray representing image data; input str - Support to pass the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg; input str - Support to pass the URL of the file to be predicted, such as: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf; input str - Support to pass the local directory, which should contain files to be predicted, such as: /root/data/; input dict - Support to pass a dictionary, where the key needs to correspond to the specific pipeline, such as: {\"img\": \"/root/data1\"}\uff1b input list - Support to pass a list, where the elements must be of the above types of data, such as: [numpy.ndarray, numpy.ndarray]\uff0c[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]\uff0c[\"/root/data1\", \"/root/data2\"]\uff0c[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]\uff1b use_doc_image_ori_cls_model bool True Whether or not to use the orientation classification model; use_doc_image_unwarp_model bool True Whether or not to use the unwarp model; use_seal_text_det_model bool True Whether or not to use the seal text detection model;

(3) Call the relevant functions of prediction object to save the prediction results. The related functions are as follows:

Function Parameter Description save_to_img save_path Save OCR prediction results, layout results, and table recognition results as image files, with the parameter save_path used to specify the save path; save_to_html save_path Save the table recognition results as an HTML file, with the parameter 'save_path' used to specify the save path; save_to_xlsx save_path Save the table recognition results as an Excel file, with the parameter 'save_path' used to specify the save path;

(4) Call the chat of PP-ChatOCRv3-doc pipeline object to query information with LLM, related parameters are described as follows:

Parameter Type Default Description key_list str - Keywords used to query. A string composed of multiple keywords with \",\" as separators, such as \"Party B, phone number\"; key_list list - Keywords used to query. A list composed of multiple keywords.

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through calls. The predict method predicts data in batches, so the prediction results are represented as a list of prediction results.

(4) Interact with the large model by calling the predict.chat method, which takes as input keywords (multiple keywords are supported) for information extraction. The prediction results are represented as a list of information extraction results.

(5) Process the prediction results: The prediction result for each sample is in the form of a dict, which supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves layout analysis, table recognition, etc. results as image files. save_path: str, the file path to save. save_to_html Saves table recognition results as HTML files. save_path: str, the file path to save. save_to_xlsx Saves table recognition results as Excel files. save_path: str, the file path to save.

When executing the above command, the default Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

paddlex --get_pipeline_config PP-ChatOCRv3-doc\n

After execution, the configuration file for the PP-ChatOCRv3-doc pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n
After obtaining the configuration file, you can customize the various configurations of the PP-ChatOCRv3-doc pipeline:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

In the above configuration, you can modify the models loaded by each module of the pipeline, as well as the large language model used. Please refer to the module documentation for the list of supported models for each module, and the list of supported large language models includes: ernie-4.0, ernie-3.5, ernie-3.5-8k, ernie-lite, ernie-tiny-8k, ernie-speed, ernie-speed-128k, ernie-char-8k.

After making modifications, simply update the pipeline parameter value in the create_pipeline method to the path of your pipeline configuration file to apply the configuration.

For example, if your configuration file is saved at ./my_path/PP-ChatOCRv3-doc.yaml, you would execute:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2 Local Experience.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • analyzeImages

Analyze images using computer vision models to obtain OCR, table recognition results, and extract key information from the images.

POST /chatocr-vision

  • Request body properties:
Name Type Description Required file string The URL of an accessible image file or PDF file, or the Base64 encoded content of the above file types. For PDF files with more than 10 pages, only the first 10 pages will be used. Yes fileType integer File type. 0 represents PDF files, 1 represents image files. If this property is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This feature is enabled by default. No useImgUnwrapping boolean Whether to enable text image correction. This feature is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This feature is enabled by default. No inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description visionResults array Analysis results obtained using the computer vision model. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file in sequence. visionInfo object Key information in the image, which can be used as input for other operations.

Each element in visionResults is an object with the following properties:

Name Type Description texts array Text locations, contents, and scores. tables array Table locations and contents. inputImage string Input image. The image is in JPEG format and encoded in Base64. ocrImage string OCR result image. The image is in JPEG format and encoded in Base64. layoutImage string Layout area detection result image. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text location. The elements in the array are the vertex coordinates of the polygon enclosing the text in sequence. text string Text content. score number Text recognition score.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table location. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box in sequence. html string Table recognition result in HTML format.
  • buildVectorStore

Builds a vector database.

POST /chatocr-vector

  • The request body properties are as follows:
Name Type Description Required visionInfo object Key information from the image. Provided by the analyzeImages operation. Yes minChars integer Minimum data length to enable the vector database. No llmRequestInterval number Interval time for calling the large language model API. No llmName string Name of the large language model. No llmParams object Parameters for the large language model API. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description vectorStore string Serialized result of the vector database, which can be used as input for other operations.
  • retrieveKnowledge

Perform knowledge retrieval.

POST /chatocr-retrieval

  • The request body properties are as follows:
Name Type Description Required keys array List of keywords. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. Yes llmName string Name of the large language model. No llmParams object API parameters for the large language model. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description retrievalResult string The result of knowledge retrieval, which can be used as input for other operations.
  • chat

Interact with large language models to extract key information.

POST /chatocr-chat

  • Request body properties:
Name Type Description Required keys array List of keywords. Yes visionInfo object Key information from images. Provided by the analyzeImages operation. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. No retrievalResult string Results of knowledge retrieval. Provided by the retrieveKnowledge operation. No taskDescription string Task prompt. No rules string Custom extraction rules, e.g., for output formatting. No fewShot string Example prompts. No llmName string Name of the large language model. No llmParams object API parameters for the large language model. No returnPrompts boolean Whether to return the prompts used. Enabled by default. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • On successful request processing, the result in the response body has the following properties:
Name Type Description chatResult object Extracted key information. prompts object Prompts used.

Properties of prompts:

Name Type Description ocr string OCR prompt. table string Table prompt. html string HTML prompt. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\nAPI_KEY = \"{Qianfan Platform API key}\"\nSECRET_KEY = \"{Qianfan Platform secret key}\"\nLLM_NAME = \"ernie-3.5\"\nLLM_PARAMS = {\n    \"apiType\": \"qianfan\",\n    \"apiKey\": API_KEY,\n    \"secretKey\": SECRET_KEY,\n}\n\nfile_path = \"./demo.jpg\"\nkeys = [\"\u200b\u7535\u8bdd\u200b\"]\n\nwith open(file_path, \"rb\") as file:\n    file_bytes = file.read()\n    file_data = base64.b64encode(file_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": file_data,\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\nresp_vision = requests.post(url=f\"{API_BASE_URL}/chatocr-vision\", json=payload)\nif resp_vision.status_code != 200:\n    print(\n        f\"Request to chatocr-vision failed with status code {resp_vision.status_code}.\"\n    )\n    pprint.pp(resp_vision.json())\n    sys.exit(1)\nresult_vision = resp_vision.json()[\"result\"]\n\nfor i, res in enumerate(result_vision[\"visionResults\"]):\n    print(\"Texts:\")\n    pprint.pp(res[\"texts\"])\n    print(\"Tables:\")\n    pprint.pp(res[\"tables\"])\n    ocr_img_path = f\"ocr_{i}.jpg\"\n    with open(ocr_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"ocrImage\"]))\n    layout_img_path = f\"layout_{i}.jpg\"\n    with open(layout_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"layoutImage\"]))\n    print(f\"Output images saved at {ocr_img_path} and {layout_img_path}\")\n\npayload = {\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"minChars\": 200,\n    \"llmRequestInterval\": 1000,\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_vector = requests.post(url=f\"{API_BASE_URL}/chatocr-vector\", json=payload)\nif resp_vector.status_code != 200:\n    print(\n        f\"Request to chatocr-vector failed with status code {resp_vector.status_code}.\"\n    )\n    pprint.pp(resp_vector.json())\n    sys.exit(1)\nresult_vector = resp_vector.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_retrieval = requests.post(url=f\"{API_BASE_URL}/chatocr-retrieval\", json=payload)\nif resp_retrieval.status_code != 200:\n    print(\n        f\"Request to chatocr-retrieval failed with status code {resp_retrieval.status_code}.\"\n    )\n    pprint.pp(resp_retrieval.json())\n    sys.exit(1)\nresult_retrieval = resp_retrieval.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"retrievalResult\": result_retrieval[\"retrievalResult\"],\n    \"taskDescription\": \"\",\n    \"rules\": \"\",\n    \"fewShot\": \"\",\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n    \"returnPrompts\": True,\n}\nresp_chat = requests.post(url=f\"{API_BASE_URL}/chatocr-chat\", json=payload)\nif resp_chat.status_code != 200:\n    print(\n        f\"Request to chatocr-chat failed with status code {resp_chat.status_code}.\"\n    )\n    pprint.pp(resp_chat.json())\n    sys.exit(1)\nresult_chat = resp_chat.json()[\"result\"]\nprint(\"\\nPrompts:\")\npprint.pp(result_chat[\"prompts\"])\nprint(\"Final result:\")\nprint(result_chat[\"chatResult\"])\n
Note: Please fill in your API key and secret key at `API_KEY` and `SECRET_KEY`.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the PP-ChatOCRv3-doc Pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can attempt to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the PP-ChatOCRv3-doc Pipeline comprises six modules, unsatisfactory performance may stem from any of these modules (note that the text image rectification module does not support customization at this time).

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., row/column misidentification, cell position errors) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.

  • Misplaced layout elements (e.g., incorrect positioning of tables or seals) may suggest issues with the layout detection module. Consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.

  • Frequent undetected text (i.e., text leakage) may indicate limitations in the text detection model. Refer to the Customization section in the Text Detection Module Development Tutorial and fine-tune the text detection model using your private dataset.

  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest that the text recognition model requires improvement. Follow the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.

  • Frequent recognition errors in detected seal text indicate that the seal text detection model needs further refinement. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.

  • Frequent misidentifications of document or certificate orientations with text regions suggest that the document image orientation classification model requires improvement. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the document image orientation classification model.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#42-model-deployment","title":"4.2 Model Deployment","text":"

After fine-tuning your models using your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the default model weights with those of your fine-tuned models:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_3cls  # Replace with the local path of your fine-tuned model\n  table_model: SLANet_plus  # Replace with the local path of your fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Replace with the local path of your fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Replace with the local path of your fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det  # Replace with the local path of your fine-tuned model\n  doc_image_ori_cls_model: null   # Replace with the local path of your fine-tuned model if applicable\n  doc_image_unwarp_model: null   # Replace with the local path of your fine-tuned model if applicable\n......\n

Subsequently, load the modified pipeline configuration file using the command-line interface or Python script as described in the local experience section.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Seamless switching between different hardware can be achieved by simply setting the --device parameter.

For example, to perform inference using the PP-ChatOCRv3-doc Pipeline on an NVIDIA GPU. At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the script to npu:

from paddlex import create_pipeline\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"},\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n

If you want to use the PP-ChatOCRv3-doc Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html","title":"General OCR Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#1-introduction-to-ocr-pipeline","title":"1. Introduction to OCR Pipeline","text":"

OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols.

The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, reaching state-of-the-art (SOTA) performance in open-source projects for general scenarios. Based on this project, developers from academia, industry, and research have rapidly deployed various OCR applications across fields such as general use, manufacturing, finance, transportation, and more.

The General OCR Pipeline comprises a text detection module and a text recognition module, each containing several models. The specific models to use can be selected based on the benchmark data provided below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model size, choose models with smaller storage requirements.

Text detection module:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices

Text recognition module:

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the OCR Pipeline, allowing you to quickly experience its effects. You can try the General OCR Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General OCR Pipeline online using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. You can download the deployment package from the cloud or use the local experience method in Section 2.2. If not satisfied, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General OCR Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"
  • Experience the OCR Pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter explanations:

--pipeline: The name of the pipeline, here it is OCR.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default OCR Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config OCR\n

After execution, the OCR Pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path --device gpu:0\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./OCR.yaml, simply execute:

paddlex --pipeline ./OCR.yaml --input general_ocr_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [[[5, 12], [88, 10], [88, 29], [5, 31]], [[208, 14], [249, 14], [249, 22], [208, 22]], [[695, 15], [824, 15], [824, 60], [695, 60]], [[158, 27], [355, 23], [356, 70], [159, 73]], [[421, 25], [659, 19], [660, 59], [422, 64]], [[337, 104], [460, 102], [460, 127], [337, 129]], [[486, 103], [650, 100], [650, 125], [486, 128]], [[675, 98], [835, 94], [835, 119], [675, 124]], [[64, 114], [192, 110], [192, 131], [64, 134]], [[210, 108], [318, 106], [318, 128], [210, 130]], [[82, 140], [214, 138], [214, 163], [82, 165]], [[226, 136], [328, 136], [328, 161], [226, 161]], [[404, 134], [432, 134], [432, 161], [404, 161]], [[509, 131], [570, 131], [570, 158], [509, 158]], [[730, 138], [771, 138], [771, 154], [730, 154]], [[806, 136], [817, 136], [817, 146], [806, 146]], [[342, 175], [470, 173], [470, 197], [342, 199]], [[486, 173], [616, 171], [616, 196], [486, 198]], [[677, 169], [813, 166], [813, 191], [677, 194]], [[65, 181], [170, 177], [171, 202], [66, 205]], [[96, 208], [171, 205], [172, 230], [97, 232]], [[336, 220], [476, 215], [476, 237], [336, 242]], [[507, 217], [554, 217], [554, 236], [507, 236]], [[87, 229], [204, 227], [204, 251], [87, 254]], [[344, 240], [483, 236], [483, 258], [344, 262]], [[66, 252], [174, 249], [174, 271], [66, 273]], [[75, 279], [264, 272], [265, 297], [76, 303]], [[459, 297], [581, 295], [581, 320], [459, 322]], [[101, 314], [210, 311], [210, 337], [101, 339]], [[68, 344], [165, 340], [166, 365], [69, 368]], [[345, 350], [662, 346], [662, 368], [345, 371]], [[100, 459], [832, 444], [832, 465], [100, 480]]], 'dt_scores': [0.8183103704439653, 0.7609575621092027, 0.8662357274035412, 0.8619508290334809, 0.8495855993183273, 0.8676840017933314, 0.8807986687956436, 0.822308525056085, 0.8686617037621976, 0.8279022169854463, 0.952332847006758, 0.8742692553015098, 0.8477013022907575, 0.8528771493227294, 0.7622965906848765, 0.8492388224448705, 0.8344203789965632, 0.8078477124353284, 0.6300434587457232, 0.8359967356998494, 0.7618617265751318, 0.9481573079350023, 0.8712182945408912, 0.837416955846334, 0.8292475059403851, 0.7860382856406026, 0.7350527486717117, 0.8701022267947695, 0.87172526903969, 0.8779847108088126, 0.7020437651809734, 0.6611684983372949], 'rec_text': ['www.997', '151', 'PASS', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', '\u200b\u8231\u4f4d\u200b CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200bSEATNO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200bDATE', 'MU 2379', '03DEC', 'W', '035', 'F', '1', '\u200b\u59cb\u53d1\u5730\u200bFROM', '\u200b\u767b\u673a\u53e3\u200b GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO.', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO.', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE1OMINUTESBEFOREDEPARTURETIME'], 'rec_score': [0.9617719054222107, 0.4199012815952301, 0.9652514457702637, 0.9978302121162415, 0.9853208661079407, 0.9445787072181702, 0.9714463949203491, 0.9841841459274292, 0.9564052224159241, 0.9959094524383545, 0.9386572241783142, 0.9825271368026733, 0.9356589317321777, 0.9985442161560059, 0.3965512812137604, 0.15236201882362366, 0.9976775050163269, 0.9547433257102966, 0.9974752068519592, 0.9646636843681335, 0.9907559156417847, 0.9895358681678772, 0.9374122023582458, 0.9909093379974365, 0.9796401262283325, 0.9899340271949768, 0.992210865020752, 0.9478569626808167, 0.9982215762138367, 0.9924325942993164, 0.9941263794898987, 0.96443772315979]}\n......\n

Among them, dt_polys is the detected text box coordinates, dt_polys is the detected text box coordinates, dt_scores is the confidence of the detected text box, rec_text is the detected text, rec_score is the detection Confidence in the text.

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"
  • Quickly perform inference on the production line with just a few lines of code, taking the general OCR production line as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the OCR production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the OCR production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/OCR.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/OCR.yaml\")\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the general OCR pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain OCR results from an image.

POST /ocr

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. image string OCR result image with detected text positions annotated. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score.

Example of result:

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"Beijing South Railway Station\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"Tianjin Railway Station\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general OCR pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general OCR pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general OCR pipeline consists of two modules (text detection and text recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many texts are undetected (i.e., text miss detection), it may indicate that the text detection model needs improvement. You should refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model. If many recognition errors occur in detected texts (i.e., the recognized text content does not match the actual text content), it suggests that the text recognition model requires further refinement. You should refer to the Customization section in the Text Recognition Module Development Tutorial and fine-tune the text recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be replaced with the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be replaced with the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n

Then, refer to the command line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for OCR pipeline inference, the Python command would be:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline OCR --input general_ocr_002.png --device npu:0\n

If you want to use the General OCR pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html","title":"Formula Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#1-introduction-to-the-formula-recognition-pipeline","title":"1. Introduction to the Formula Recognition Pipeline","text":"

Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. Leveraging computer vision and machine learning algorithms, formula recognition converts complex mathematical formula information into editable LaTeX format, facilitating further data processing and analysis for users.

The Formula Recognition Pipeline comprises a layout detection module and a formula recognition module.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

Layout Detection Module Models:

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.126 3827.25 470.2M

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout detection dataset, containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the formula recognition pipeline through command line or Python locally.

Before using the formula recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the formula recognition pipeline with a single command, using the test file, and replace --input with your local path for prediction:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n

Parameter Explanation:

--pipeline: The pipeline name, which is formula_recognition for this case.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, use CPU (--device cpu).\n

When executing the above command, the default formula recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config formula_recognition\n

After execution, the formula recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config formula_recognition --save_path ./my_path\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./formula_recognition.yaml, simply execute:

paddlex --pipeline ./formula_recognition.yaml --input general_formula_recognition.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After execution, the result is:

\ud83d\udc49Click to Expand
{'input_path': 'general_formula_recognition.png', 'layout_result': {'input_path': 'general_formula_recognition.png', 'boxes': [{'cls_id': 3, 'label': 'number', 'score': 0.7580855488777161, 'coordinate': [1028.3635, 205.46213, 1038.953, 222.99033]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.8882032632827759, 'coordinate': [272.75305, 204.50894, 433.7473, 226.17996]}, {'cls_id': 2, 'label': 'text', 'score': 0.9685840606689453, 'coordinate': [272.75928, 282.17773, 1041.9316, 374.44687]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559416770935059, 'coordinate': [272.39056, 385.54114, 1044.1521, 443.8598]}, {'cls_id': 2, 'label': 'text', 'score': 0.9610629081726074, 'coordinate': [272.40817, 467.2738, 1045.1033, 563.4855]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8916195034980774, 'coordinate': [503.45743, 594.6236, 1040.6804, 619.73895]}, {'cls_id': 2, 'label': 'text', 'score': 0.973675549030304, 'coordinate': [272.32007, 648.8599, 1040.8702, 775.15686]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9038916230201721, 'coordinate': [554.2307, 803.5825, 1040.4657, 855.3159]}, {'cls_id': 2, 'label': 'text', 'score': 0.9025381803512573, 'coordinate': [272.535, 875.1402, 573.1086, 898.3587]}, {'cls_id': 2, 'label': 'text', 'score': 0.8336610794067383, 'coordinate': [317.48013, 909.60864, 966.8498, 933.7868]}, {'cls_id': 2, 'label': 'text', 'score': 0.8779091238975525, 'coordinate': [19.704018, 653.322, 72.433235, 1215.1992]}, {'cls_id': 2, 'label': 'text', 'score': 0.8832409977912903, 'coordinate': [272.13028, 958.50806, 1039.7928, 1019.476]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9088466167449951, 'coordinate': [517.1226, 1042.3978, 1040.2208, 1095.7457]}, {'cls_id': 2, 'label': 'text', 'score': 0.9587949514389038, 'coordinate': [272.03336, 1112.9269, 1041.0201, 1206.8417]}, {'cls_id': 2, 'label': 'text', 'score': 0.8885666131973267, 'coordinate': [271.7495, 1231.8752, 710.44495, 1255.7981]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8907185196876526, 'coordinate': [581.2295, 1287.4525, 1039.8014, 1312.772]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559596180915833, 'coordinate': [273.1827, 1341.421, 1041.0299, 1401.7255]}, {'cls_id': 2, 'label': 'text', 'score': 0.875311553478241, 'coordinate': [272.8338, 1427.3711, 789.7108, 1451.1359]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9152213931083679, 'coordinate': [524.9582, 1474.8136, 1041.6333, 1530.7142]}, {'cls_id': 2, 'label': 'text', 'score': 0.9584835767745972, 'coordinate': [272.81665, 1549.524, 1042.9962, 1608.7157]}]}, 'ocr_result': {}, 'table_result': [], 'dt_polys': [array([[ 503.45743,  594.6236 ],\n       [1040.6804 ,  594.6236 ],\n       [1040.6804 ,  619.73895],\n       [ 503.45743,  619.73895]], dtype=float32), array([[ 554.2307,  803.5825],\n       [1040.4657,  803.5825],\n       [1040.4657,  855.3159],\n       [ 554.2307,  855.3159]], dtype=float32), array([[ 517.1226, 1042.3978],\n       [1040.2208, 1042.3978],\n       [1040.2208, 1095.7457],\n       [ 517.1226, 1095.7457]], dtype=float32), array([[ 581.2295, 1287.4525],\n       [1039.8014, 1287.4525],\n       [1039.8014, 1312.772 ],\n       [ 581.2295, 1312.772 ]], dtype=float32), array([[ 524.9582, 1474.8136],\n       [1041.6333, 1474.8136],\n       [1041.6333, 1530.7142],\n       [ 524.9582, 1530.7142]], dtype=float32)], 'rec_formula': ['F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)', 'p(\\mathbf{x})=c(\\mathbf{u})\\prod_{i}p(x_{i}).\\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\quad~~\\quad~~~~~~~~~~~~~~~(2)', 'H_{c}({\\bf x})=-\\int_{{\\bf{u}}}c({\\bf{u}})\\log c({\\bf{u}})d{\\bf{u}}.~~~~~~~~~~~~~~~~~~~~~(3)', 'I({\\bf x})=-H_{c}({\\bf x}).\\qquad\\qquad\\qquad\\qquad(4)', 'H({\\bf x})=\\sum_{i}H(x_{i})+H_{c}({\\bf x}).\\eqno\\qquad\\qquad\\qquad(5)']}\n

Where dt_polys represents the coordinates of the detected formula area, and rec_formula is the detected formula.

The visualization result is as follows:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path. Formula recognition visualization requires a separate environment configuration. Please refer to 2.3 Formula Recognition Pipeline Visualization to install the LaTeX rendering engine.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"
  • Quickly perform inference on the pipeline with just a few lines of code, taking the formula recognition pipeline as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the formula recognition pipeline object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the formula recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the formula recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/formula_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/formula_recognition.yaml\")\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#23-formula-recognition-pipeline-visualization","title":"2.3 Formula Recognition Pipeline Visualization","text":"

If you need to visualize the formula recognition pipeline, you need to run the following command to install the LaTeX rendering environment:

apt-get install sudo\nsudo apt-get update\nsudo apt-get install texlive\nsudo apt-get install texlive-latex-base\nsudo apt-get install texlive-latex-extra\n
After that, use the save_to_img method to save the visualization image. The specific command is as follows:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
Note: Since the formula recognition visualization process requires rendering each formula image, it may take a relatively long time. Please be patient.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the formula recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the formula recognition pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain formula recognition results from an image.

POST /formula-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the layout detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description formulas array Positions and contents of formulas. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in formulas is an object with the following properties:

Name Type Description poly array Formula position. Elements in the array are the vertex coordinates of the polygon enclosing the formula. latex string Formula content.

Example of result:

{\n\"formulas\": [\n{\n\"poly\": [\n[\n444.0,\n244.0\n],\n[\n705.4,\n244.5\n],\n[\n705.8,\n311.3\n],\n[\n444.1,\n311.0\n]\n],\n\"latex\": \"F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)\"\n}\n],\n\"layoutImage\": \"xxxxxx\",\n\"ocrImage\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/formula-recognition\"\nimage_path = \"./demo.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected formulas:\")\nprint(result[\"formulas\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/formula-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto formulas = result[\"formulas\"];\n        std::cout << \"\\nDetected formulas:\" << std::endl;\n        for (const auto& formula : formulas) {\n            std::cout << formula << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/formula-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode formulas = result.get(\"formulas\");\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected formulas: \" + formulas.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/formula-recognition\"\n    imagePath := \"./demo.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            LayoutImage      string   `json:\"layoutImage\"`\n            Formulas []map[string]interface{} `json:\"formulas\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected formulas:\")\n    for _, formula := range respData.Result.Formulas {\n        fmt.Println(formula)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/formula-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected formulas:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"formulas\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/formula-recognition'\nconst imagePath = './demo.jpg'\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected formulas:\");\n    console.log(result[\"formulas\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/formula-recognition\"\n$image_path = \"./demo.jpg\";\n$layout_image_path = \"./layout.jpg\"\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected formulas:\\n\";\nprint_r($result[\"formulas\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the formula recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the formula recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the formula recognition pipeline consists of two modules (layout detection and formula recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many formula are undetected (i.e., formula miss detection), it may indicate that the layout detection model needs improvement. You should refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model. If many recognition errors occur in detected formula (i.e., the recognized formula content does not match the actual formula content), it suggests that the formula recognition model requires further refinement. You should refer to the Customization section in the Formula Recognition Module Development Tutorial and fine-tune the formula recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_17cls # Can be replaced with the local path of the fine-tuned layout detection model\n  formula_rec_model: LaTeX_OCR_rec # Can be replaced with the local path of the fine-tuned formula recognition model\n  formula_rec_batch_size: 5\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in 2. Quick Start to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for formula pipeline inference, the Python command would be:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device npu:0\n

If you want to use the formula recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html","title":"General Layout Parsing Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#1-introduction-to-the-general-layout-parsing-pipeline","title":"1. Introduction to the General Layout Parsing Pipeline","text":"

Layout parsing is a technology that extracts structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has extensive applications in document management, information extraction, and data digitization. By combining Optical Character Recognition (OCR), image processing, and machine learning algorithms, layout parsing can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. The process typically involves three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data to improve data processing efficiency and accuracy.

The General Layout Parsing Pipeline includes modules for table structure recognition, layout region analysis, text detection, text recognition, formula recognition, seal text detection, text image rectification, and document image orientation classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effect of the General Image Classification pipeline online, or locally using command line or Python.

Before using the General Layout Parsing pipeline locally, please ensure you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

One command is all you need to quickly experience the effect of the Layout Parsing pipeline. Use the test file and replace --input with your local path to make predictions.

paddlex --pipeline layout_parsing --input demo_paper.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the Layout Parsing pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default Layout Parsing pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config layout_parsing\n

After execution, the layout parsing pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config layout_parsing --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it take effect. For example, if the configuration file is saved as ./layout_parsing.yaml, simply execute:

paddlex --pipeline ./layout_parsing.yaml --input layout_parsing.jpg\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

\ud83d\udc49Click to expand
{'input_path': PosixPath('/root/.paddlex/temp/tmp5jmloefs.png'), 'parsing_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmpshsq8_w0.png'), 'layout_bbox': [51.46833, 74.22329, 542.4082, 232.77504], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [213, 221, 238],\n        [217, 223, 240],\n        [233, 234, 241]],\n\n       [[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpcd2q9uyu.png'), 'layout_bbox': [47.68295, 243.08054, 546.28253, 295.71045], 'figure_title': 'Overview of RT-DETR, We feed th', 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpr_iqa8b3.png'), 'layout_bbox': [58.416977, 304.1531, 275.9134, 400.07513], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmphpblxl3p.png'), 'layout_bbox': [100.62961, 405.97458, 234.79774, 414.77414], 'figure_title': 'Figure 5. The fusion block in CCFF.', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmplgnczrsf.png'), 'layout_bbox': [47.81724, 421.9041, 288.01566, 550.538], 'text': 'D, Ds, not only significantly reduces latency (35% faster),\\nRut\\nnproves accuracy (0.4% AP higher), CCFF is opti\\nased on the cross-scale fusion module, which\\nnsisting of convolutional lavers intc\\npath.\\nThe role of the fusion block is t\\n into a new feature, and its\\nFigure 5. The f\\nblock contains tw\\n1 x1\\nchannels, /V RepBlock\\n. anc\\n: two-path outputs are fused by element-wise add. We\\ntormulate the calculation ot the hvbrid encoder as:', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpsq0ey9md.png'), 'layout_bbox': [94.60716, 558.703, 288.04193, 600.19434], 'formula': '\\\\begin{array}{l}{{\\\\Theta=K=\\\\mathrm{p.s.sp{\\\\pm}}\\\\mathrm{i.s.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}}),{\\\\qquad\\\\mathrm{{a.s.}}\\\\mathrm{s.}}}\\\\\\\\ {{\\\\tau_{\\\\mathrm{{s.s.s.s.s.}}(\\\\mathrm{l.s.},\\\\mathrm{l.s.},\\\\mathrm{s.s.}}\\\\mathrm{s.}\\\\mathrm{s.}}\\\\end{array}),}}\\\\\\\\ {{\\\\bar{\\\\mathrm{e-c.c.s.s.}(\\\\mathrm{s.},\\\\mathrm{s.s.},\\\\ s_{s}}\\\\mathrm{s.s.},\\\\tau),}}\\\\end{array}', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpv30qy0v4.png'), 'layout_bbox': [47.975555, 607.12024, 288.5776, 629.1252], 'text': 'tened feature to the same shape as Ss.\\nwhere Re shape represents restoring the shape of the flat-', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp0jejzwwv.png'), 'layout_bbox': [48.383354, 637.581, 245.96404, 648.20496], 'paragraph_title': '4.3. Uncertainty-minimal Query Selection', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpushex416.png'), 'layout_bbox': [47.80134, 656.002, 288.50192, 713.24994], 'text': 'To reduce the difficulty of optimizing object queries in\\nDETR, several subsequent works [42, 44, 45] propose query\\nselection schemes, which have in common that they use the\\nconfidence score to select the top K\u2019 features from the en-\\ncoder to initialize object queries (or just position queries).', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpki7e_6wc.png'), 'layout_bbox': [306.6371, 302.1026, 546.3772, 419.76724], 'text': 'The confidence score represents the likelihood that the fea\\nture includes foreground objects. Nevertheless, the \\nare required to simultaneously model the category\\nojects, both of which determine the quality of the\\npertor\\ncore of the fes\\nBased on the analysis, the current query\\n considerable level of uncertainty in the\\nresulting in sub-optimal initialization for\\nand hindering the performance of the detector.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmppbxrfehp.png'), 'layout_bbox': [306.0642, 422.7347, 546.9216, 539.45734], 'text': 'To address this problem, we propose the uncertainty mini\\nmal query selection scheme, which explicitly const\\noptim\\n the epistemic uncertainty to model the\\nfeatures, thereby providing \\nhigh-quality\\nr the decoder. Specifically,\\n the discrepancy between i\\nalization P\\nand classificat\\n.(2\\ntunction for the gradie', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp1mgiyd21.png'), 'layout_bbox': [331.52808, 549.32635, 546.5229, 586.15546], 'formula': '\\\\begin{array}{c c c}{{}}&{{}}&{{\\\\begin{array}{c}{{i\\\\langle X\\\\rangle=({\\\\bar{Y}}({\\\\bar{X}})+{\\\\bar{Z}}({\\\\bar{X}})\\\\mid X\\\\in{\\\\bar{\\\\pi}}^{\\\\prime}}}&{{}}\\\\\\\\ {{}}&{{}}&{{}}\\\\end{array}}}&{{\\\\emptyset}}\\\\\\\\ {{}}&{{}}&{{C(\\\\bar{X},{\\\\bar{X}})=C..\\\\scriptstyle(\\\\bar{0},{\\\\bar{Y}})+{\\\\mathcal{L}}_{{\\\\mathrm{s}}}({\\\\bar{X}}),\\\\ 6)}}&{{}}\\\\end{array}', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp8t73dpym.png'), 'layout_bbox': [306.44016, 592.8762, 546.84314, 630.60126], 'text': 'where  and y denote the prediction and ground truth,\\n= (c, b), c and b represent the category and bounding\\nbox respectively, X represent the encoder feature.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpftnxeyjm.png'), 'layout_bbox': [306.15652, 632.3142, 546.2463, 713.19073], 'text': 'Effectiveness analysis. To analyze the effectiveness of the\\nuncertainty-minimal query selection, we visualize the clas-\\nsificatior\\nscores and IoU scores of the selected fe\\nCOCO\\na 12017, Figure 6. We draw the scatterplo\\nt with\\ndots\\nrepresent the selected features from the model trained\\nwith uncertainty-minimal query selection and vanilla query', 'layout': 'right'}]}\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking the general layout parsing pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"layout_parsing\")\n\noutput = pipeline.predict(\"demo_paper.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result as an image file\n    res.save_to_xlsx(\"./output/\")  # Save the result as an Excel file\n    res.save_to_html(\"./output/\")  # Save the result as an HTML file\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, e.g., [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving as files, with the supported file types depending on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves the result as an image file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name. save_to_html Saves the result as an HTML file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

| save_to_xlsx | Saves the result as an Excel file. | - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

Within this tutorial on Artificial Intelligence and Computer Vision, we will explore the capabilities of saving and exporting results from various processes, including OCR (Optical Character Recognition), layout analysis, and table structure recognition. Specifically, the save_to_img function enables saving visualization results, save_to_html converts tables directly into HTML files, and save_to_xlsx exports tables as Excel files.

Upon obtaining the configuration file, you can customize various settings for the layout parsing pipeline by simply modifying the pipeline parameter within the create_pipeline method to point to your configuration file path.

For instance, if your configuration file is saved at ./my_path/layout_parsing.yaml, you can execute the following code:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/layout_parsing.yaml\")\noutput = pipeline.predict(\"layout_parsing.jpg\")\nfor res in output:\n    res.print()  # Prints the structured output of the layout parsing prediction\n    res.save_to_img(\"./output/\")  # Saves the img format results from each submodule of the pipeline\n    res.save_to_xlsx(\"./output/\")  # Saves the xlsx format results from the table recognition module\n    res.save_to_html(\"./output/\")  # Saves the html results from the table recognition module\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements in terms of inference speed and accuracy, you can proceed with development integration or deployment.

To directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX offers three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In production environments, many applications require stringent performance metrics, especially response speed, to ensure efficient operation and smooth user experience. PaddleX provides a high-performance inference plugin that deeply optimizes model inference and pre/post-processing for significant end-to-end speedups. For detailed instructions on high-performance inference, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service Deployment: Service deployment is a common form in production environments, where reasoning functions are encapsulated as services accessible via network requests. PaddleX enables cost-effective service deployment of pipelines. For detailed instructions on service deployment, refer to the PaddleX Service Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body attributes are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result attribute, of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body attributes are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs layout parsing.

POST /layout-parsing

  • Request body attributes:
Name Type Description Required file string The URL of an image file or PDF file accessible by the service, or the Base64 encoded result of the content of the above-mentioned file types. For PDF files with more than 10 pages, only the content of the first 10 pages will be used. Yes fileType integer File type. 0 indicates a PDF file, 1 indicates an image file. If this attribute is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This function is enabled by default. No useImgUnwrapping boolean Whether to enable text image rectification. This function is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This function is enabled by default. No inferenceParams object Inference parameters. No

Attributes of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following attributes:
Name Type Description layoutParsingResults array Layout parsing results. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file.

Each element in layoutParsingResults is an object with the following attributes:

Name Type Description layoutElements array Layout element information.

Each element in layoutElements is an object with the following attributes:

Name Type Description bbox array Position of the layout element. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. label string Label of the layout element. text string Text contained in the layout element. layoutType string Arrangement of the layout element. image string Image of the layout element, in JPEG format, encoded using Base64. Multi-language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/layout-parsing\" # \u200b\u670d\u52a1\u200bURL\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": image_data, # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u6587\u4ef6\u200bURL\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(\"\\nDetected layout elements:\")\nfor res in result[\"layoutParsingResults\"]:\n    for ele in res[\"layoutElements\"]:\n        print(\"===============================\")\n        print(\"bbox:\", ele[\"bbox\"])\n        print(\"label:\", ele[\"label\"])\n        print(\"text:\", repr(ele[\"text\"]))\n

\ud83d\udcf1 Edge Deployment: Edge deployment refers to placing computational and data processing capabilities directly on user devices, enabling them to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general layout parsing pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general layout parsing pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general layout parsing pipeline consists of 7 modules, unsatisfactory performance may stem from any of these modules.

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., wrong row/column recognition, incorrect cell positions) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.
  • Misplaced layout elements (e.g., incorrect positioning of tables, seals) may suggest issues with the layout detection module. You should consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.
  • Frequent undetected texts (i.e., text missing detection) indicate potential weaknesses in the text detection model. Follow the Customization section in the Text Detection Module Development Tutorial to fine-tune the text detection model using your private dataset.
  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest further improvements to the text recognition model. Refer to the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.
  • Frequent recognition errors in detected seal texts indicate the need for improvements to the seal text detection model. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.
  • High recognition errors in detected formulas (i.e., recognized formula content does not match the actual formula) suggest further enhancements to the formula recognition model. Follow the Customization section in the Formula Recognition Module Development Tutorial to fine-tune the formula recognition model.
  • Frequent misclassifications of document or certificate orientations with text areas indicate the need for improvements to the document image orientation classification model. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the model.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet_plus  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned model\n  formula_rec_model: LaTeX_OCR_rec  # Can be modified to the local path of the fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det   # Can be modified to the local path of the fine-tuned model\n  doc_image_unwarp_model: UVDoc  # Can be modified to the local path of the fine-tuned model\n  doc_image_ori_cls_model: PP-LCNet_x1_0_doc_ori  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script methods in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the layout parsing pipeline, the Python command is:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, simply modify --device to npu in the Python command:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device npu:0\n
If you want to use the general layout parsing pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html","title":"Seal Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#1-introduction-to-the-seal-recognition-pipeline","title":"1. Introduction to the Seal Recognition Pipeline","text":"

Seal recognition is a technology that automatically extracts and recognizes seal content from documents or images. The recognition of seal is part of document processing and has various applications in many scenarios, such as contract comparison, inventory access approval, and invoice reimbursement approval.

The Seal Recognition pipeline includes a layout area analysis module, a seal detection module, and a text recognition module.

If you prioritize model accuracy, please choose a model with higher accuracy. If you prioritize inference speed, please choose a model with faster inference. If you prioritize model storage size, please choose a model with a smaller storage footprint.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

Model NameModel Download Link Average Recognition Accuracy (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy indicators is a self-built Chinese dataset from PaddleOCR, covering various scenarios such as street scenes, web images, documents, and handwriting. The text recognition subset includes 11,000 images. The GPU inference time for all models above is based on an NVIDIA Tesla T4 machine with a precision type of FP32. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads, and the precision type is also FP32.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre trained model production line provided by PaddleX can quickly experience the effect. You can experience the effect of the seal recognition production line online, or use the command line or Python locally to experience the effect of the seal recognition production line.

Before using the seal recognition production line locally, please ensure that you have completed the wheel package installation of PaddleX according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#21-command-line-experience","title":"2.1 Command line experience","text":"

One command can quickly experience the effect of seal recognition production line, use test file, and replace --input with the local path for prediction

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

Parameter description:

--Pipeline: Production line name, here is the seal recognition production line\n--Input: The local path or URL of the input image to be processed\n--The GPU serial number used by the device (e.g. GPU: 0 indicates the use of the 0th GPU, GPU: 1,2 indicates the use of the 1st and 2nd GPUs), or the CPU (-- device CPU) can be selected for use\n

When executing the above Python script, the default seal recognition production line configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config seal_recognition\n

After execution, the seal recognition production line configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config seal_recognition --save_path ./my_path --save_path output\n

After obtaining the production line configuration file, you can replace '-- pipeline' with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is / seal_recognition.yaml\uff0c Just need to execute:

paddlex --pipeline ./seal_recognition.yaml --input seal_text_det.png --save_path output\n

Among them, parameters such as --model and --device do not need to be specified and will use the parameters in the configuration file. If the parameters are still specified, the specified parameters will prevail.

After running, the result obtained is:

\ud83d\udc49 Click to expand
{'input_path': 'seal_text_det.png', 'layout_result': {'input_path': 'seal_text_det.png', 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9813116192817688, 'coordinate': [0, 5.2238655, 639.59766, 637.6985]}]}, 'ocr_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmp19fn93y5.png'), 'dt_polys': [array([[468, 469],\n       [472, 469],\n       [477, 471],\n       [507, 501],\n       [509, 505],\n       [509, 509],\n       [508, 513],\n       [506, 514],\n       [456, 553],\n       [454, 555],\n       [391, 581],\n       [388, 581],\n       [309, 590],\n       [306, 590],\n       [234, 577],\n       [232, 577],\n       [172, 548],\n       [170, 546],\n       [121, 504],\n       [118, 501],\n       [118, 496],\n       [119, 492],\n       [121, 490],\n       [152, 463],\n       [156, 461],\n       [160, 461],\n       [164, 463],\n       [202, 495],\n       [252, 518],\n       [311, 530],\n       [371, 522],\n       [425, 501],\n       [464, 471]]), array([[442, 439],\n       [445, 442],\n       [447, 447],\n       [449, 490],\n       [448, 494],\n       [446, 497],\n       [440, 499],\n       [197, 500],\n       [193, 499],\n       [190, 496],\n       [188, 491],\n       [188, 448],\n       [189, 444],\n       [192, 441],\n       [197, 439],\n       [438, 438]]), array([[465, 341],\n       [470, 344],\n       [472, 346],\n       [476, 356],\n       [476, 419],\n       [475, 424],\n       [472, 428],\n       [467, 431],\n       [462, 433],\n       [175, 434],\n       [170, 433],\n       [166, 430],\n       [163, 426],\n       [161, 420],\n       [161, 354],\n       [162, 349],\n       [165, 345],\n       [170, 342],\n       [175, 340],\n       [460, 340]]), array([[326,  34],\n       [481,  85],\n       [485,  88],\n       [488,  90],\n       [584, 220],\n       [586, 225],\n       [587, 229],\n       [589, 378],\n       [588, 383],\n       [585, 388],\n       [581, 391],\n       [576, 393],\n       [570, 392],\n       [507, 373],\n       [502, 371],\n       [498, 367],\n       [496, 359],\n       [494, 255],\n       [423, 162],\n       [322, 129],\n       [246, 151],\n       [205, 169],\n       [144, 252],\n       [139, 360],\n       [137, 365],\n       [134, 369],\n       [128, 373],\n       [ 66, 391],\n       [ 61, 392],\n       [ 56, 390],\n       [ 51, 387],\n       [ 48, 382],\n       [ 47, 377],\n       [ 49, 230],\n       [ 50, 225],\n       [ 52, 221],\n       [149,  89],\n       [153,  86],\n       [157,  84],\n       [318,  34],\n       [322,  33]])], 'dt_scores': [0.9943362380813267, 0.9994290391836306, 0.9945320407374245, 0.9908104427126033], 'rec_text': ['5263647368706', '\u200b\u5417\u200b\u7e41\u7269\u200b', '\u200b\u53d1\u7968\u200b\u4e13\u7528\u7ae0\u200b', '\u200b\u5929\u6d25\u200b\u541b\u548c\u7f18\u200b\u5546\u8d38\u200b\u6709\u9650\u516c\u53f8\u200b'], 'rec_score': [0.9921098351478577, 0.997374951839447, 0.9999369382858276, 0.9901710152626038]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code can complete the fast inference of the production line. Taking the seal recognition production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"seal_recognition\")\n\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\") # Save the results in img\n

The result obtained is the same as the command line method.

In the above Python script, the following steps were executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images).

If you have a configuration file, you can customize the configurations of the seal recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved in / my_path/seal_recognition.yaml \uff0c Then only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/seal_recognition.yaml\")\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#3-development-integrationdeployment","title":"3. Development integration/deployment","text":"

If the production line can meet your requirements for inference speed and accuracy, you can directly develop integration/deployment.

If you need to directly apply the production line to your Python project, you can refer to the example code in [2.2.2 Python scripting] (# 222 python scripting integration).

In addition, PaddleX also offers three other deployment methods, detailed as follows:

\ud83d\ude80 ** High performance deployment: In actual production environments, many applications have strict standards for the performance indicators of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deep performance optimization of model inference and pre-processing, achieving significant acceleration of end-to-end processes. For a detailed high-performance deployment process, please refer to the [PaddleX High Performance Deployment Guide] (../../../pipelin_deploy/high_performance_deploy. md).

\u2601\ufe0f ** Service deployment * *: Service deployment is a common form of deployment in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users to achieve service-oriented deployment of production lines at low cost. For detailed service-oriented deployment processes, please refer to the PaddleX Service Deployment Guide (../../../ipeline_deploy/service_deploy. md).

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Obtain seal recognition results from an image.

POST /seal-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/seal-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/seal-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/seal-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/seal-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/seal-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/seal-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/seal-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#4-secondary-development","title":"4. Secondary development","text":"

If the default model weights provided by the seal recognition production line are not satisfactory in terms of accuracy or speed in your scenario, you can try using your own specific domain or application scenario data to further fine tune the existing model to improve the recognition performance of the seal recognition production line in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#41-model-fine-tuning","title":"4.1 Model fine-tuning","text":"

Due to the fact that the seal recognition production line consists of three modules, the performance of the model production line may not be as expected due to any of these modules.

You can analyze images with poor recognition performance and refer to the following rules for analysis and model fine-tuning:

  • If the seal area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If there is a significant amount of text that has not been detected (i.e. text miss detection phenomenon), it may be due to the shortcomings of the text detection model. You need to refer to the Secondary Development section in the Seal Text Detection Module Development Tutorial to fine tune the text detection model using your private dataset.
  • If seal texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.

  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After completing fine-tuning training using a private dataset, you can obtain a local model weight file.

If you need to use the fine tuned model weights, simply modify the production line configuration file and replace the local path of the fine tuned model weights with the corresponding position in the production line configuration file

......\n Pipeline:\n  layout_model: RT-DETR-H_layout_3cls #can be modified to the local path of the fine tuned model\n  text_det_model: PP-OCRv4_server_seal_det  #can be modified to the local path of the fine tuned model\n  text_rec_model: PP-OCRv4_server_rec #can be modified to the local path of the fine tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#5-multiple-hardware-support","title":"5. Multiple hardware support","text":"

PaddleX supports various mainstream hardware devices such as Nvidia GPU, Kunlun Core XPU, Ascend NPU, and Cambrian MLU, and can seamlessly switch between different hardware devices by simply modifying the --device parameter.

For example, if you use Nvidia GPU for inference on a seal recognition production line, the Python command you use is:

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

At this point, if you want to switch the hardware to Ascend NPU, simply modify the --device in the Python command to NPU:

paddlex --pipeline seal_recognition --input seal_text_det.png --device npu:0 --save_path output\n

If you want to use the seal recognition production line on a wider range of hardware, please refer to the PaddleX Multi Hardware Usage Guide\u3002

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html","title":"General Table Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#1-introduction-to-the-general-table-recognition-pipeline","title":"1. Introduction to the General Table Recognition Pipeline","text":"

Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis for users.

The General Table Recognition Pipeline comprises modules for table structure recognition, layout analysis, text detection, and text recognition.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

\ud83d\udc49Model List Details

Table Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are measured on PaddleX's internal self-built English table recognition dataset. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout analysis dataset containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

Model NameModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.2 M PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 100.1M"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Image Classification pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Table Recognition pipeline by using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Table Recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the effects of the table recognition pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the table recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the 1st and 2nd GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default table recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config table_recognition\n

After execution, the table recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config table_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./table_recognition.yaml, simply execute:

paddlex --pipeline ./table_recognition.yaml --input table_recognition.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file. If they are still specified, the specified parameters will take precedence.

After running, the result is:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference with the pipeline. Taking the General Table Recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"table_recognition\")\n\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the results in img format\n    res.save_to_xlsx(\"./output/\")  # Save the results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
The results are the same as those obtained through the command line.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_html Save the results as an html format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_xlsx Save the results as a spreadsheet format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images, table structure recognition result images), save_to_html can directly save the table as an html file (including text and table formatting), and save_to_xlsx can save the table as an Excel format file (including text and formatting).

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/table_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/table_recognition.yaml\")\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save results in img format\n    res.save_to_xlsx(\"./output/\")  # Save results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Locate and recognize tables in images.

POST /table-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description tables array Positions and contents of tables. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table position. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. html string Table recognition result in HTML format. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/table-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected tables:\")\nprint(result[\"tables\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/table-recognition\", headers, body, \"application/json\");\n\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedlayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto tables = result[\"tables\"];\n        std::cout << \"\\nDetected tables:\" << std::endl;\n        for (const auto& table : tables) {\n            std::cout << table << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/table-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode tables = result.get(\"tables\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected tables: \" + tables.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/table-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Tables []map[string]interface{} `json:\"tables\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected tables:\")\n    for _, table := range respData.Result.Tables {\n        fmt.Println(table)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/table-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected tables:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"tables\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/table-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected tables:\");\n    console.log(result[\"tables\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/table-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected tables:\\n\";\nprint_r($result[\"tables\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general table recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general table recognition pipeline consists of four modules, unsatisfactory performance may stem from any of these modules.

Analyze images with poor recognition results and follow the rules below for analysis and model fine-tuning:

  • If the detected table structure is incorrect (e.g., row and column recognition errors, incorrect cell positions), the table structure recognition module may be insufficient. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and use your private dataset to fine-tune the table structure recognition model.
  • If the table area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If many texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.
  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_mobile_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_mobile_rec  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script method in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for table recognition pipeline inference, the Python command is:

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
At this time, if you want to switch the hardware to Ascend NPU, simply modify --device in the Python command to npu:

paddlex --pipeline table_recognition --input table_recognition.jpg --device npu:0\n
If you want to use the general table recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#1-introduction-to-the-general-time-series-anomaly-detection-pipeline","title":"1. Introduction to the General Time Series Anomaly Detection Pipeline","text":"

Time series anomaly detection is a technique for identifying abnormal patterns or behaviors in time series data. It is widely applied in fields such as network security, equipment monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly deviate from expected behaviors, such as sudden spikes in network traffic or unusual transaction activities. Time series anomaly detection enable automatic identification of anomalies in data. This technology provides real-time alerts for enterprises and organizations, helping them promptly address potential risks and issues. It plays a crucial role in ensuring system stability and security.

The General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module. If you prioritize model accuracy, choose a model with higher precision. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage footprint.

Model NameModel Download Link Precision Recall F1-Score Model Storage Size (M) AutoEncoder_adInference Model/Trained Model 99.36 84.36 91.25 52K DLinear_adInference Model/Trained Model 98.98 93.96 96.41 112K Nonstationary_adInference Model/Trained Model 98.55 88.95 93.51 1.8M PatchTST_adInference Model/Trained Model 98.78 90.70 94.57 320K TimesNet_adInference Model/Trained Model 98.37 94.80 96.56 1.3M

Note: The above precision metrics are measured on the PSM dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Anomaly Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Anomaly Detection Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online experience of time series tasks are only model solutions for a specific scenario and are not universal. They are not applicable to other scenarios. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Anomaly Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the effects of the time series anomaly detection pipeline:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_ad --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_ad.yaml --input ts_ad.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'ts_ad.csv', 'anomaly':            label\ntimestamp\n220226         0\n220227         0\n220228         0\n220229         0\n220230         0\n...          ...\n220317         1\n220318         1\n220319         1\n220320         1\n220321         0\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general time series anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_ad\")\n\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the result in CSV format\n

The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_csv Saves results as a csv file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_xlsx Saves results as table file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_ad.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_ad.yaml\")\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs time-series anomaly detection.

POST /time-series-anomaly-detection

  • Attributes of the request body:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string Time-series anomaly detection results in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-anomaly-detection\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-anomaly-detection\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-anomaly-detection'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Anomaly Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Modules Development Tutorial to fine-tune the time series anomaly detection model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear_ad  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the time series anomaly detection pipeline, the Python command is:

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_ad --input ts_ad.csv --device npu:0\n
If you want to use the General Time-Series Anomaly Detection Pipeline on more diverse hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html","title":"Time Series Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#1-introduction-to-general-time-series-classification-pipeline","title":"1. Introduction to General Time Series Classification Pipeline","text":"

Time series classification is a technique that categorizes time-series data into predefined classes, widely applied in fields such as behavior recognition and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, for example, classifying a speech signal as \"greeting\" or \"request,\" or categorizing stock price movements as \"rising\" or \"falling.\" Time series classification typically employs machine learning and deep learning models, effectively capturing temporal dependencies and variation patterns to provide accurate classification labels for data. This technology plays a pivotal role in applications such as intelligent monitoring and market forecasting.

The General Time Series Classification Pipeline includes a Time Series Classification module.

Model NameModel Download Link Acc(%) Model Size (M) TimesNet_clsInference Model/Trained Model 87.5 792K

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Time Series Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Classification Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in model for online experience of time series tasks is only a model solution for a specific scenario and is not a general solution applicable to other scenarios. Therefore, the experience method does not support using arbitrary files to experience the effect of the official model solution. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the effects of the time series classification pipeline quickly with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series classification pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default time series classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_yaml ts_cls\n

After execution, the time series classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config ts_cls --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_cls.yaml --input ts_cls.csv --device gpu:0\n

In this command, parameters such as --model and --device are not required to be specified, as they will use the parameters defined in the configuration file. If these parameters are specified, the specified values will take precedence.

After execution, the result is:

{'input_path': 'ts_cls.csv', 'classification':         classid     score\nsample\n0             0  0.617688}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete rapid inference for production lines. Taking the General Time Series Classification Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_cls\")\n\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n

The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference. Available only if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_cls.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_cls.yaml\")\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Classify time-series data.

POST /time-series-classification

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description label string Class label. score number Class score.

An example of result is as follows:

{\n\"label\": \"running\",\n\"score\": 0.97\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-classification\"\ncsv_path = \"./test.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(f\"label: {result['label']}, score: {result['score']}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n        std::cout << \"label: \" << result[\"label\"] << \", score: \" << result[\"score\"] << std::endl;\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-classification\";\n        String csvPath = \"./test.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                System.out.println(\"label: \" + result.get(\"label\").asText() + \", score: \" + result.get(\"score\").asText());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-classification\"\n    csvPath := \"./test.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Label string `json:\"label\"`\n            Score string `json:\"score\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    fmt.Printf(\"label: %s, score: %s\\n\", respData.Result.Label, respData.Result.Score)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-classification\";\n    static readonly string csvPath = \"./test.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csveBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csveBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string label = jsonResponse[\"result\"][\"label\"].ToString();\n        string score = jsonResponse[\"result\"][\"score\"].ToString();\n        Console.WriteLine($\"label: {label}, score: {score}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-classification'\nconst csvPath = \"./test.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    console.log(`label: ${result[\"label\"]}, score: ${result[\"score\"]}`);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-classification\";\n$csv_path = \"./test.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\necho \"label: \" . $result[\"label\"] . \", score: \" . $result[\"score\"];\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures. Choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Classification Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Classification Pipeline includes a time series classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Classification Module Tutorial to fine-tune the time series classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: TimesNet_cls  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for time series classification pipeline inference, the Python command is:

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command as follows:\n\n```bash\npaddlex --pipeline ts_cls --input ts_cls.csv --device npu:0\n

If you intend to use the General Time Series Classification Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html","title":"Time Series Forecasting Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#1-introduction-to-the-general-time-series-forecasting-pipeline","title":"1. Introduction to the General Time Series Forecasting Pipeline","text":"

Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing the patterns of change in time series data. It is widely applied in fields such as financial markets, weather forecasting, and sales prediction. Time series forecasting often employs statistical methods or deep learning models (e.g., LSTM, ARIMA), capable of handling temporal dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in various industries, including energy management, supply chain optimization, and market analysis.

The General Time Series Forecasting Pipeline includes a time series forecasting module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link MSE MAE Model Storage Size (M) DLinearInference Model/Trained Model 0.382 0.394 72K NLinearInference Model/Trained Model 0.386 0.392 40K NonstationaryInference Model/Trained Model 0.600 0.515 55.5 M PatchTSTInference Model/Trained Model 0.385 0.397 2.0M RLinearInference Model/Trained Model 0.384 0.392 40K TiDEInference Model/Trained Model 0.405 0.412 31.7M TimesNetInference Model/Trained Model 0.417 0.431 4.9M

Note: The above accuracy metrics are measured on ETTH1. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Forecasting Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Time Series Forecasting Pipeline online using the demo provided by the official team, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online time series tasks are scenario-specific and not universal. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model with your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Forecasting Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the time series forecasting pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series forecasting pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_fc --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_fc.yaml, simply execute:

paddlex --pipeline ./ts_fc.yaml --input ts_fc.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'ts_fc.csv', 'forecast':                            OT\ndate\n2018-06-26 20:00:00  9.586131\n2018-06-26 21:00:00  9.379762\n2018-06-26 22:00:00  9.252275\n2018-06-26 23:00:00  9.249993\n2018-06-27 00:00:00  9.164998\n...                       ...\n2018-06-30 15:00:00  8.830340\n2018-06-30 16:00:00  9.291553\n2018-06-30 17:00:00  9.097666\n2018-06-30 18:00:00  8.905430\n2018-06-30 19:00:00  8.993793\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the production line. Taking the general time series prediction production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_fc\")\n\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the results in CSV format\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the production line supports high-performance inference. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_fc.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_fc.yaml\")\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Performs time-series forecasting.

POST /time-series-forecasting

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string The time-series forecasting result in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-forecasting\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-forecasting\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-forecasting\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-forecasting\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-forecasting\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-forecasting'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-forecasting\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Forecasting Pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Forecasting Pipeline includes a time series forecasting module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Forecasting Module Development Tutorial and use your private dataset to fine-tune the time series forecasting model.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 0\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the time series forecasting pipeline, the Python command would be:

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_fc --input ts_fc.csv --device npu:0\n
If you want to use the General Time Series Forecasting Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html","title":"Anomaly detection tutorial","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#paddlex-30","title":"PaddleX 3.0 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4ee5\u4e0b\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u98df\u54c1\u200b\u699b\u5b50\u200b\u5916\u89c2\u200b\u5f02\u5e38\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08\u200b\u94c1\u4e1d\u7f51\u200b \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 1 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b STFPM 96.2 - - 21.5 M STFPM.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b **MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002**

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 391\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 70\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff1a-o Train.epochs_iters=5000\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 4000\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 1\u3002
  2. \u200b\u57fa\u4e8e\u200b STFPM \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.01\uff0c0.1\uff0c0.4\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.4\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\u5230\u200b5000\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u8fbe\u5230\u200b\u66f4\u4f18\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 4000 0.01 1 4\u200b\u5361\u200b 0.9646 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 4000 0.1 1 4\u200b\u5361\u200b 0.9707 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 5000 0.4 1 4\u200b\u5361\u200b 0.9826

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200buad_hazelnut.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/anomaly_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200boutput/best_model/inference\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html","title":"Anomaly detection tutorial en","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#paddlex-30-image-anomaly-detection-pipeline-food-appearance-quality-inspection-tutorial","title":"PaddleX 3.0 Image Anomaly Detection Pipeline \u2014 Food Appearance Quality Inspection Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a Food Appearance Quality Inspection task.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For Food Appearance Quality Inspection, this falls under the category of anomaly detection tasks, corresponding to PaddleX's Image Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers 1 ways to experience the pipeline: one is through the PaddleX wheel package locally.

  • Local Experience:
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 1 end-to-end anomaly detection models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) yaml file STFPM 96.2 - - 21.5 M STFPM.yaml

Note: The above accuracy metrics are measured on the MVTec AD dataset.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Food Appearance Quality Inspection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX anomaly detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 391;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 70;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 4000 and the batch size at 1.
  2. Initiate three experiments based on the STFPM model, with learning rates of: 0.01, 0.1, 0.4.
  3. It can be observed that the configuration with the highest accuracy in Experiment 3 is a learning rate of 0.4. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 5000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 4000 0.01 1 4 0.9646 Experiment 2 4000 0.1 1 4 0.9707 Experiment 3 4000 0.4 1 4 0.9797

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 3 4000 0.4 1 4 0.9797 Experiment 3 with more epochs 5000 0.4 1 4 0.9826

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

The prediction results will be generated under ./output, where the prediction result for uad_hazelnut.png is shown below:

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the anomaly detection pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/anomaly_detection.yaml configuration file to your own model path output/best_model/inference:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to Anomaly Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/deployment_tutorial.html","title":"PaddleX 3.0 Pipeline Deployment Tutorial","text":"

Before using this tutorial, you need to install PaddleX. For installation instructions, please refer to the PaddleX Installation guide.

The three deployment methods of PaddleX are detailed below:

  • High-Performance Inference: In actual production environments, many applications have stringent performance standards for deployment strategies, especially in terms of response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.
  • Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment in pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  • Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

This tutorial will introduce the three deployment methods of PaddleX through three practical application examples.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#1-high-performance-inference-example","title":"1 High-Performance Inference Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#11-obtain-serial-number-and-activation","title":"1.1 Obtain Serial Number and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Community page, select \"Get Now\" in the \"Consultation and Acquisition of Serial Numbers for Open Source Pipeline Deployment\" section, as shown in the figure below:

Select the pipeline you need to deploy and click \"Get\". Afterward, you can find the obtained serial number in the \"Serial Number Management for Open Source Pipeline Deployment SDK\" section below:

After using the serial number to complete activation, you can use the high-performance inference plugin. PaddleX provides both offline and online activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and activate online, allowing the program to complete activation automatically.
  • Offline Activation: Follow the instructions on the serial number management interface (click \"Offline Activation\" in \"Operations\") to obtain the device fingerprint of the machine and bind the serial number with the device fingerprint to obtain a certificate for activation. To use this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI. Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#12-install-high-performance-inference-plugin","title":"1.2 Install High-Performance Inference Plugin","text":"

Find the corresponding installation command in the table below based on processor architecture, operating system, device type, Python version, and other information, and execute it in the deployment environment:

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU (CUDA 11.8 + cuDNN 8.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • When the device type is GPU, please use the installation command corresponding to the CUDA and cuDNN versions that match your environment; otherwise, the high-performance inference plugin will not function properly.
  • For Linux systems, use Bash to execute the installation command.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

Before enabling high-performance plugins, ensure that the LD_LIBRARY_PATH in the current environment does not specify the shared library directory of TensorRT, as the plugins already integrate TensorRT to avoid conflicts caused by different TensorRT versions that may prevent the plugins from functioning properly.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate online, specify --update_license when using the serial number for the first time, taking the General OCR pipeline as an example:

paddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to activate online\npaddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --update_license \\\n    --serial_number {serial_number}\n

For the PaddleX Python API, the method to enable the high-performance inference plugin is similar. Again, taking the General OCR pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"OCR\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": xxx}\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \")\n

The inference results obtained with the high-performance inference plugin are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent initializations to improve speed.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#14-inference-steps","title":"1.4 Inference Steps","text":"

This inference process is based on PaddleX CLI, online activation of serial numbers, Python 3.10.0, and using a CPU device with the high-performance inference plugin. For other usage methods (such as different Python versions, device types, or PaddleX Python API), refer to the PaddleX High-Performance Inference Guide to replace the corresponding commands.

# Install the high-performance inference plugin\ncurl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310\n# Ensure that the `LD_LIBRARY_PATH` in the current environment does not specify the shared library directory of TensorRT. You can use the following command to remove it or manually remove it.\nexport LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\\n' | grep -v TensorRT | tr '\\n' ':' | sed 's/:*$//')\n# Perform inference\npaddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

Output:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#15-changing-pipelines-or-models","title":"1.5 Changing Pipelines or Models","text":"
  • Changing Pipelines:

If you want to use a different pipeline with the high-performance inference plugin, simply replace the value passed to --pipeline. Here is an example using the General Object Detection pipeline:

paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n
  • Changing Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to use other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./OCR.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to use another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./object_detection.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The operations for other pipelines are similar to those for the above two pipelines. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#2-service-deployment-example","title":"2 Service Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#21-installing-the-service-deployment-plugin","title":"2.1 Installing the Service Deployment Plugin","text":"

Execute the following command to install the service deployment plugin:

paddlex --install serving\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#22-starting-the-service","title":"2.2 Starting the Service","text":"

Start the service through the PaddleX CLI with the command format:

paddlex --serve --pipeline {Pipeline name or pipeline configuration file path} [{Other command-line options}]\n

Taking the General OCR pipeline as an example:

paddlex --serve --pipeline OCR\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or a local pipeline configuration file path. PaddleX constructs the pipeline based on this and deploys it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General OCR Pipeline Tutorial.

The command-line options related to service deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Default is cpu (if GPU is not available) or gpu (if GPU is available). --host Hostname or IP address bound to the server. Default is 0.0.0.0. --port Port number listened to by the server. Default is 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Please note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Performs online activation if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/practical_tutorials/deployment_tutorial.html#23-calling-the-service","title":"2.3 Calling the Service","text":"

Here, only the Python calling example is shown. For API references and service calling examples in other languages, please refer to the \"Calling the Service\" section in the \"Development Integration/Deployment\" part of each pipeline usage tutorial in the PaddleX Serving Deployment Guide.

import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image in Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64-encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#24-deployment-steps","title":"2.4 Deployment Steps","text":"
# Install the service deployment plugin\npaddlex --install serving\n# Start the service\npaddlex --serve --pipeline OCR\n# Call the service | The code in fast_test.py is a Python calling example from the previous section\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

Running Results:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#25-change-pipelines-or-models","title":"2.5 Change Pipelines or Models","text":"
  • Change Pipelines:

If you want to deploy another pipeline for service, simply replace the value passed to --pipeline. The following example uses the General Object Detection pipeline:

paddlex --serve --pipeline object_detection\n
  • Change Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to switch to other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the OCR pipeline configuration file and save it as ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./OCR.yaml\n# 4. Call the service\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to switch to another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the object detection pipeline configuration file and save it as ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./object_detection.yaml\n# 4. Call the service | fast_test.py needs to be replaced with the Python calling example from the General Object Detection Pipeline Tutorial\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The operations for other pipelines are similar to the above two. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#3-edge-deployment-example","title":"3 Edge Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#31-environment-preparation","title":"3.1 Environment Preparation","text":"
  1. Install the CMake compilation tool locally and download the required version of the NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK website.

    Environment Requirements - CMake >= 3.10 (the minimum version is not verified, but 3.20 and above are recommended) - Android NDK >= r17c (the minimum version is not verified, but r20b and above are recommended)

    Testing Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Find Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install the ADB tool on your computer for debugging. The ADB installation methods are as follows:

    3.1. Install ADB on Mac

     brew cask install android-platform-tools\n

    3.2. Install ADB on Linux

     # Installation method for Debian-based Linux distributions\n sudo apt update\n sudo apt install -y wget adb\n\n # Installation method for Red Hat-based Linux distributions\n sudo yum install adb\n

    3.3. Install ADB on Windows

    To install on Windows, go to Google's Android platform to download the ADB software package for installation: Link

    Open the terminal, connect the phone to the computer, and enter in the terminal

     adb devices\n

    If there is a device output, it indicates successful installation.

     List of devices attached\n 744be294    device\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#32-material-preparation","title":"3.2 Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified extraction directory, switch to the specified extraction directory, and execute the extraction command.

    # 1. Switch to the specified extraction directory\ncd PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo\n\n# 2. Execute the extraction command\nunzip ocr.zip\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#33-deployment-steps","title":"3.3 Deployment Steps","text":"
  1. Switch the working directory to PaddleX-Lite-Deploy/libs, run the download.sh script to download the required Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX-Lite-Deploy/ocr/assets, run the download.sh script to download the model files optimized by the paddle_lite_opt tool.

  3. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the build.sh script to complete the compilation of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the run.sh script to complete the inference on the edge side.

Notes: - Before running the build.sh script, you need to change the path specified by NDK_ROOT to the actual installed NDK path. - You can execute the deployment steps using Git Bash on a Windows system. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to windows. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to darwin. - Maintain an ADB connection when running the run.sh script. - The download.sh and run.sh scripts support passing parameters to specify models. If not specified, the PP-OCRv4_mobile model is used by default. Currently, two models are supported: - PP-OCRv3_mobile - PP-OCRv4_mobile

Here are examples of actual operations:

# 1. Download the required Paddle Lite prediction library\ncd PaddleX-Lite-Deploy/libs\nsh download.sh\n\n# 2. Download the model files optimized by the paddle_lite_opt tool\ncd ../ocr/assets\nsh download.sh PP-OCRv4_mobile\n\n# 3. Complete the compilation of the executable file\ncd ../android/shell/ppocr_demo\nsh build.sh\n\n# 4. Inference\nsh run.sh PP-OCRv4_mobile\n

Detection Results:

Recognition Results:

The detection visualized image saved in ./test_img_result.jpg\n0       Pure Nutrition Hair Conditioner  0.993706\n1       Product Information/Parameters   0.991224\n2       (45 yuan/kg, minimum order 100 kg)    0.938893\n3       Each bottle 22 yuan, minimum order 1000 bottles)  0.988353\n4       [Brand]: OEM/ODM Manufacturing   0.97557\n5       [Product Name]: Pure Nutrition Hair Conditioner  0.986914\n6       OEM/ODM  0.929891\n7       [Product Number]: YM-X-3011 0.964156\n8       [Net Content]: 220ml      0.976404\n9       [Suitable for]: All skin types  0.987942\n10      [Main Ingredients]: Cetyl Stearyl Alcohol, Oat \u03b2-Glucan,  0.968315\n11      Cocoamide Propyl Betaine, Panthenol    0.941537\n12      (Finished Product Packaging)    0.974796\n13      [Main Function]: Can tighten the hair\u200b\u9cde\u7247\u200b, achieving  0.988799\n14      immediate and lasting improvement in hair gloss, providing sufficient nourishment to dry hair  0.989547\n15      [Main Function Continued]: Nourishment    0.998413\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Paper and Literature Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Document information extraction is a part of document processing with widespread applications in numerous scenarios, such as academic research, library management, scientific and technological intelligence analysis, and literature review writing. Through document information extraction technology, we can automatically extract key information from academic papers, including titles, authors, abstracts, keywords, publication years, journal names, citation information, and more, and store this information in a structured format for easy subsequent retrieval, analysis, and application. This not only enhances the work efficiency of researchers but also provides strong support for the in-depth development of academic research.

Firstly, it is necessary to select the corresponding PaddleX pipeline based on the task scenario. This section takes information extraction from academic papers as an example to introduce how to conduct secondary development for tasks related to the Document Scene Information Extraction v3 pipeline, which corresponds to the Document Scene Information Extraction v3 in PaddleX. If you are unsure about the correspondence between tasks and pipelines, you can refer to the capability introductions of related pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpfnss9sq9_layout.jpg.\nThe result has been saved in output/tmpfnss9sq9_ocr.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\n\n{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u56fe\u8868\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of layout area detection, OCR, table recognition, as well as the table results in HTML and XLSX formats, are saved.

Among them, the visualization of the layout area detection results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. Due to the current limitation of the official model, which only distinguishes among figures, tables, and seals, it is currently unable to accurately locate and extract other information such as headers and table titles. The results for these in {'chat_res': {'header': 'unknown', 'table caption': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of academic papers. Utilizing a dataset of academic paper documents, with the extraction of header and chart title information as examples, the layout analysis model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract header and table title information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Paper Document File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 4 end-to-end layout detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1x 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3cls 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17cls 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3cls 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17cls 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3cls 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17cls 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Academic paper literature Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/paperlayout.tar -P ./dataset\ntar -xf ./dataset/paperlayout.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/paperlayout/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 4734,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/train_4612.jpg\",\n      \"check_dataset\\/demo_img\\/train_4844.jpg\",\n      \"check_dataset\\/demo_img\\/train_0084.jpg\",\n      \"check_dataset\\/demo_img\\/train_0448.jpg\",\n      \"check_dataset\\/demo_img\\/train_4703.jpg\",\n      \"check_dataset\\/demo_img\\/train_3572.jpg\",\n      \"check_dataset\\/demo_img\\/train_4516.jpg\",\n      \"check_dataset\\/demo_img\\/train_2836.jpg\",\n      \"check_dataset\\/demo_img\\/train_1353.jpg\",\n      \"check_dataset\\/demo_img\\/train_0225.jpg\"\n    ],\n    \"val_samples\": 928,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/val_0982.jpg\",\n      \"check_dataset\\/demo_img\\/val_0607.jpg\",\n      \"check_dataset\\/demo_img\\/val_0623.jpg\",\n      \"check_dataset\\/demo_img\\/val_0890.jpg\",\n      \"check_dataset\\/demo_img\\/val_0036.jpg\",\n      \"check_dataset\\/demo_img\\/val_0654.jpg\",\n      \"check_dataset\\/demo_img\\/val_0895.jpg\",\n      \"check_dataset\\/demo_img\\/val_0059.jpg\",\n      \"check_dataset\\/demo_img\\/val_0142.jpg\",\n      \"check_dataset\\/demo_img\\/val_0088.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/paperlayout\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 4734;
  • attributes.val_samples: The number of validation set samples in this dataset is 928;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/paperlayout\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate four experiments based on the RT-DETR-H_layout_3cls model, with learning rates of: 0.001\uff0c0.0005\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 50 and 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate mAP@@0.50:0.95 1 0.00001 88.90 2 0.0001 92.41 3 0.0005 92.27 4 0.001 90.66

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [2, 4, 5] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate mAP@@0.50:0.95 2 30 92.41 4 50 92.63 5 100 92.88

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#54-model-inference","title":"5.4 Model Inference","text":"

You can test the fine-tuned single model using test file

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\"\n

By following the above steps, prediction results can be generated under the ./output directory. The layout prediction result for test.jpg is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the academic paper literature test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.layout_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: ./output/best_model/inference\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'header': '\u200b\u7b2c\u200b43\u200b\u5377\u200b\\n \u200b\u822a\u7a7a\u200b\u53d1\u52a8\u673a\u200b\\n 44', 'table caption': '\u200b\u8868\u200b1\u200b\u6a21\u62df\u200b\u6765\u6d41\u200bMa=5\u200b\u98de\u884c\u200b\u7684\u200b\u7a7a\u6c14\u200b\u52a0\u70ed\u5668\u200b\u5de5\u4f5c\u200b\u53c2\u6570\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the layout is as follows, with the correctly added ability to locate the areas of headers and table titles:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Seal Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Seal information extraction is a part of document processing and has applications in many scenarios, such as contract comparison, inventory review, and invoice reimbursement review. Using artificial intelligence technology for automatic seal recognition can effectively save labor costs and improve efficiency for enterprises.

Firstly, it is necessary to select the corresponding PaddleX production line based on the task scenario. This section is about the seal information extraction task, and it is not difficult to find that the seal information extraction task is closely related to the document scenario information extraction task. Document scene information extraction, which extracts text information from documents or images, is a classic problem in the field of computer vision. Corresponding to PaddleX's document scene information extraction v3 production line. If you are unable to determine the correspondence between tasks and production lines, you can learn about the capabilities of the relevant production lines in PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpx5tmgsem_curve_0.jpg.\nThe result has been saved in output/tmpx5tmgsem_layout.jpg.\nThe result has been saved in output/tmpx5tmgsem_ocr.jpg.\nThe retrieved vectorstore is not for PaddleX and will return vectorstore directly\n\n{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of seal_recognition and OCR (if table exits, table recognition, as well as the table results in HTML and XLSX formats), are saved.

Among them, the visualization of the seal_recognition results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. The official model of the document scene information extraction production line has been found to have the following issues in the current demand scenario: in the visualization of OCR recognition, there is a deviation in the text bending detection box of the seal, resulting in incorrect seal text recognition; The information on the seal was not correctly extracted. The results for these in {'chat_res': {'seal': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of Seal Text Recognitions. Utilizing a dataset of Seal Text Recognition, with the extraction of seal information as examples, the seal text detection model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract seal information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Seal File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 2 end-to-end seal text detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description - - - - - - PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml

Note: The evaluation set for the above accuracy metrics is our self-built seal text detection dataset, containing 500 images of circle seal types. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Seal Text Detection Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/practical_seal.tar -P ./dataset\ntar -xf ./dataset/practical_seal.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/practical_seal/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 793,\n    \"train_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4055390_00006_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3712248_00008_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4227328_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3745965_00007_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3980931_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC5896212_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3838814_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4677212_00002_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4058803_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4925966_00001_seal_0_crop.png\"\n    ],\n    \"val_samples\": 277,\n    \"val_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/15.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/16.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/17.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/18.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/19.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/20.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/21.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/22.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/23.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/24.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/practical_seal\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 739;
  • attributes.val_samples: The number of validation set samples in this dataset is 277;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all boxes's width and height in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4 \\\n    -o Train.learning_rate=0.0001\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/practical_seal\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate 3 experiments based on the PP-OCRv4_server_seal_det model, with learning rates of: 0.001\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate Hmean(%) 1 0.001 97.35 2 0.0001 93.32 3 0.00001 87.63

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [1, 4] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate Hmean(%) 1 30 97.35 4 100 98.13

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.seal_text_det_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: ./output/best_accuracy/inference\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u5e7f\u5173\u5e02\u200b\u56fd\u58eb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the seal is as follows, with the correctly added ability to extract the seal text information:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"seal\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html","title":"PaddleX 3.0 General Image Classification Pipeline \u2014 Garbage Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For garbage classification, it falls under the general image classification task, corresponding to PaddleX's universal image classification pipeline. If you're unsure about the task-pipeline correspondence, you can check the capabilities of relevant pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a General Image Classification pipeline for a quick trial.

Quick Trial Output Example:

After trying the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is not satisfactory, you can test alternative models and decide if further fine-tuning is needed. Since this tutorial aims to classify specific garbage types, the default weights (trained on the ImageNet-1k dataset) are insufficient. You need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 80 end-to-end image classification models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model List Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-HGNetV2_B6 86.30 10.46 240.18 288 CLIP_vit_base_patch16_224 85.39 12.03 234.85 331 PP-HGNetV2_B4 83.57 2.45 38.10 76 SwinTransformer_base_patch4_window7_224 83.37 12.35 - 342 PP-HGNet_small 81.51 4.24 108.21 94 PP-HGNetV2_B0 77.77 0.68 6.41 23 ResNet50 76.50 3.12 50.90 98 PP-LCNet_x1_0 71.32 1.01 3.39 7 MobileNetV3_small_x1_0 68.24 1.09 3.65 12

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial will use the PP-LCNet_x1_0 model as an example to complete the full model development process. You can select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within your pipeline and ultimately use them in real-world scenarios.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Garbage Classification Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/trash40.tar -P ./dataset\ntar -xf ./dataset/trash40.tar -C ./dataset/\n
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/trash40/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": ../../dataset/trash40/label.txt\",\n    \"num_classes\": 40,\n    \"train_samples\": 1605,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/img_14950.jpg\",\n      \"check_dataset/demo_img/img_12045.jpg\",\n    ],\n    \"val_samples\": 3558,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/img_198.jpg\",\n      \"check_dataset/demo_img/img_19627.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/trash40/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 40, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 1605;
  • attributes.val_samples: The number of validation set samples in this dataset is 3558;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/trash40 \\\n    -o Train.num_classes=40\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/trash40\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 20, and set the batch size to 64 due to the small size of the training dataset.
  2. Initiate three experiments based on the PP-LCNet_x1_0 model, with learning rates of: 0.01, 0.001, 0.1.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.01. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 2 20 0.001 64 4 GPUs 30.64% Experiment 3 20 0.1 64 4 GPUs 71.53%

Changing Epochs Experiment Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 1 (Increased Epochs) 50 0.01 64 4 GPUs 77.32% Experiment 1 (Increased Epochs) 80 0.01 64 4 GPUs 77.60% Experiment 1 (Increased Epochs) 100 0.01 64 4 GPUs 77.80%

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine, with FP32 precision. CPU inference speed is based on an Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing. Use the test file to perform predictions:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for garbage_demo.png is shown below:

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Image Classification Pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/image_classification.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/image_classification.yaml\")\noutput = pipeline.predict(\"./dataset/trash40/images/test/0/img_154.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Image Classification Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html","title":"PaddleX 3.0 General Instance Segmentation Pipeline \u2014 Tutorial for Remote Sensing Image Instance Segmentation","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of remote sensing image segmentation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For remote sensing image segmentation, this falls under the category of instance segmentation, corresponding to PaddleX's Universal Instance Segmentation Pipeline. If unsure about the task-pipeline correspondence, refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline instance_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Instance Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the included model needs further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for testing until satisfied. If the final results are unsatisfactory, fine-tuning the model is necessary. This tutorial aims to produce a model that segments geospatial objects, and the default weights (trained on the COCO dataset) cannot meet this requirement. Data collection and annotation are required for training and fine-tuning.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides 15 end-to-end instance segmentation models. Refer to the Model List for details. Benchmarks for some models are as follows:

Model List mAP(%) GPU Inference Time(ms) Model Size(M) Mask-RT-DETR-H 48.8 61.40 486 Mask-RT-DETR-X 47.5 45.70 257 Mask-RT-DETR-L 45.7 37.40 123 Mask-RT-DETR-S 40.9 32.40 57

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA V100 machine with FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the Mask-RT-DETR-H model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally apply them in real-world scenarios.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Remote Sensing Image Instance Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/intseg_remote_sense_coco.tar -P ./dataset\ntar -xf ./dataset/intseg_remote_sense_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

When verifying the dataset, you only need one command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print Check dataset passed !, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 2989,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/524.jpg\",\n      \"check_dataset/demo_img/024.jpg\",\n    ],\n    \"val_samples\": 932,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/326.jpg\",\n      \"check_dataset/demo_img/596.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/intseg_remote_sense_coco/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 10, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 2989.
  • attributes.val_samples: The number of validation samples in this dataset is 932.
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples.
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples.

Additionally, the dataset verification also analyzes the sample number distribution of all categories in the dataset and generates a distribution histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations of some parameters in the configuration file:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If re-splitting the dataset, the percentage of the training set needs to be set, which is an integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If re-splitting the dataset, the percentage of the validation set needs to be set, which is an integer between 0-100, and the sum with train_percent must be 100;

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in the original path. The above parameters also support setting through appending command line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco \\\n    -o Train.num_classes=10\n

PaddleX model training supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. The following are example explanations of some parameters in the configuration file:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which logs whether the training task completed successfully, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, which records changes in model metrics, loss variations, etc. during the training process;
  • config.yaml: Training configuration file, which records the hyperparameter configurations for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer states, EMA (Exponential Moving Average), static graph network parameters, and static graph network structures;
"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight files on the validation set to verify the model's accuracy. To perform model evaluation using PaddleX, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

Similar to model training, model evaluation supports setting configurations by modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 80 and the batch size at 2.
  2. Launch three experiments based on the Mask-RT-DETR-H model with learning rates of: 0.0005, 0.005, 0.0001
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results for different epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 80 0.0005 2 4 GPUs 0.695 Experiment 2 80 0.0001 2 4 GPUs 0.825 Experiment 3 80 0.00005 2 4 GPUs 0.706

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 80 0.0001 2 4 GPUs 0.825 Reduced Epochs in Experiment 2 30 0.0001 2 4 GPUs 0.287 Reduced Epochs in Experiment 2 50 0.0001 2 4 GPUs 0.545 Increased Epochs in Experiment 2 100 0.0001 2 4 GPUs 0.813

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above, which is normal.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for remotesensing_demo.png is as follows:

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general instance segmentation pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/instance_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/instance_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the result visualization image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Instance Segmentation Pipline User Guide\u3002

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial on Pedestrian Fall Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of pedestrian fall detection.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the appropriate PaddleX pipeline based on your task scenario. For pedestrian fall detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\n

  • AIStudio Community Experience: Navigate to Baidu AIStudio Community, click \"Create Pipeline,\" and create a General Object Detection pipeline for a quick trial.

Quick trial output example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. Since the default weights (trained on the COCO dataset) are unlikely to meet the requirements for detecting pedestrian falls, you'll need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Here's a benchmark of some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the PP-YOLOE_plus-S model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally deploy

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Pedestrian Fall Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/fall_det.tar -P ./dataset\ntar -xf ./dataset/fall_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/fall_det\n

After executing the above command, PaddleX will verify the dataset and count its basic information. Upon successful execution, the log will print out Check dataset passed ! information, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized example images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 1224,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/fall_1168.jpg\",\n      \"check_dataset/demo_img/fall_1113.jpg\"\n    ],\n    \"val_samples\": 216,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/fall_349.jpg\",\n      \"check_dataset/demo_img/fall_394.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/fall_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 1224.
  • attributes.val_samples: The number of validation samples in this dataset is 216.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False.
      • src_dataset_type: If dataset format conversion is performed, the source dataset format must be specified. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False.
      • train_percent: If dataset splitting is performed, the percentage of the training set must be set. The value should be an integer between 0 and 100, and the sum with val_percent must be 100.
      • val_percent: If dataset splitting is performed, the percentage of the validation set must be set. The value should be an integer between 0 and 100, and the sum with train_percent must be 100.

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support setting through appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/fall_det \\\n    -o Train.num_classes=1\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command-line parameters.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/fall_det\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line parameters.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve model accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The learning rate setting affects the speed and stability of model convergence. Therefore, when optimizing model performance, carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the control variable method when debugging parameters:

  1. First, fix the number of training epochs to 10 and the batch size to 8.
  2. Start three experiments based on the PP-YOLOE_plus-S model with learning rates of: 0.00002, 0.0001, 0.0005.
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results of different epochs. It is found that the best accuracy is basically achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 10 0.00002 8 4 GPUs 0.880 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 3 10 0.0005 8 4 GPUs 0.888

Changing Epochs Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 2 (Increased Epochs) 50 0.0001 8 4 GPUs 0.944 Experiment 2 (Increased Epochs) 100 0.0001 8 4 GPUs 0.947

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\"\n

The prediction results will be generated under ./output, and the prediction result for fall.png is shown below:

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial for Fashion Element Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of fashion element detection in clothing.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For fashion element detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\n

  • AIStudio Community Experience: Visit Baidu AIStudio Community, click \"Create Pipeline,\" and select the General Object Detection pipeline for a quick trial.

Quick Trial Output Example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. For this tutorial, aiming to detect fashion elements in clothing, the default weights (trained on the COCO dataset) are insufficient. Data collection and annotation, followed by training and fine-tuning, are necessary.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Below are benchmarks for some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models with faster inference speed are placed higher in the table, while models with higher accuracy are lower. This tutorial takes the PicoDet-L model as an example to complete a full model development process. You can judge and select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within the pipeline and ultimately use them in practical scenarios.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Fashion Element Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_mini_fashion_pedia_coco.tar -P ./dataset\ntar -xf ./dataset/det_mini_fashion_pedia_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful command execution, \"Check dataset passed !\" will be printed in the log, and relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 15,\n    \"train_samples\": 4000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/297ea597f7dfa6d710b2e8176cb3b913.jpg\",\n      \"check_dataset/demo_img/2d8b75ce472dbebd41ca8527f0a292f3.jpg\"\n    ],\n    \"val_samples\": 800,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/40e13ebcfa281567c92fc9842510abea.jpg\",\n      \"check_dataset/demo_img/87808e379034ac2344f5132d3dccc6e6.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_mini_fashion_pedia_coco\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the dataset format meets the requirements as check_pass is True. The explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 15, which is the number of classes to be passed for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 4000.
  • attributes.val_samples: The number of validation samples in this dataset is 800.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only datasets that pass the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion. The default is False.
      • src_dataset_type: If dataset format conversion is enabled, you need to set the source dataset format. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting. The default is False.
      • train_percent: If dataset splitting is enabled, you need to set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100.
      • val_percent: If dataset splitting is enabled, you need to set the percentage of the validation set. The value should be an integer between 0 and 100, and the sum with train_percent should be 100.

Data conversion and data splitting can be enabled simultaneously. The original annotation files for data splitting will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the training set and validation set ratio: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco \\\n    -o Train.num_classes=15\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 50: -o Train.epochs_iters=50. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

Similar to model training, model evaluation supports modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a built-in default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By reasonably tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 50 and the batch size at 16.
  2. Initiate three experiments based on the PicoDet-L model with learning rates of: 0.02, 0.04, 0.08.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.04. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 80 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 50 0.02 16 4 GPUs 0.428 Experiment 2 50 0.04 16 4 GPUs 0.471 Experiment 3 50 0.08 16 4 GPUs 0.440

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 50 0.04 16 4 GPUs 0.471 Reduced Epochs in Exp. 2 30 0.04 16 4 GPUs 0.425 Increased Epochs in Exp. 2 80 0.04 16 4 GPUs 0.491 Further Increased Epochs 100 0.04 16 4 GPUs 0.459

Note: This tutorial is designed for a 4-GPU setup. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above figures, which is normal.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#6-pipeline-testing","title":"6. Pipeline Testing","text":"

Replace the model in the pipeline with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for FashionPedia_demo.png is as follows:

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in your production line, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n

For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 License Plate Recognition Tutorial","text":"

PaddleX provides a rich set of pipelines, each consisting of one or more models that work together to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a license plate recognition task as an example.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For license plate recognition, this task falls under text detection, corresponding to PaddleX's Universal OCR pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List supported by PaddleX to understand the capabilities of relevant pipelines.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.), and whether the models included in the pipeline need further fine-tuning. If the speed or accuracy of the models does not meet expectations, select replaceable models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tune the models.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides two end-to-end text detection models. For details, refer to the Model List. The benchmarks of the models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The above accuracy metrics are for the Detection Hmean and Recognition Avg Accuracy on PaddleOCR's self-built Chinese dataset validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while from bottom to top, they have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Depending on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"License Plate Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For information on data format, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ccpd_text_det.tar -P ./dataset\ntar -xf ./dataset/ccpd_text_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#42-dataset-validation","title":"4.2 Dataset Validation","text":"

To validate the dataset, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

After executing the above command, PaddleX will validate the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The validation result file is saved in ./output/check_dataset_result.json, and the specific content of the validation result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 5769,\n    \"train_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/0274305555556-90_266-204&460_520&548-516&548_209&547_204&464_520&460-0_0_3_25_24_24_24_26-63-89.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0126171875-90_267-294&424_498&486-498&486_296&485_294&425_496&424-0_0_3_24_33_32_30_31-157-29.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0371516927083-89_254-178&423_517&534-517&534_204&525_178&431_496&423-1_0_3_24_33_31_29_31-117-667.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/03349609375-90_268-211&469_526&576-526&567_214&576_211&473_520&469-0_0_3_27_31_32_29_32-174-48.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0388454861111-90_269-138&409_496&518-496&518_138&517_139&410_491&409-0_0_3_24_27_26_26_30-174-148.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0198741319444-89_112-208&517_449&600-423&593_208&600_233&517_449&518-0_0_3_24_28_26_26_26-87-268.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3027782118055555555-91_92-186&493_532&574-529&574_199&565_186&497_532&493-0_0_3_27_26_30_33_32-73-336.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/034375-90_258-168&449_528&546-528&542_186&546_168&449_525&449-0_0_3_26_30_30_26_33-94-221.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0286501736111-89_92-290&486_577&587-576&577_290&587_292&491_577&486-0_0_3_17_25_28_30_33-134-122.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/02001953125-92_103-212&486_458&569-458&569_224&555_212&486_446&494-0_0_3_24_24_25_24_24-88-24.jpg\"\n    ],\n    \"val_samples\": 1001,\n    \"val_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/3056141493055555554-88_93-205&455_603&597-603&575_207&597_205&468_595&455-0_0_3_24_32_27_31_33-90-213.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0680295138889-88_94-120&474_581&623-577&605_126&623_120&483_581&474-0_0_5_24_31_24_24_24-116-518.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0482421875-87_265-154&388_496&530-490&495_154&530_156&411_496&388-0_0_5_25_33_33_33_33-84-104.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0347504340278-105_106-235&443_474&589-474&589_240&518_235&443_473&503-0_0_3_25_30_33_27_30-162-4.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0205338541667-93_262-182&428_410&519-410&519_187&499_182&428_402&442-0_0_3_24_26_29_32_24-83-63.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0380913628472-97_250-234&403_529&534-529&534_250&480_234&403_528&446-0_0_3_25_25_24_25_25-185-85.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/020598958333333334-93_267-256&471_482&563-478&563_256&546_262&471_482&484-0_0_3_26_24_25_32_24-102-115.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3030323350694444445-86_131-170&495_484&593-434&569_170&593_226&511_484&495-11_0_5_30_30_31_33_24-118-59.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3016158854166666667-86_97-243&471_462&546-462&527_245&546_243&479_453&471-0_0_3_24_30_27_24_29-98-40.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0340831163194-89_264-177&412_488&523-477&506_177&523_185&420_488&412-0_0_3_24_30_29_31_31-109-46.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/ccpd_text_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 5769;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 1001;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to perform dataset format conversion, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, ensuring the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, ensuring the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

PaddleX supports modifying training hyperparameters, single-machine single/multi-GPU training, etc., by modifying the configuration file or appending command line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, related file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires only one command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly according to the actual situation to achieve the best training effect.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs to 10, the batch size to 8, the number of GPUs to 4, and the total batch size to 32.
  2. Start four experiments based on the PP-OCRv4_server_det model with learning rates of: 0.00005, 0.0001, 0.0005, 0.001.
  3. You can find that Experiment 4 with a learning rate of 0.001 has the highest accuracy, and by observing the validation set score, the accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 20 will further improve the model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Detection Hmean (%) 1 0.00005 99.06 2 0.0001 99.55 3 0.0005 99.60 4 0.001 99.70

Next, based on a learning rate of 0.001, we can increase the number of training epochs. Comparing Experiments [4, 5] below, it can be seen that increasing the number of training epochs further improves the model accuracy. Experiment ID Number of Training Epochs Detection Hmean (%) 4 10 99.70 5 20 99.80

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the models in the production line with the fine-tuned models for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir output/best_accuracy/inference None \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

This will generate prediction results under ./output, where the prediction result for case1.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 Handwritten Chinese Recognition Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that collectively solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also support fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of handwritten Chinese recognition.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For handwritten Chinese recognition, this task falls under the Text Recognition category, corresponding to PaddleX's Universal OCR Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the pipeline's models need further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tuning the model is necessary.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides four end-to-end OCR models. For details, refer to the Model List. Benchmarks for some models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The evaluation set is a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts. The text recognition set contains 11,000 images, and the detection set contains 500 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Based on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Handwritten Chinese Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/handwrite_chinese_text_rec.tar -P ./dataset\ntar -xf ./dataset/handwrite_chinese_text_rec.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 23965,\n    \"train_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/64957.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/138926.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/86760.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/83191.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/79882.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/58639.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1187-P16_1.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/8199.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1225-P19_9.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/183335.png\"\n    ],\n    \"val_samples\": 17259,\n    \"val_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/11.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/12.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/13.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/14.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/15.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/16.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/17.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/18.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/19.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/20.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/handwrite_chinese_text_rec\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 23965;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 17259;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of the samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of the samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to convert the dataset format, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, and needs to ensure that the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, and needs to ensure that the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command-line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters carefully and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs at 20, the batch size at 8, select 4 GPUs, and the total batch size is 32.
  2. Initiate four experiments based on the PP-OCRv4_server_rec model with learning rates of: 0.001, 0.005, 0.0002, 0.0001.
  3. It can be observed that Experiment 3, with a learning rate of 0.0002, yields the highest accuracy, and the validation set score indicates that accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 30, 50, and 80 will further improve model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Recognition Acc (%) 1 0.001 43.28 2 0.005 32.63 3 0.0002 49.64 4 0.0001 46.32

Next, based on a learning rate of 0.0002, we can increase the number of training epochs. Comparing Experiments [4, 5, 6, 7] below, it can be seen that increasing the number of training epochs further improves model accuracy. Experiment ID Number of Training Epochs Recognition Acc (%) 4 20 49.64 5 30 52.03 6 50 54.15 7 80 54.35

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir None output/best_accuracy/inference \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

The prediction results will be generated under ./output, and the prediction result for case.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html","title":"PaddleX 3.0 General Semantic Segmentation Pipeline \u2014 Lane Line Segmentation Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a lane line segmentation task.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For lane line segmentation, this falls under the category of semantic segmentation tasks, corresponding to PaddleX's Universal Semantic Segmentation Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline semantic_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Semantic Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 18 end-to-end semantic segmentation models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48 82.15 87.97 2180.76 270 PP-LiteSeg-T 77.04 5.98 140.02 31

Note: The above accuracy metrics are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-LiteSeg-T model as an example to complete the full model development process. You can choose a suitable model for training based on your actual usage scenario, evaluate the appropriate model weights within the pipeline, and finally use them in practical scenarios.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Lane Line Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/semantic-segmentation-makassaridn-road-dataset.tar -P ./dataset\ntar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 300,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/20220311151733_0060_040.jpg\",\n      \"check_dataset/demo_img/20220311153115_0023_039.jpg\"\n    ],\n    \"val_samples\": 74,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/20220311152033_0060_007.jpg\",\n      \"check_dataset/demo_img/20220311144930_0060_026.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/semantic-segmentation-makassaridn-road-dataset\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 300;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 74;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 5000 and the batch size at 2.
  2. Initiate three experiments based on the PP-LiteSeg-T model, with learning rates of: 0.006, 0.008, and 0.01.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.008. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 80000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 5000 0.006 2 4 GPUs 0.623 Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 3 5000 0.01 2 4 GPUs 0.619

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 2 with fewer epochs 10000 0.008 2 4 GPUs 0.773 Experiment 2 with more epochs 40000 0.008 2 4 GPUs 0.855 Experiment 2 with more epochs 80000 0.008 2 4 GPUs 0.863

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\"\n

The prediction results will be generated under ./output, where the prediction result for makassaridn-road_demo.png is shown below:

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general semantic segmentation pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/semantic_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Semantic Segmentation Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html","title":"PaddleX 3.0 Time Series Anomaly Detection Pipeline \u2014 Equipment Anomaly Detection Application Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration of pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Local Installation Tutorial. This tutorial introduces the usage of the pipeline tool with an example of detecting anomalies in equipment nodes.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. This task aims to identify and mark abnormal behaviors or states in equipment nodes, helping enterprises and organizations promptly detect and resolve issues in application server nodes, thereby improving system reliability and availability. Recognizing this as a time series anomaly detection task, we will use PaddleX's Time Series Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"PatchTST_ad\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Visit the Official Time Series Anomaly Detection Application to experience the capabilities of time series anomaly detection tasks. Note: Due to the tight correlation between time series data and scenarios, the online experience of official models for time series tasks is tailored to a specific scenario and is not a general solution. Therefore, the experience mode does not support using arbitrary files to evaluate the official model's performance. However, after training a model with your own scenario data, you can select your trained model and use data from the corresponding scenario for online experience.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series anomaly detection models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name Precision Recall F1-Score Model Size (M) Description DLinear_ad 0.9898 0.9396 0.9641 72.8K A simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_ad 0.9855 0.8895 0.9351 1.5MB A transformer-based model optimized for anomaly detection in non-stationary time series AutoEncoder_ad 0.9936 0.8436 0.9125 32K A classic autoencoder-based model that is efficient and easy to use for time series anomaly detection PatchTST_ad 0.9878 0.9070 0.9457 164K A high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_ad 0.9837 0.9480 0.9656 732K A highly adaptive and high-precision time series anomaly detection model through multi-period analysis

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire process of time series anomaly detection, we will use the publicly available MSL (Mars Science Laboratory) dataset for model training and validation. The PSM (Planetary Science Mission) dataset, sourced from NASA, comprises 55 dimensions and includes telemetry anomaly data reported by the spacecraft's monitoring system for unexpected event anomalies (ISA). With its practical application background, it better reflects real-world anomaly scenarios and is commonly used to test and validate the performance of time series anomaly detection models. This tutorial will perform anomaly detection based on this dataset.

We have converted the dataset into a standard data format, and you can obtain a sample dataset using the following command. For an introduction to the data format, please refer to the Time Series Anomaly Detection Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/msl.tar -P ./dataset\ntar -xf ./dataset/msl.tar -C ./dataset/\n

Data Considerations * Time series anomaly detection is an unsupervised learning task, thus labeled training data is not required. The collected training samples should ideally consist solely of normal data, i.e., devoid of anomalies, with the label column in the training set set to 0 or, alternatively, the label column can be omitted entirely. For the validation set, to assess accuracy, labeling is necessary. Points that are anomalous at a particular timestamp should have their labels set to 1, while normal points should have labels of 0. * Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods. * Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/msl\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 58317,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"0\",\n        \"1\",\n        \"2\",\n        \"...\"\n      ],\n      [\n        \"...\"\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/msl\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, refer to Section 4.1.3 in the Time Series Anomaly Detection Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/msl \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=timestamp \\\n-o Train.feature_cols=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 \\\n-o Train.freq=1 \\\n-o Train.label_col=label \\\n-o Train.seq_len=96\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations for parameters in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset verification (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict).
  • device: Training device, options include cpu and gpu. You can check the models supported on different devices in the PaddleX Model List (CPU/GPU) document at the same level directory.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs.
  • learning_rate: Training learning rate.
  • batch_size: Training batch size for a single GPU.
  • time_col: Time column, set the column name of the time series dataset's time column based on your data.
  • feature_cols: Feature variables indicating variables related to whether the device is abnormal.
  • freq: Frequency of the time series dataset.
  • input_len: The length of the time series input to the model. The time series will be sliced according to this length, and the model will predict whether there is an anomaly in this segment of the time series for that length. The recommended input length should be considered in the context of the actual scenario. In this tutorial, the input length is 96, which means we hope to predict whether there are anomalies at 96 time points.
  • label: Represents the number indicating whether a time point in the time series is abnormal. Anomalous points are labeled as 1, and normal points are labeled as 0. In this tutorial, the anomaly monitoring dataset uses label for this purpose.

For more introductions to hyperparameters, please refer to PaddleX Time Series Task Model Configuration File Parameter Instructions. The above parameters can be set by appending command-line arguments. For example, to specify the mode as model training: -o Global.mode=train; to specify the first GPU for training: -o Global.device=gpu:0; to set the number of training epochs to 10: -o Train.epochs_iters=10.

More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/msl\n
Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including F1, recall, and precision.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series anomaly detection:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5, batch size to 16, and input length to 96.
  2. Initiate three experiments based on the PatchTST_ad model with learning rates of: 0.0001, 0.0005, 0.001.
  3. It can be found that Experiment 3 has the highest accuracy, with a learning rate of 0.001. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 20.
  4. It can be found that the accuracy of Experiment 4 is the same as that of Experiment 3, indicating that there is no need to further increase the number of training epochs.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 1 5 0.0001 16 96 1 GPU 79.5 Experiment 2 5 0.0005 16 96 1 GPU 80.1 Experiment 3 5 0.001 16 96 1 GPU 80.9

Increasing Training Epochs Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 3 5 0.0005 16 96 1 GPU 80.9 Experiment 4 20 0.0005 16 96 1 GPU 80.9"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, using the test file for prediction:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/test.csv\"\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#7-integrationdeployment","title":"7. Integration/Deployment","text":"

If the general-purpose time series anomaly detection pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series anomaly detection pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series Anomaly Detection Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series anomaly detection pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_classification.html","title":"PaddleX 3.0 Time Series Classification Pipeline \u2014 Heartbeat Monitoring Time Series Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also allow fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the pipeline tool with an example of heartbeat time series data classification.

"},{"location":"en/practical_tutorials/ts_classification.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For this task, the goal is to train a time series classification model based on heartbeat monitoring data to classify heartbeat time series conditions. Recognizing this as a time series classification task, we select PaddleX's Time Series Classification Pipeline. If unsure about the task-pipeline correspondence, consult the PaddleX Pipeline List (CPU/GPU) for pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_classification.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Access the Official Time Series Classification Application to experience time series classification capabilities.

Note: Due to the tight coupling between time series data and scenarios, the online experience of official models is tailored to a specific scenario and not a universal solution. It does not support arbitrary files for model effect evaluation. However, after training a model with your scenario data, you can select your trained model and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_classification.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides a time series classification model. Refer to the Model List for details. The model benchmark is as follows:

Model Name Acc (%) Model Size (M) Description TimesNet_cls 87.5 792K TimesNet is an adaptive and high-precision time series classification model through multi-cycle analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/practical_tutorials/ts_classification.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ts_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series classification process, we will use the public Heartbeat Dataset for model training and validation. The Heartbeat Dataset is part of the UEA Time Series Classification Archive, addressing the practical task of heartbeat monitoring for medical diagnosis. The dataset comprises multiple time series groups, with each data point consisting of a label variable, group ID, and 61 feature variables. This dataset is commonly used to test and validate the performance of time series classification prediction models.

We have converted the dataset into a standard format, which can be obtained using the following commands. For data format details, refer to the Time Series Classification Module Development Tutorial.

Dataset Acquisition Command:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n

Data Considerations * Based on collected real data, clarify the classification objectives of the time series data and define corresponding classification labels. For example, in stock price classification, labels might be \"Rise\" or \"Fall.\" For a time series that is \"Rising\" over a period, it can be considered a sample (group), where each time point in this period shares a common group_id. * Uniform Time Series Length: Ensure that the length of the time series for each group is consistent. Missing Value Handling: To guarantee the quality and integrity of the data, missing values can be imputed based on expert experience or statistical methods. * Non-Duplication: Ensure that the data is collected row by row in chronological order, with no duplication of the same time point.

"},{"location":"en/practical_tutorials/ts_classification.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [ ...\n    ],\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [ ...\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_classification.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, please refer to Section 4.1.3 in the Time Series Classification Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_classification.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_classification.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/ts_classify_examples \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=time \\\n-o Train.target_cols=dim_0,dim_1,dim_2 \\\n-o Train.freq=1 \\\n-o Train.group_id=group_id \\\n-o Train.static_cov_cols=label\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time-series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supports dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict);
  • device: Training device, options include cpu, gpu. Check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Set the column names of the target variables of the time series dataset based on your data. Can be multiple, separated by commas. Generally, the more relevant the target variables are to the prediction target, the higher the model accuracy. In this tutorial, the heartbeat monitoring dataset has 61 feature variables for the time column, such as dim_0, dim_1, etc.;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • group_id: A group ID represents a time series sample, and time series sequences with the same ID form a sample. Set the column name of the specified group ID based on your data, e.g., group_id.
  • static_cov_cols: Represents the category ID column of the time series. The same sample has the same label. Set the column name of the category based on your data, e.g., label. For more hyperparameter introductions, please refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_classification.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Evaluate.weight_path=./output/best_model/model.pdparams\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including Acc Top1.

"},{"location":"en/practical_tutorials/ts_classification.html#53-model-optimization","title":"5.3 Model Optimization","text":"

By adjusting the number of training epochs appropriately, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

Using the method of controlled variables, we can start with a fixed, relatively small number of epochs in the initial stage and adjust the learning rate multiple times to find an optimal learning rate. After that, we can increase the number of training epochs to further improve the results. Below, we introduce the parameter tuning method for time series classification in detail:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5 and the batch size to 16.
  2. Launch three experiments based on the TimesNet_cls model with learning rates of 0.00001, 0.0001, and 0.001, respectively.
  3. It can be found that Experiment 3 has the highest accuracy. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 30. Note: Due to the built-in early stopping mechanism for time series tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. If you need to change the patience epochs for early stopping, you can manually modify the value of the patience hyperparameter in the configuration file.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 1 5 0.00001 16 1 GPU 72.20% Experiment 2 5 0.0001 16 1 GPU 72.20% Experiment 3 5 0.001 16 1 GPU 73.20%

Results of Increasing Training Epochs:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 3 5 0.001 16 1 GPU 73.20% Experiment 4 30 0.001 16 1 GPU 75.10%"},{"location":"en/practical_tutorials/ts_classification.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Set the model directory to the trained model for testing, using the test file to perform predictions:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_classification/test.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is TimesNet_cls.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/inference\"
  • Specify the path to the input data: -o Predict.input=\"...\"

Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

"},{"location":"en/practical_tutorials/ts_classification.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general time series classification pipeline meets your requirements for inference speed and accuracy, you can directly proceed with development integration/deployment.

  1. If you need to directly apply the general time series classification pipeline in your Python project, you can refer to the following sample code:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_classification\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n

For more parameters, please refer to the Time Series Classification Pipeline Usage Tutorial

  1. Additionally, PaddleX's time series classification pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_forecast.html","title":"PaddleX 3.0 Time Series Forecasting Pipeline \u2014 Long-term Electricity Consumption Forecasting Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the time series forecasting pipeline tool with an example of long-term electricity consumption forecasting.

"},{"location":"en/practical_tutorials/ts_forecast.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. The goal of this task is to predict future electricity consumption based on historical data. Recognizing this as a time series forecasting task, we will use PaddleX's time series forecasting pipeline. If you're unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_forecast.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its pipelines: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:

    from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n

  • AIStudio Community Experience: Visit the Official Time Series Forecasting Application to experience time series forecasting capabilities. Note: Due to the tight correlation between time series data and scenarios, the official online experience models for time series tasks are tailored to specific scenarios and are not universal. Therefore, the online experience does not support using arbitrary files to test the official model solutions. However, after training your own model with scenario-specific data, you can select your trained model solution and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_forecast.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series forecasting models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name MSE MAE Model Size (M) Description DLinear 0.382 0.394 76k A simple, efficient, and easy-to-use time series forecasting model Nonstationary 0.600 0.515 60.3M Based on transformer architecture, optimized for long-term forecasting of non-stationary time series PatchTST 0.385 0.397 2.2M A high-accuracy long-term forecasting model that balances local patterns and global dependencies TiDE 0.405 0.412 34.9M A high-accuracy model suitable for handling multivariate, long-term time series forecasting problems TimesNet 0.417 0.431 5.2M Through multi-period analysis, TimesNet is an adaptable and high-accuracy time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset with an input sequence length of 96 and a prediction sequence length of 96 for all models except TiDE, which is 720.

Based on your actual usage scenario, select an appropriate model for training. After training, evaluate the model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ts_forecast.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series forecasting process, we will use the Electricity dataset for model training and validation. This dataset collects electricity consumption at a certain node from 2012 to 2014, with data collected every hour. Each data point consists of the current timestamp and corresponding electricity consumption. This dataset is commonly used to test and validate the performance of time series forecasting models.

In this tutorial, we will use this dataset to predict the electricity consumption for the next 96 hours. We have already converted this dataset into a standard data format, and you can obtain a sample dataset by running the following command. For an introduction to the data format, you can refer to the Time Series Prediction Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/electricity.tar -P ./dataset\ntar -xf ./dataset/electricity.tar -C ./dataset/\n

Data Considerations

  • When annotating data for time series forecasting tasks, based on the collected real data, all data is arranged in chronological order. During training, the data is automatically divided into multiple time segments, where the historical time series data and the future sequences respectively represent the input data for training the model and its corresponding prediction targets, forming a set of training samples.
  • Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods.
  • Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.
"},{"location":"en/practical_tutorials/ts_forecast.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/electricity\n

After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22880,\n    \"train_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2012-01-01 00:00:00\",\n        2162.0\n      ],\n      [\n        \"2012-01-01 01:00:00\",\n        2835.0\n      ],\n      [\n        \"2012-01-01 02:00:00\",\n        2764.0\n      ],\n      [\n        \"2012-01-01 03:00:00\",\n        2735.0\n      ],\n      [\n        \"2012-01-01 04:00:00\",\n        2721.0\n      ],\n      [\n        \"2012-01-01 05:00:00\",\n        2742.0\n      ],\n      [\n        \"2012-01-01 06:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 07:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 08:00:00\",\n        2680.0\n      ],\n      [\n        \"2012-01-01 09:00:00\",\n        2581.0\n      ]\n    ],\n    \"val_samples\": 3424,\n    \"val_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2014-08-11 08:00:00\",\n        3528.0\n      ],\n      [\n        \"2014-08-11 09:00:00\",\n        3800.0\n      ],\n      [\n        \"2014-08-11 10:00:00\",\n        3889.0\n      ],\n      [\n        \"2014-08-11 11:00:00\",\n        4340.0\n      ],\n      [\n        \"2014-08-11 12:00:00\",\n        4321.0\n      ],\n      [\n        \"2014-08-11 13:00:00\",\n        4293.0\n      ],\n      [\n        \"2014-08-11 14:00:00\",\n        4393.0\n      ],\n      [\n        \"2014-08-11 15:00:00\",\n        4384.0\n      ],\n      [\n        \"2014-08-11 16:00:00\",\n        4495.0\n      ],\n      [\n        \"2014-08-11 17:00:00\",\n        4374.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/electricity\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 22880.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 3424.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_forecast.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings. Refer to Section 4.1.3 in the Time Series Prediction Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_forecast.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/electricity \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=date \\\n-o Train.target_cols=OT \\\n-o Train.freq=1h \\\n-o Train.input_len=96 \\\n-o Train.predict_len=96\n

PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single instance testing (predict);
  • device: Training device, options include cpu, gpu, xpu, npu, mlu; check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Target variable columns, set the column name(s) of the time series dataset's target variable(s) based on your data. Multiple columns can be separated by commas;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • input_len: The length of historical time series input to the model; the input length should be considered comprehensively with the prediction length. Generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy.
  • predict_len: The length of the future sequence that the model is expected to predict; the prediction length should be considered comprehensively with the actual scenario. Generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy.
  • patience: The parameter for the early stopping mechanism, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; the larger the patience value, the longer the training time. For more hyperparameter introductions, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_forecast.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/electricity \\\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including mse and mae.

"},{"location":"en/practical_tutorials/ts_forecast.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series forecast:

It is recommended to follow the method of controlled variables when debugging parameters: 1. Initial Setup: Set the training epochs to 5, batch size to 16, and input length to 96.

  1. Experiments with DLinear Model and Launch three experiments with learning rates: 0.0001, 0.001, 0.01.

  2. Learning Rate Exploration: Experiment 2 yields the highest accuracy. Therefore, fix the learning rate at 0.001 and increase the training epochs to 30. Note: Due to the built-in early stopping mechanism for temporal tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. To adjust the patience epochs, modify the patience hyperparameter in the advanced configuration.

  3. Increasing Training Epochs and Input Length.

After increasing the training epochs, Experiment 4 achieves the highest accuracy. Next, increase the input length to 144 (using 144 hours of historical data to predict the next 96 hours), resulting in Experiment 5 with an accuracy of 0.188.

Learning Rate Exploration Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 1 5 0.0001 16 96 96 1 GPU 0.314 Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 3 5 0.01 16 96 96 1 GPU 0.320

Increasing Training Epochs Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 4 30 0.001 16 96 96 1 GPU 0.301

Increasing Input Length Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 4 30 0.001 16 96 96 1 GPU 0.301 Experiment 5 30 0.001 16 144 96 1 GPU 0.188"},{"location":"en/practical_tutorials/ts_forecast.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model and test using this power test data for prediction:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/test.csv\n
This will generate prediction results under ./output, with the predictions for test.csv saved in result.csv.

Similar to model training and evaluation, follow these steps: * Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml) * Specify the mode as model evaluation: -o Global.mode=evaluate * Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Configuration.

"},{"location":"en/practical_tutorials/ts_forecast.html#7integrationdeployment","title":"7.Integration/Deployment","text":"

If the general-purpose time series forecast pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series forecast pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_forecast\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series forecast Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series forecast pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PPaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/support_list/model_list_dcu.html","title":"PaddleX Model List (Hygon DCU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. The specific models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/model_list_dcu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Storage Size (M) Model Download Link ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_dcu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Storage Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model

Note: The above accuracy metrics are mIoU on the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html","title":"PaddleX Model List (Cambricon MLU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_mlu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_mlu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_mlu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_mlu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_mlu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_mlu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html","title":"PaddleX Model List (Huawei Ascend NPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_npu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link CLIP_vit_base_patch16_224 85.36 306.5 M Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 1.04 G Inference Model/Trained Model ConvNeXt_base_224 83.84 313.9 M Inference Model/Trained Model ConvNeXt_base_384 84.90 313.9 M Inference Model/Trained Model ConvNeXt_large_224 84.26 700.7 M Inference Model/Trained Model ConvNeXt_large_384 85.27 700.7 M Inference Model/Trained Model ConvNeXt_small 83.13 178.0 M Inference Model/Trained Model ConvNeXt_tiny 82.03 101.4 M Inference Model/Trained Model MobileNetV1_x0_5 63.5 4.8 M Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.8 M Inference Model/Trained Model MobileNetV1_x0_75 68.8 9.3 M Inference Model/Trained Model MobileNetV1_x1_0 71.0 15.2 M Inference Model/Trained Model MobileNetV2_x0_5 65.0 7.1 M Inference Model/Trained Model MobileNetV2_x0_25 53.2 5.5 M Inference Model/Trained Model MobileNetV2_x1_0 72.2 12.6 M Inference Model/Trained Model MobileNetV2_x1_5 74.1 25.0 M Inference Model/Trained Model MobileNetV2_x2_0 75.2 41.2 M Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model MobileNetV4_conv_large 83.4 125.2 M Inference Model/Trained Model MobileNetV4_conv_medium 79.9 37.6 M Inference Model/Trained Model MobileNetV4_conv_small 74.6 14.7 M Inference Model/Trained Model PP-HGNet_base 85.0 249.4 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-HGNet_tiny 79.83 52.4 M Inference Model/Trained Model PP-HGNetV2-B0 77.77 21.4 M Inference Model/Trained Model PP-HGNetV2-B1 79.18 22.6 M Inference Model/Trained Model PP-HGNetV2-B2 81.74 39.9 M Inference Model/Trained Model PP-HGNetV2-B3 82.98 57.9 M Inference Model/Trained Model PP-HGNetV2-B4 83.57 70.4 M Inference Model/Trained Model PP-HGNetV2-B5 84.75 140.8 M Inference Model/Trained Model PP-HGNetV2-B6 86.30 268.4 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model PP-LCNetV2_base 77.05 23.7 M Inference Model/Trained Model PP-LCNetV2_large 78.51 37.3 M Inference Model/Trained Model PP-LCNetV2_small 73.97 14.6 M Inference Model/Trained Model ResNet18_vd 72.3 41.5 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34_vd 76.0 77.3 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50_vd 79.1 90.8 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101_vd 80.2 158.4 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152_vd 80.6 214.3 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model ResNet200_vd 80.9 266.0 M Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 310.5 M Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 311.4 M Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 694.8 M Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 696.1 M Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 175.6 M Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_npu.html#_1","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link CLIP_vit_base_patch16_448_ML 89.15 325.6 M Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 39.6 M PP-HGNetV2-B4_ML 87.96 88.5 M Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 286.5 M Inference Model/Trained Model Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"en/support_list/model_list_npu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 245.4 M Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 246.2 M Inference Model/Trained Model CenterNet-DLA-34 37.6 75.4 M Inference Model/Trained Model CenterNet-ResNet50 38.9 319.7 M Inference Model/Trained Model DETR-R50 42.3 159.3 M Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 137.5 M Inference Model/Trained Model FasterRCNN-ResNet50 36.7 120.2 M Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet101 39.0 188.1 M Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 216.3 M Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 360.6 M Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 159.8 M Inference Model/Trained Model FCOS-ResNet50 39.6 124.2 M Inference Model/Trained Model PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-M 37.5 16.8 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PicoDet-XS 26.2 5.7M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model RT-DETR-H 56.3 435.8 M Inference Model/Trained Model RT-DETR-L 53.0 113.7 M Inference Model/Trained Model RT-DETR-R18 46.5 70.7 M Inference Model/Trained Model RT-DETR-R50 53.1 149.1 M Inference Model/Trained Model RT-DETR-X 54.8 232.9 M Inference Model/Trained Model YOLOv3-DarkNet53 39.1 219.7 M Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 83.8 M Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 163.0 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set mAP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_2","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE_plus_SOD-S 25.1 77.3 M Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 325.0 M Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 340.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_3","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_human 48.0 196.1 M Inference Model/Trained Model PP-YOLOE-S_human 42.5 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model Deeplabv3-R50 79.90 138.3 M Inference Model/Trained Model Deeplabv3-R101 80.85 205.9 M Inference Model/Trained Model OCRNet_HRNet-W48 82.15 249.8 M Inference Model/Trained Model PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for Cityscapes dataset mIoU.

"},{"location":"en/support_list/model_list_npu.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP Model Size (M) Model Download Link Mask-RT-DETR-H 50.6 449.9 M Inference Model/Trained Model Mask-RT-DETR-L 45.7 113.6 M Inference Model/Trained Model Mask-RT-DETR-M 42.7 66.6 M Inference Model/Trained Model Mask-RT-DETR-S 41.0 51.8 M Inference Model/Trained Model Mask-RT-DETR-X 47.5 237.5 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 254.8 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 254.7 M Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50 32.8 127.8 M Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 225.4 M Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 225.1 M Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 370.0 M Inference Model/Trained Model PP-YOLOE_seg-S 32.5 31.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set Mask AP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_4","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_rec_CLIP_vit_base 88.69 306.6 M Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 1.05 G Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"en/support_list/model_list_npu.html#_5","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_det 41.5 27.6 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_6","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_vehicle 63.9 196.1 M Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_7","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link STFPM 96.2 21.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"en/support_list/model_list_npu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_npu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_SVTRv2_rec 68.81 73.9 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_RepSVTR_rec 65.07 22.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/model_list_npu.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) Model Size (M) Model Download Link SLANet 76.31 6.9 M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PubtabNet English table recognition dataset.

"},{"location":"en/support_list/model_list_npu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 22.6 M Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 470.1 M Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 470.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_npu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name MSE MAE Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Inference Model/Trained Model PatchTST 0.385 0.397 2.0M Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model TiDE 0.405 0.412 31.7M Inference Model/Trained Model TimesNet 0.417 0.431 4.9M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall F1-Score Model Size (M) Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52K Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112K Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8M Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320K Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/model_list_npu.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name Acc (%) Model Size (M) Model Download Link TimesNet_cls 87.5 792K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary: Training, Evaluation datasets.

"},{"location":"en/support_list/model_list_xpu.html","title":"PaddleX Model List (Kunlun XPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_xpu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_xpu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_xpu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_xpu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_xpu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_xpu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_xpu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html","title":"PaddleX Model List\uff08CPU/GPU\uff09","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module includes various models. You can choose which models to use based on the benchmark data below. If you prioritize model accuracy, select models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/models_list.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_224 85.36 13.1957 285.493 306.5 M CLIP_vit_base_patch16_224.yaml Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 51.1284 1131.28 1.04 G CLIP_vit_large_patch14_224.yaml Inference Model/Trained Model ConvNeXt_base_224 83.84 12.8473 1513.87 313.9 M ConvNeXt_base_224.yaml Inference Model/Trained Model ConvNeXt_base_384 84.90 31.7607 3967.05 313.9 M ConvNeXt_base_384.yaml Inference Model/Trained Model ConvNeXt_large_224 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_224.yaml Inference Model/Trained Model ConvNeXt_large_384 85.27 66.4058 6598.92 700.7 M ConvNeXt_large_384.yaml Inference Model/Trained Model ConvNeXt_small 83.13 9.74075 1127.6 178.0 M ConvNeXt_small.yaml Inference Model/Trained Model ConvNeXt_tiny 82.03 5.48923 672.559 101.4 M ConvNeXt_tiny.yaml Inference Model/Trained Model FasterNet-L 83.5 23.4415 - 357.1 M FasterNet-L.yaml Inference Model/Trained Model FasterNet-M 83.0 21.8936 - 204.6 M FasterNet-M.yaml Inference Model/Trained Model FasterNet-S 81.3 13.0409 - 119.3 M FasterNet-S.yaml Inference Model/Trained Model FasterNet-T0 71.9 12.2432 - 15.1 M FasterNet-T0.yaml Inference Model/Trained Model FasterNet-T1 75.9 11.3562 - 29.2 M FasterNet-T1.yaml Inference Model/Trained Model FasterNet-T2 79.1 10.703 - 57.4 M FasterNet-T2.yaml Inference Model/Trained Model MobileNetV1_x0_5 63.5 1.86754 7.48297 4.8 M MobileNetV1_x0_5.yaml Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_25.yaml Inference Model/Trained Model MobileNetV1_x0_75 68.8 2.57903 10.6343 9.3 M MobileNetV1_x0_75.yaml Inference Model/Trained Model MobileNetV1_x1_0 71.0 2.78781 13.98 15.2 M MobileNetV1_x1_0.yaml Inference Model/Trained Model MobileNetV2_x0_5 65.0 4.94234 11.1629 7.1 M MobileNetV2_x0_5.yaml Inference Model/Trained Model MobileNetV2_x0_25 53.2 4.50856 9.40991 5.5 M MobileNetV2_x0_25.yaml Inference Model/Trained Model MobileNetV2_x1_0 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_0.yaml Inference Model/Trained Model MobileNetV2_x1_5 74.1 6.28385 22.5129 25.0 M MobileNetV2_x1_5.yaml Inference Model/Trained Model MobileNetV2_x2_0 75.2 6.12888 30.8612 41.2 M MobileNetV2_x2_0.yaml Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 6.31302 14.5588 9.6 M MobileNetV3_large_x0_5.yaml Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_35.yaml Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x0_75.yaml Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_0.yaml Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 8.73358 22.1296 26.5 M MobileNetV3_large_x1_25.yaml Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_5.yaml Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_35.yaml Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x0_75.yaml Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_0.yaml Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 6.9589 14.3995 13.0 M MobileNetV3_small_x1_25.yaml Inference Model/Trained Model MobileNetV4_conv_large 83.4 12.5485 51.6453 125.2 M MobileNetV4_conv_large.yaml Inference Model/Trained Model MobileNetV4_conv_medium 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_medium.yaml Inference Model/Trained Model MobileNetV4_conv_small 74.6 5.24172 11.0893 14.7 M MobileNetV4_conv_small.yaml Inference Model/Trained Model MobileNetV4_hybrid_large 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_large.yaml Inference Model/Trained Model MobileNetV4_hybrid_medium 80.5 19.7543 62.2624 42.9 M MobileNetV4_hybrid_medium.yaml Inference Model/Trained Model PP-HGNet_base 85.0 14.2969 327.114 249.4 M PP-HGNet_base.yaml Inference Model/Trained Model PP-HGNet_small 81.51 5.50661 119.041 86.5 M PP-HGNet_small.yaml Inference Model/Trained Model PP-HGNet_tiny 79.83 5.22006 69.396 52.4 M PP-HGNet_tiny.yaml Inference Model/Trained Model PP-HGNetV2-B0 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B0.yaml Inference Model/Trained Model PP-HGNetV2-B1 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B1.yaml Inference Model/Trained Model PP-HGNetV2-B2 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B2.yaml Inference Model/Trained Model PP-HGNetV2-B3 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B3.yaml Inference Model/Trained Model PP-HGNetV2-B4 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B4.yaml Inference Model/Trained Model PP-HGNetV2-B5 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B5.yaml Inference Model/Trained Model PP-HGNetV2-B6 86.30 21.226 255.279 268.4 M PP-HGNetV2-B6.yaml Inference Model/Trained Model PP-LCNet_x0_5 63.14 3.67722 6.66857 6.7 M PP-LCNet_x0_5.yaml Inference Model/Trained Model PP-LCNet_x0_25 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_25.yaml Inference Model/Trained Model PP-LCNet_x0_35 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_35.yaml Inference Model/Trained Model PP-LCNet_x0_75 68.18 3.91032 8.06953 8.4 M PP-LCNet_x0_75.yaml Inference Model/Trained Model PP-LCNet_x1_0 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_0.yaml Inference Model/Trained Model PP-LCNet_x1_5 73.71 3.97666 12.3457 16.0 M PP-LCNet_x1_5.yaml Inference Model/Trained Model PP-LCNet_x2_0 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_0.yaml Inference Model/Trained Model PP-LCNet_x2_5 76.60 4.06028 21.5063 32.1 M PP-LCNet_x2_5.yaml Inference Model/Trained Model PP-LCNetV2_base 77.05 5.23428 19.6005 23.7 M PP-LCNetV2_base.yaml Inference Model/Trained Model PP-LCNetV2_large 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_large.yaml Inference Model/Trained Model PP-LCNetV2_small 73.97 3.89762 13.0273 14.6 M PP-LCNetV2_small.yaml Inference Model/Trained Model ResNet18_vd 72.3 3.53048 31.3014 41.5 M ResNet18_vd.yaml Inference Model/Trained Model ResNet18 71.0 2.4868 27.4601 41.5 M ResNet18.yaml Inference Model/Trained Model ResNet34_vd 76.0 5.60675 56.0653 77.3 M ResNet34_vd.yaml Inference Model/Trained Model ResNet34 74.6 4.16902 51.925 77.3 M ResNet34.yaml Inference Model/Trained Model ResNet50_vd 79.1 10.1885 68.446 90.8 M ResNet50_vd.yaml Inference Model/Trained Model ResNet50 76.5 9.62383 64.8135 90.8 M ResNet50.yaml Inference Model/Trained Model ResNet101_vd 80.2 20.0563 124.85 158.4 M ResNet101_vd.yaml Inference Model/Trained Model ResNet101 77.6 19.2297 121.006 158.7 M ResNet101.yaml Inference Model/Trained Model ResNet152_vd 80.6 29.6439 181.678 214.3 M ResNet152_vd.yaml Inference Model/Trained Model ResNet152 78.3 30.0461 177.707 214.2 M ResNet152.yaml Inference Model/Trained Model ResNet200_vd 80.9 39.1628 235.185 266.0 M ResNet200_vd.yaml Inference Model/Trained Model StarNet-S1 73.6 9.895 23.0465 11.2 M StarNet-S1.yaml Inference Model/Trained Model StarNet-S2 74.8 7.91279 21.9571 14.3 M StarNet-S2.yaml Inference Model/Trained Model StarNet-S3 77.0 10.7531 30.7656 22.2 M StarNet-S3.yaml Inference Model/Trained Model StarNet-S4 79.0 15.2868 43.2497 28.9 M StarNet-S4.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 16.9848 383.83 310.5 M SwinTransformer_base_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 37.2855 1178.63 311.4 M SwinTransformer_base_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 74.1768 2105.22 696.1 M SwinTransformer_large_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 16.3982 285.56 175.6 M SwinTransformer_small_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 8.54846 156.306 100.1 M SwinTransformer_tiny_patch4_window7_224.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on the ImageNet-1k validation set.

"},{"location":"en/support_list/models_list.html#image-multi-label-classification-module","title":"Image Multi-Label Classification Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_448_ML 89.15 - - 325.6 M CLIP_vit_base_patch16_448_ML.yaml Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 - - 39.6 M PP-HGNetV2-B0_ML.yaml Inference Model/Trained Model PP-HGNetV2-B4_ML 87.96 - - 88.5 M PP-HGNetV2-B4_ML.yaml Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 - - 286.5 M PP-HGNetV2-B6_ML.yaml Inference Model/Trained Model PP-LCNet_x1_0_ML 77.96 - - 29.4 M PP-LCNet_x1_0_ML.yaml Inference Model/Trained Model ResNet50_ML 83.50 - - 108.9 M ResNet50_ML.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/support_list/models_list.html#pedestrian-attribute-module","title":"Pedestrian Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_pedestrian_attribute 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#vehicle-attribute-module","title":"Vehicle Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_vehicle_attribute 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on the VeRi dataset.

"},{"location":"en/support_list/models_list.html#image-feature-module","title":"Image Feature Module","text":"Model Name recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2_rec.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_base.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G PP-ShiTuV2_rec_CLIP_vit_large.yaml Inference Model/Trained Model

Note: The above accuracy metrics are recall@1 on AliProducts.

"},{"location":"en/support_list/models_list.html#document-orientation-classification-module","title":"Document Orientation Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_doc_ori 99.26 3.84845 9.23735 7.1 M PP-LCNet_x1_0_doc_ori.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#face-feature-module","title":"Face Feature Module","text":"Model Name Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link MobileFaceNet 128 96.28/96.71/99.58 4.1 MobileFaceNet.yaml Inference Model/Trained Model ResNet50_face 512 98.12/98.56/99.77 87.2 ResNet50_face.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively.

"},{"location":"en/support_list/models_list.html#main-body-detection-module","title":"Main Body Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_det 41.5 33.7426 537.003 27.6 M PP-ShiTuV2_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PaddleClas main body detection dataset.

"},{"location":"en/support_list/models_list.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 - - 245.4 M Cascade-FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 - - 246.2 M Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model CenterNet-DLA-34 37.6 - - 75.4 M CenterNet-DLA-34.yaml Inference Model/Trained Model CenterNet-ResNet50 38.9 - - 319.7 M CenterNet-ResNet50.yaml Inference Model/Trained Model DETR-R50 42.3 59.2132 5334.52 159.3 M DETR-R50.yaml Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 - - 137.5 M FasterRCNN-ResNet34-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 - - 148.1 M FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50 36.7 - - 120.2 M FasterRCNN-ResNet50.yaml Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 - - 216.3 M FasterRCNN-ResNet101-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet101 39.0 - - 188.1 M FasterRCNN-ResNet101.yaml Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 - - 360.6 M FasterRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 - - 159.8 M FasterRCNN-Swin-Tiny-FPN.yaml Inference Model/Trained Model FCOS-ResNet50 39.6 103.367 3424.91 124.2 M FCOS-ResNet50.yaml Inference Model/Trained Model PicoDet-L 42.6 16.6715 169.904 20.9 M PicoDet-L.yaml Inference Model/Trained Model PicoDet-M 37.5 16.2311 71.7257 16.8 M PicoDet-M.yaml Inference Model/Trained Model PicoDet-S 29.1 14.097 37.6563 4.4 M PicoDet-S.yaml Inference Model/Trained Model PicoDet-XS 26.2 13.8102 48.3139 5.7M PicoDet-XS.yaml Inference Model/Trained Model PP-YOLOE_plus-L 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus-L.yaml Inference Model/Trained Model PP-YOLOE_plus-M 49.8 19.843 449.261 83.2 M PP-YOLOE_plus-M.yaml Inference Model/Trained Model PP-YOLOE_plus-S 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-S.yaml Inference Model/Trained Model PP-YOLOE_plus-X 54.7 57.8995 1439.93 349.4 M PP-YOLOE_plus-X.yaml Inference Model/Trained Model RT-DETR-H 56.3 114.814 3933.39 435.8 M RT-DETR-H.yaml Inference Model/Trained Model RT-DETR-L 53.0 34.5252 1454.27 113.7 M RT-DETR-L.yaml Inference Model/Trained Model RT-DETR-R18 46.5 19.89 784.824 70.7 M RT-DETR-R18.yaml Inference Model/Trained Model RT-DETR-R50 53.1 41.9327 1625.95 149.1 M RT-DETR-R50.yaml Inference Model/Trained Model RT-DETR-X 54.8 61.8042 2246.64 232.9 M RT-DETR-X.yaml Inference Model/Trained Model YOLOv3-DarkNet53 39.1 40.1055 883.041 219.7 M YOLOv3-DarkNet53.yaml Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 18.6692 267.214 83.8 M YOLOv3-MobileNetV3.yaml Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 31.6276 856.047 163.0 M YOLOv3-ResNet50_vd_DCN.yaml Inference Model/Trained Model YOLOX-L 50.1 185.691 1250.58 192.5 M YOLOX-L.yaml Inference Model/Trained Model YOLOX-M 46.9 123.324 688.071 90.0 M YOLOX-M.yaml Inference Model/Trained Model YOLOX-N 26.1 79.1665 155.59 3.4 M YOLOX-N.yaml Inference Model/Trained Model YOLOX-S 40.4 184.828 474.446 32.0 M YOLOX-S.yaml Inference Model/Trained Model YOLOX-T 32.9 102.748 212.52 18.1 M YOLOX-T.yaml Inference Model/Trained Model YOLOX-X 51.8 227.361 2067.84 351.5 M YOLOX-X.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/models_list.html#small-object-detection-module","title":"Small Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE_plus_SOD-S 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-S.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-L.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 458.521 11172.7 340.5 M PP-YOLOE_plus_SOD-largesize-L.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the VisDrone-DET validation set.

"},{"location":"en/support_list/models_list.html#pedestrian-detection-module","title":"Pedestrian Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_human 48.0 32.7754 777.691 196.1 M PP-YOLOE-L_human.yaml Inference Model/Trained Model PP-YOLOE-S_human 42.5 15.0118 179.317 28.8 M PP-YOLOE-S_human.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman validation set.

"},{"location":"en/support_list/models_list.html#vehicle-detection-module","title":"Vehicle Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_vehicle 63.9 32.5619 775.633 196.1 M PP-YOLOE-L_vehicle.yaml Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 15.3787 178.441 28.8 M PP-YOLOE-S_vehicle.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set.

"},{"location":"en/support_list/models_list.html#face-detection-module","title":"Face Detection Module","text":"Model AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link BlazeFace 77.7/73.4/49.5 0.447 BlazeFace.yaml Inference Model/Trained Model BlazeFace-FPN-SSH 83.2/80.5/60.5 0.606 BlazeFace-FPN-SSH.yaml Inference Model/Trained Model PicoDet_LCNet_x2_5_face 93.7/90.7/68.1 28.9 PicoDet_LCNet_x2_5_face.yaml Inference Model/Trained Model PP-YOLOE_plus-S_face 93.9/91.8/79.8 26.5 PP-YOLOE_plus-S_face Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640.

"},{"location":"en/support_list/models_list.html#abnormality-detection-module","title":"Abnormality Detection Module","text":"Model Name Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link STFPM 96.2 - - 21.5 M STFPM.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the MVTec AD dataset using the average anomaly score.

"},{"location":"en/support_list/models_list.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Deeplabv3_Plus-R50 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R50.yaml Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 100.026 2460.71 162.5 M Deeplabv3_Plus-R101.yaml Inference Model/Trained Model Deeplabv3-R50 79.90 82.2631 1735.83 138.3 M Deeplabv3-R50.yaml Inference Model/Trained Model Deeplabv3-R101 80.85 121.492 2685.51 205.9 M Deeplabv3-R101.yaml Inference Model/Trained Model OCRNet_HRNet-W18 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W18.yaml Inference Model/Trained Model OCRNet_HRNet-W48 82.15 78.9976 2226.95 249.8 M OCRNet_HRNet-W48.yaml Inference Model/Trained Model PP-LiteSeg-T 73.10 7.6827 138.683 28.5 M PP-LiteSeg-T.yaml Inference Model/Trained Model PP-LiteSeg-B 75.25 10.9935 194.727 47.0 M PP-LiteSeg-B.yaml Inference Model/Trained Model SegFormer-B0 (slice) 76.73 11.1946 268.929 13.2 M SegFormer-B0.yaml Inference Model/Trained Model SegFormer-B1 (slice) 78.35 17.9998 403.393 48.5 M SegFormer-B1.yaml Inference Model/Trained Model SegFormer-B2 (slice) 81.60 48.0371 1248.52 96.9 M SegFormer-B2.yaml Inference Model/Trained Model SegFormer-B3 (slice) 82.47 64.341 1666.35 167.3 M SegFormer-B3.yaml Inference Model/Trained Model SegFormer-B4 (slice) 82.38 82.4336 1995.42 226.7 M SegFormer-B4.yaml Inference Model/Trained Model SegFormer-B5 (slice) 82.58 97.3717 2420.19 229.7 M SegFormer-B5.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the Cityscapes dataset using mIoU.

Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SeaFormer_base(slice) 40.92 24.4073 397.574 30.8 M SeaFormer_base.yaml Inference Model/Trained Model SeaFormer_large (slice) 43.66 27.8123 550.464 49.8 M SeaFormer_large.yaml Inference Model/Trained Model SeaFormer_small (slice) 38.73 19.2295 358.343 14.3 M SeaFormer_small.yaml Inference Model/Trained Model SeaFormer_tiny (slice) 34.58 13.9496 330.132 6.1 M SeaFormer_tiny.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the ADE20k dataset. \"slice\" indicates that the input image has been cropped.

"},{"location":"en/support_list/models_list.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Mask-RT-DETR-H 50.6 132.693 4896.17 449.9 M Mask-RT-DETR-H.yaml Inference Model/Trained Model Mask-RT-DETR-L 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-L.yaml Inference Model/Trained Model Mask-RT-DETR-M 42.7 36.8329 - 66.6 M Mask-RT-DETR-M.yaml Inference Model/Trained Model Mask-RT-DETR-S 41.0 33.5007 - 51.8 M Mask-RT-DETR-S.yaml Inference Model/Trained Model Mask-RT-DETR-X 47.5 75.755 3358.04 237.5 M Mask-RT-DETR-X.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 - - 254.8 M Cascade-MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 - - 254.7 M Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 - - 157.5 M MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 - - 157.5 M MaskRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50 32.8 - - 127.8 M MaskRCNN-ResNet50.yaml Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 - - 225.4 M MaskRCNN-ResNet101-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 - - 225.1 M MaskRCNN-ResNet101-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 - - 370.0 M MaskRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model PP-YOLOE_seg-S 32.5 - - 31.5 M PP-YOLOE_seg-S.yaml Inference Model/Trained Model

|SOLOv2| 35.5|-|-|179.1 M|SOLOv2.yaml

Note: The above accuracy metrics are evaluated on the COCO2017 validation set using Mask AP(0.5:0.95).

"},{"location":"en/support_list/models_list.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_det 77.79 10.6923 120.177 4.2 M PP-OCRv4_mobile_det.yaml Inference Model/Trained Model PP-OCRv4_server_det 82.69 83.3501 2434.01 100.1M PP-OCRv4_server_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection.

"},{"location":"en/support_list/models_list.html#seal-text-detection-module","title":"Seal Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7 M PP-OCRv4_mobile_seal_det.yaml Inference Model/Trained Model PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built seal dataset by PaddleX, containing 500 seal images.

"},{"location":"en/support_list/models_list.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_rec 78.20 7.95018 46.7868 10.6 M PP-OCRv4_mobile_rec.yaml Inference Model/Trained Model PP-OCRv4_server_rec 79.20 7.19439 140.179 71.2 M PP-OCRv4_server_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_SVTRv2_rec 68.81 8.36801 165.706 73.9 M ch_SVTRv2_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_RepSVTR_rec 65.07 10.5047 51.5647 22.1 M ch_RepSVTR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/models_list.html#formula-recognition-module","title":"Formula Recognition Module","text":"Model Name BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link LaTeX_OCR_rec 0.8821 0.0823 40.01 - - 89.7 M LaTeX_OCR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/support_list/models_list.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SLANet 59.52 522.536 1845.37 6.9 M SLANet.yaml Inference Model/Trained Model SLANet_plus 63.69 522.536 1845.37 6.9 M SLANet_plus.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#image-rectification-module","title":"Image Rectification Module","text":"Model Name MS-SSIM (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link UVDoc 54.40 - - 30.3 M UVDoc.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on a self-built image rectification dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#layout-detection-module","title":"Layout Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PicoDet_layout_1x 86.8 13.036 91.2634 7.4 M PicoDet_layout_1x.yaml Inference Model/Trained Model PicoDet-S_layout_3cls 87.1 13.521 45.7633 4.8 M PicoDet-S_layout_3cls.yaml Inference Model/Trained Model PicoDet-S_layout_17cls 70.3 13.5632 46.2059 4.8 M PicoDet-S_layout_17cls.yaml Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 15.7425 159.771 22.6 M PicoDet-L_layout_3cls.yaml Inference Model/Trained Model PicoDet-L_layout_17cls 79.9 17.1901 160.262 22.6 M PicoDet-L_layout_17cls.yaml Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 114.644 3832.62 470.1 M RT-DETR-H_layout_3cls.yaml Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 115.126 3827.25 470.2 M RT-DETR-H_layout_17cls.yaml Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is the PaddleX self-built Layout Detection Dataset, containing 10,000 images.

"},{"location":"en/support_list/models_list.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size YAML File Model Download Link DLinear 0.382 0.394 72 K DLinear.yaml Inference Model/Trained Model NLinear 0.386 0.392 40 K NLinear.yaml Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Nonstationary.yaml Inference Model/Trained Model PatchTST 0.385 0.397 2.0 M PatchTST.yaml Inference Model/Trained Model RLinear 0.384 0.392 40 K RLinear.yaml Inference Model/Trained Model TiDE 0.405 0.412 31.7 M TiDE.yaml Inference Model/Trained Model TimesNet 0.417 0.431 4.9 M TimesNet.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall f1_score Model Size YAML File Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52 K AutoEncoder_ad.yaml Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112 K DLinear_ad.yaml Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8 M Nonstationary_ad.yaml Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320 K PatchTST_ad.yaml Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3 M TimesNet_ad.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/models_list.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name acc (%) Model Size YAML File Model Download Link TimesNet_cls 87.5 792 K TimesNet_cls.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset.

>Note: All GPU inference times for the above models are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/support_list/pipelines_list.html","title":"PaddleX Pipelines (CPU/GPU)","text":""},{"location":"en/support_list/pipelines_list.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
Document Scene Information Extraction v3 Table Structure Recognition Online Experience Document Image Scene Information Extraction v3 (PP-ChatOCRv3-doc) is a PaddlePaddle-specific intelligent document and image analysis solution that integrates LLM and OCR technologies to solve common complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating the Wenxin large model, it combines vast data and knowledge, providing high accuracy and wide applicability. The open-source version supports local experience and deployment, and fine-tuning training for each module.
  • Construction of knowledge graphs
  • Detection of information related to specific events in online news and social media
  • Extraction and analysis of key information in academic literature (especially in scenarios requiring recognition of seals, distorted images, and more complex tables)
Layout Area Detection Text Detection Text Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
Multi-label Image Classification Multi-label Image Classification None Image multi-label classification is a technology that assigns an image to multiple related categories simultaneously. It is widely used in image tagging, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, such as both \"dog\" and \"outdoor\" labels in a single picture. By using deep learning models, image multi-label classification can automatically extract image features and perform accurate classification to provide more comprehensive information for users. This technology is significant in applications like intelligent search engines and automatic content generation.
  • Medical image diagnosis
  • Complex scene recognition
  • Multi-target monitoring
  • Product attribute recognition
  • Ecological environment monitoring
  • Security monitoring
  • Disaster warning
Small Object Detection Small Object Detection None Small object detection is a technology specifically for identifying small objects in images. It is widely used in surveillance, autonomous driving, and satellite image analysis. It can accurately find and classify small-sized objects like pedestrians, traffic signs, or small animals in complex scenes. By using deep learning algorithms and optimized convolutional neural networks, small object detection can effectively enhance the recognition ability of small objects, ensuring that important information is not missed in practical applications. This technology plays an important role in improving safety and automation levels.
  • Pedestrian detection in autonomous vehicles
  • Identification of small buildings in satellite images
  • Detection of small traffic signs in intelligent transportation systems
  • Identification of small intruding objects in security surveillance
  • Detection of small defects in industrial inspection
  • Monitoring of small animals in drone images
Image Anomaly Detection Image Anomaly Detection None Image anomaly detection is a technology that identifies images that deviate from or do not conform to normal patterns by analyzing their content. It is widely used in industrial quality inspection, medical image analysis, and security surveillance. By using machine learning and deep learning algorithms, image anomaly detection can automatically identify potential defects, anomalies, or abnormal behavior in images, helping us detect problems and take appropriate measures promptly. Image anomaly detection systems are designed to automatically detect and label abnormal situations in images to improve work efficiency and accuracy.
  • Industrial quality control
  • Medical image analysis
  • Anomaly detection in surveillance videos
  • Identification of violations in traffic monitoring
  • Obstacle detection in autonomous driving
  • Agricultural pest and disease monitoring
  • Pollutant identification in environmental monitoring
Layout Parsing Table Structure Recognition None Layout analysis is a technology for extracting structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has wide applications in document management, information extraction, and data digitization. By combining optical character recognition (OCR), image processing, and machine learning algorithms, layout analysis can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. This process typically includes three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data that enhances data processing efficiency and accuracy.
  • Financial and legal document analysis
  • Digitization of historical documents and archives
  • Automated form filling
  • Page structure analysis
Layout Area Detection Text Detection Text Recognition Formula Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification Formula Recognition Layout Area Detection None Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. By using computer vision and machine learning algorithms, formula recognition can convert complex mathematical formula information into an editable LaTeX format, facilitating further data processing and analysis by users.
  • Document digitization and retrieval
  • Formula search engine
  • Formula editor
  • Automated typesetting
Formula Recognition Seal Text Recognition Layout Area Detection None Seal text recognition is a technology that automatically extracts and recognizes seal content from documents or images. Recognizing seal text is part of document processing and has applications in many scenarios, such as contract comparison, inventory audit, and invoice reimbursement audit.
  • Contract and agreement validation
  • Check processing
  • Loan approval
  • Legal document management
Seal Text Detection Text Recognition"},{"location":"en/support_list/pipelines_list.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience Link Pipeline Introduction Applicable Scenarios Semi-supervised Learning for Large Models - Image Classification Semi-supervised Learning for Large Models - Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The general image classification pipeline is designed to solve image classification tasks for given images.
  • Commodity image classification
  • Artwork style classification
  • Crop disease and pest identification
  • Animal species recognition
  • Classification of land, water bodies, and buildings in satellite remote sensing images
Semi-supervised Learning for Large Models - Object Detection Semi-supervised Learning for Large Models - Object Detection Online Experience The semi-supervised learning for large models - object detection pipeline is a unique offering from PaddlePaddle. It utilizes a joint training approach with large and small models, leveraging a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below demonstrates the performance of this pipeline on the COCO dataset with 10% labeled data. After training with this pipeline, on COCO 10% labeled data + 90% unlabeled data, the large model (RT-DETR-H) achieves an 8.4% higher accuracy (47.7% -> 56.1%), setting a new state-of-the-art (SOTA) for this dataset. The small model (PicoDet-S) also achieves over 10% higher accuracy (18.3% -> 28.8%) compared to direct training.
  • Pedestrian, vehicle, and traffic sign detection in autonomous driving
  • Enemy facility and equipment detection in military reconnaissance
  • Seabed organism detection in deep-sea exploration
Semi-supervised Learning for Large Models - OCR Text Detection Online Experience The semi-supervised learning for large models - OCR pipeline is a unique OCR training pipeline from PaddlePaddle. It consists of a text detection model and a text recognition model working in series. The input image is first processed by the text detection model to obtain and rectify all text line bounding boxes, which are then fed into the text recognition model to generate OCR text results. In the text recognition part, a joint training approach with large and small models is adopted, utilizing a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below shows the effects of this pipeline in two OCR application scenarios, demonstrating significant improvements for both large and small models in different contexts.
  • Digitizing paper documents
  • Reading and verifying personal information on IDs, passports, and driver's licenses
  • Recognizing product information in retail
Large Model Semi-supervised Learning - Text Recognition General Scene Information Extraction v2 Text Detection Online Experience The General Scene Information Extraction Pipeline (PP-ChatOCRv2-common) is a unique intelligent analysis solution for complex documents from PaddlePaddle. It combines Large Language Models (LLMs) and OCR technology, leveraging the Wenxin Large Model to integrate massive data and knowledge, achieving high accuracy and wide applicability. The system flow of PP-ChatOCRv2-common is as follows: Input the prediction image, send it to the general OCR system, predict text through text detection and text recognition models, perform vector retrieval between the predicted text and user queries to obtain relevant text information, and finally pass these text information to the prompt generator to recombine them into prompts for the Wenxin Large Model to generate prediction results.
  • Key information extraction from various scenarios such as ID cards, bank cards, household registration books, train tickets, and paper invoices
Text Recognition"},{"location":"en/support_list/pipelines_list_dcu.html","title":"PaddleX Pipelines (DCU)","text":""},{"location":"en/support_list/pipelines_list_dcu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
"},{"location":"en/support_list/pipelines_list_dcu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_mlu.html","title":"PaddleX Pipelines (MLU)","text":""},{"location":"en/support_list/pipelines_list_mlu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis.
  • Stock prediction
  • Climate forecasting
  • Disease spread prediction
  • Energy demand forecasting
  • Traffic flow prediction
  • Product lifecycle prediction
  • Electric load forecasting
"},{"location":"en/support_list/pipelines_list_mlu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_npu.html","title":"PaddleX Pipelines (NPU)","text":""},{"location":"en/support_list/pipelines_list_npu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition General Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
"},{"location":"en/support_list/pipelines_list_npu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_xpu.html","title":"PaddleX Pipelines (XPU)","text":""},{"location":"en/support_list/pipelines_list_xpu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
"},{"location":"en/support_list/pipelines_list_xpu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"}]} \ No newline at end of file +var __index = {"config":{"lang":["en","zh"],"separator":"[\\s\\u200b\\-_,:!=\\[\\]()\"`/]+|\\.(?!\\d)|&[lg]t;|(?!\\b)(?=[A-Z][a-z])","pipeline":["stopWordFilter"]},"docs":[{"location":"en/index.html","title":"Home","text":""},{"location":"en/index.html#introduction","title":"\ud83d\udd0d Introduction","text":"

PaddleX 3.0 is a low-code development tool for AI models built on the PaddlePaddle framework. It integrates numerousready-to-use pre-trained models, enablingfull-process developmentfrom model training to inference, supportinga variety of mainstream hardware both domestic and international, and aiding AI developers in industrial practice.

Image Classification Multi-label Image Classification Object Detection Instance Segmentation Semantic Segmentation Image Anomaly Detection OCR Table Recognition PP-ChatOCRv3-doc Time Series Forecasting Time Series Anomaly Detection Time Series Classification"},{"location":"en/index.html#why-paddlex","title":"\ud83c\udf1f Why PaddleX ?","text":"

\ud83c\udfa8 Rich Models One-click Call: Integrate over 200 PaddlePaddle models covering multiple key areas such as OCR, object detection, and time series forecasting into 19 pipelines. Experience the model effects quickly through easy Python API calls. Also supports more than 20 modules for easy model combination use by developers.

\ud83d\ude80 High Efficiency and Low barrier of entry: Achieve model full-process development based on graphical interfaces and unified commands, creating 8 featured model pipelines that combine large and small models, semi-supervised learning of large models, and multi-model fusion, greatly reducing the cost of iterating models.

\ud83c\udf10 Flexible Deployment in Various Scenarios: Support various deployment methods such as high-performance inference, service deployment, and lite deployment to ensure efficient operation and rapid response of models in different application scenarios.

\ud83d\udd27 Efficient Support for Mainstream Hardware: Support seamless switching of various mainstream hardware such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU to ensure efficient operation.

"},{"location":"en/index.html#recent-updates","title":"\ud83d\udce3 Recent Updates","text":"

\ud83d\udd25\ud83d\udd25 \"PaddleX Document Information Personalized Extraction Upgrade\", PP-ChatOCRv3 innovatively provides custom development functions for OCR models based on data fusion technology, offering stronger model fine-tuning capabilities. Millions of high-quality general OCR text recognition data are automatically integrated into vertical model training data at a specific ratio, solving the problem of weakened general text recognition capabilities caused by vertical model training in the industry. Suitable for practical scenarios in industries such as automated office, financial risk control, healthcare, education and publishing, and legal and government sectors. October 24th (Thursday) 19:00 Join our live session for an in-depth analysis of the open-source version of PP-ChatOCRv3 and the outstanding advantages of PaddleX 3.0 Beta1 in terms of accuracy and speed. Registration Link

\u2757 more courses

\ud83d\udd25\ud83d\udd25 9.30, 2024, PaddleX 3.0 Beta1 open source version is officially released, providing more than 200 models that can be called with a simple Python API; achieve model full-process development based on unified commands, and open source the basic capabilities of the PP-ChatOCRv3 pipeline; support more than 100 models for high-performance inference and service-oriented deployment (iterating continuously), more than 7 key visual models for edge-deployment; more than 70 models have been adapted for the full development process of Ascend 910B, more than 15 models have been adapted for the full development process of Kunlun chips and Cambricon

\ud83d\udd25 6.27, 2024, PaddleX 3.0 Beta open source version is officially released, supporting the use of various mainstream hardware for pipeline and model development in a low-code manner on the local side.

\ud83d\udd25 3.25, 2024, PaddleX 3.0 cloud release, supporting the creation of pipelines in the AI Studio Galaxy Community in a zero-code manner.

more

"},{"location":"en/index.html#explanation-of-pipeline","title":"\ud83d\udd20 Explanation of Pipeline","text":"

PaddleX is dedicated to achieving pipeline-level model training, inference, and deployment. A pipeline refers to a series of predefined development processes for specific AI tasks, which includes a combination of single models (single-function modules) capable of independently completing a certain type of task.

"},{"location":"en/index.html#what-can-paddlex-do","title":"\ud83d\udcca What can PaddleX do\uff1f","text":"

All pipelines of PaddleX support online experience on AI Studio and local fast inference. You can quickly experience the effects of each pre-trained pipeline. If you are satisfied with the effects of the pre-trained pipeline, you can directly perform high-performance inference / serving deployment / edge deployment on the pipeline. If not satisfied, you can also Custom Development to improve the pipeline effect. For the complete pipeline development process, please refer to the PaddleX pipeline Development Tool Local Use Tutorial.

In addition, PaddleX provides developers with a full-process efficient model training and deployment tool based on a cloud-based GUI. Developers do not need code development, just need to prepare a dataset that meets the pipeline requirements to quickly start model training. For details, please refer to the tutorial \"Developing Industrial-level AI Models with Zero Barrier\".

Pipeline Online Experience Local Inference High-Performance Inference Service-Oriented Deployment Edge Deployment Custom Development Zero-Code Development On AI Studio OCR Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 PP-ChatOCRv3 Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Table Recognition Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Object Detection Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Instance Segmentation Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Image Classification Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Semantic Segmentation Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Time Series Forecasting Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Anomaly Detection Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Classification Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Small Object Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Multi-label Image Classification \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Anomaly Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Layout Parsing \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Formula Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Seal Recognition \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Pedestrian Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Vehicle Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Face Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7

\u2757Note: The above capabilities are implemented based on GPU/CPU. PaddleX can also perform local inference and custom development on mainstream hardware such as Kunlunxin, Ascend, Cambricon, and Haiguang. The table below details the support status of the pipelines. For specific supported model lists, please refer to the Model List (Kunlunxin XPU)/Model List (Ascend NPU)/Model List (Cambricon MLU)/Model List (Haiguang DCU). We are continuously adapting more models and promoting the implementation of high-performance and service-oriented deployment on mainstream hardware.

\ud83d\udd25\ud83d\udd25 Support for Domestic Hardware Capabilities

Pipeline Ascend 910B Kunlunxin R200/R300 Cambricon MLU370X8 Haiguang Z100 OCR \u2705 \u2705 \u2705 \ud83d\udea7 Table Recognition \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Object Detection \u2705 \u2705 \u2705 \ud83d\udea7 Instance Segmentation \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Classification \u2705 \u2705 \u2705 \u2705 Semantic Segmentation \u2705 \u2705 \u2705 \u2705 Time Series Forecasting \u2705 \u2705 \u2705 \ud83d\udea7 Time Series Anomaly Detection \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Time Series Classification \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7"},{"location":"en/index.html#discussion","title":"\ud83d\udcac Discussion","text":"

We warmly welcome and encourage community members to raise questions, share ideas, and feedback in the Discussions section. Whether you want to report a bug, discuss a feature request, seek help, or just want to keep up with the latest project news, this is a great platform.

"},{"location":"en/index.html#license","title":"\ud83d\udcc4 License","text":"

The release of this project is licensed under the Apache 2.0 license.

"},{"location":"en/CHANGLOG.html","title":"Version Update Information","text":""},{"location":"en/CHANGLOG.html#latest-version-information","title":"Latest Version Information","text":""},{"location":"en/CHANGLOG.html#paddlex-v300beta1-9302024","title":"PaddleX v3.0.0beta1 (9.30/2024)","text":"

PaddleX 3.0 Beta1 offers over 200 models accessible through a streamlined Python API for one-click deployment; realizes full-process model development based on unified commands, and opens source the foundational capabilities of the PP-ChatOCRv3 special model pipeline; supports high-performance inference and service-oriented deployment for over 100 models, as well as edge deployment for 7 key vision models; and fully adapts the development process of over 70 models to Huawei Ascend 910B, and over 15 models to XPU and MLU.

  • Rich Models with One-click Deployment: Integrates over 200 PaddlePaddle models across key domains such as document image intelligent analysis, OCR, object detection, and time series prediction into 13 model pipelines, enabling rapid model experience through a streamlined Python API. Additionally, supports over 20 individual functional modules for convenient model combination.
  • Enhanced Efficiency and Lowered Thresholds: Implements full-process model development based on a graphical interface and unified commands, creating 8 special model pipelines that combine large and small models, leverage large model semi-supervised learning, and multi-model fusion, significantly reducing iteration costs.
  • Flexible Deployment Across Scenarios: Supports various deployment methods including high-performance, service-oriented, and edge deployment, ensuring efficient model operation and rapid response across different application scenarios.
  • Efficient Support for Mainstream Hardware: Seamlessly switches between NVIDIA GPUs, XPU, Ascend, and MLU, ensuring efficient operation.
"},{"location":"en/CHANGLOG.html#paddlex-v300beta-6272024","title":"PaddleX v3.0.0beta (6.27/2024)","text":"

PaddleX 3.0beta integrates the advantages of the PaddlePaddle ecosystem, covering 7 major scenario tasks, constructs 16 model pipelines, and provides a low-code development mode to assist developers in realizing full-process model development on various mainstream hardware.

  • Basic Model Pipelines (Rich Models, Comprehensive Scenarios): Selects 68 high-quality PaddlePaddle models, covering tasks such as image classification, object detection, image segmentation, OCR, text image layout analysis, and time series prediction.
  • Special Model Pipelines (Significant Efficiency Improvement): Provides efficient solutions combining large and small models, large model semi-supervised learning, and multi-model fusion.
  • Low-code Development Mode (Convenient Development and Deployment): Offers both zero-code and low-code development methods.
  • Zero-code Development: Users can interactively submit background training tasks through a graphical user interface (GUI), bridging online and offline deployment, and supporting API-based online service invocation.
  • Low-code Development: Achieves full-process development across 16 model pipelines through unified API interfaces, while supporting user-defined model process serialization.
  • Multi-hardware Local Support (Strong Compatibility): Supports NVIDIA GPUs, XPU, Ascend, and MLU, enabling pure offline usage.
"},{"location":"en/CHANGLOG.html#paddlex-v210-12102021","title":"PaddleX v2.1.0 (12.10/2021)","text":"

Added the ultra-lightweight classification model PPLCNet, achieving approximately 5ms prediction speed for a single image on Intel CPUs, with a Top-1 Accuracy of 80.82% on the ImageNet-1K dataset, surpassing ResNet152's performance. Experience it now! Added the lightweight detection model PP-PicoDet, the first to surpass 30+ mAP(0.5:0.95) within 1M parameters (at 416px input), achieving up to 150FPS prediction on ARM CPUs. Experience it now! Upgraded PaddleX Restful API to support PaddlePaddle's dynamic graph development mode. Experience it now! Added negative sample training strategies for detection models. Experience it now! Added lightweight Python-based service deployment. Experience it now!

"},{"location":"en/CHANGLOG.html#paddlex-v200-9102021","title":"PaddleX v2.0.0 (9.10/2021)","text":"
  • PaddleX API
  • Added visualization of prediction results for detection and instance segmentation tasks, as well as analysis of prediction errors to assist in model effect analysis
  • Introduced negative sample optimization for detection tasks to suppress false detections in background regions
  • Improved prediction results for semantic segmentation tasks, supporting the return of predicted categories and normalized prediction confidence
  • Enhanced prediction results for image classification tasks, supporting the return of normalized prediction confidence
  • Prediction Deployment
  • Completed PaddleX Python prediction deployment, enabling rapid deployment with just 2 APIs
  • Comprehensively upgraded PaddleX C++ deployment, supporting end-to-end unified deployment capabilities for PaddlePaddle vision suites including PaddleDetection, PaddleClas, PaddleSeg, and PaddleX
  • Newly released Manufacture SDK, providing a pre-compiled PaddlePaddle deployment development kit (SDK) for industrial-grade multi-end and multi-platform deployment acceleration, enabling rapid inference deployment through configuring business logic flow files in a low-code manner
  • PaddleX GUI
  • Upgraded PaddleX GUI to support 30-series graphics cards
  • Added PP-YOLO V2 model for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Newly added the ability to export API training scripts for seamless switching to PaddleX API training
  • Industrial Practice Cases
  • Added tutorial cases for steel bar counting and defect detection, focusing on object detection tasks
  • Added tutorial cases for robotic arm grasping, focusing on instance segmentation tasks
  • Added tutorial cases for training and deployment of industrial meter readings, which combines object detection, semantic segmentation, and traditional vision algorithms
  • Added a deployment case tutorial using C# language under Windows system
"},{"location":"en/CHANGLOG.html#paddlex-v200rc0-5192021","title":"PaddleX v2.0.0rc0 (5.19/2021)","text":"
  • Fully supports PaddlePaddle 2.0 dynamic graphs for an easier development mode
  • Added PP-YOLOv2 for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Comprehensive upgrade of C++ deployment module
    • PaddleInference deployment adapted to 2.0 prediction library (Usage Documentation)
    • Supports deployment of models from PaddleDetection, PaddleSeg, PaddleClas, and PaddleX
    • Added multi-GPU prediction based on PaddleInference (Usage Documentation)
    • GPU deployment added TensorRT high-performance acceleration engine deployment method based on ONNX
    • GPU deployment added Triton service-oriented deployment method based on ONNX (Docker Usage Documentation)
"},{"location":"en/CHANGLOG.html#paddlex-v130-12192020","title":"PaddleX v1.3.0 (12.19/2020)","text":"
  • Model Updates

    • Image Classification model ResNet50_vd adds a pre-trained model with 100,000 categories.
    • Object Detection model FasterRCNN adds model pruning support.
    • Object Detection models now support multi-channel image training.
  • Model Deployment Updates

    • Fixed bugs in OpenVINO deployment C++ code.
    • Raspberry Pi deployment adds Arm V8 support.
  • Industry Case Updates

    • Added an industrial quality inspection case, providing GPU and CPU deployment scenarios for industrial quality inspection, along with optimization strategies related to quality inspection.
  • New RESTful API Module A new RESTful API module is added, enabling developers to quickly develop training platforms based on PaddleX.

    • Added an HTML Demo based on RESTful API.
    • Added a Remote version of the visualization client based on RESTful API. Added deployment solutions for models through OpenVINO.
"},{"location":"en/CHANGLOG.html#paddlex-v120-992020","title":"PaddleX v1.2.0 (9.9/2020)","text":"
  • Model Updates

    • Added the object detection model PPYOLO.
    • FasterRCNN, MaskRCNN, YOLOv3, DeepLabv3p, and other models now have pre-trained models on the COCO dataset.
    • Object Detection models FasterRCNN and MaskRCNN add the backbone HRNet_W18.
    • Semantic Segmentation model DeepLabv3p adds the backbone MobileNetV3_large_ssld.
  • Model Deployment Updates

    • Added deployment solutions for models through OpenVINO.
    • Added deployment solutions for models on Raspberry Pi.
    • Optimized data preprocessing and postprocessing code performance for PaddleLite Android deployment.
    • Optimized Paddle Server-side C++ deployment code, added parameters such as use_mkl, significantly improving model prediction performance on CPUs through mkldnn.
  • Industry Case Updates

    • Added an RGB image remote sensing segmentation case.
    • Added a multi-channel remote sensing segmentation case.
  • Others

    • Added a dataset splitting function, supporting command-line splitting of ImageNet, PascalVOC, MSCOCO, and semantic segmentation datasets.

### PaddleX v1.1.0 (7.13/2020) - Model Updates

  • Added new semantic segmentation models: HRNet, FastSCNN
  • Added HRNet backbone for object detection (FasterRCNN) and instance segmentation (MaskRCNN)
  • Pre-trained models on COCO dataset for object detection and instance segmentation
  • Integrated X2Paddle, enabling all PaddleX classification and semantic segmentation models to export to ONNX protocol
  • Model Deployment Updates
  • Added support for model encryption on Windows platform
  • New deployment and prediction solutions for Jetson and PaddleLite
  • C++ deployment code now supports batch prediction and utilizes OpenMP for parallel acceleration of preprocessing
  • Added 2 PaddleX Industrial Cases
  • Portrait segmentation case
  • Industrial meter reading case
  • New data format conversion feature, converting data annotated by LabelMe, Jingling Annotation Assistant, and EasyData platform to formats supported by PaddleX
  • Updated PaddleX documentation, optimizing the document structure
"},{"location":"en/CHANGLOG.html#paddlex-v100-5212020","title":"PaddleX v1.0.0 (5.21/2020)","text":"
  • End-to-End Pipeline
  • Data Preparation: Supports the EasyData Intelligent Data Service Platform data protocol, facilitating intelligent annotation and low-quality data cleaning through the platform. It is also compatible with mainstream annotation tool protocols, helping developers complete data preparation faster.
  • Model Training: Integrates PaddleClas, PaddleDetection, PaddleSeg vision development kits, providing a rich selection of high-quality pre-trained models for faster achievement of industrial-grade model performance.
  • Model Tuning: Built-in model interpretability modules and VisualDL visualization analysis components, providing abundant information for better understanding and optimizing models.
  • Secure Multi-platform Deployment: Integrated with PaddleSlim model compression tools and model encryption deployment modules, facilitating high-performance and secure multi-platform deployment in conjunction with Paddle Inference or Paddle Lite.

  • Integrated Industrial Practices

  • Selects mature model architectures from PaddlePaddle's industrial practices, opening up case study tutorials to accelerate developers' industrial implementation.

  • Easy-to-Use and Easy-to-Integrate

  • Unified and user-friendly end-to-end APIs, enabling model training in 5 steps and high-performance Python/C++ deployment with just 10 lines of code.
  • Provides PaddleX-GUI, a cross-platform visualization tool centered on PaddleX, for a quick experience of the full PaddlePaddle deep learning pipeline.
"},{"location":"en/FAQ.html","title":"FAQ","text":""},{"location":"en/FAQ.html#q-what-is-paddlex","title":"Q: What is PaddleX?","text":"

A: PaddleX is a low-code development tool featuring selected models and pipelines launched by the PaddlePaddle team. It aims to provide developers with a more convenient and efficient development environment. This tool supports model training and inference on multiple mainstream domestic and international hardware, and is compatible with various system configurations, thereby meeting users' needs in different application scenarios. PaddleX has a wide range of applications, covering industries such as industry, energy, finance, transportation, and education, providing professional support and solutions for these industries. By using PaddleX, developers can more easily apply deep learning technology to actual industrial practices, thereby realizing technology implementation and transformation, and promoting digital transformation and intelligent upgrading across industries.

"},{"location":"en/FAQ.html#q-what-is-a-pipeline-what-is-a-module-what-is-the-relationship-between-them","title":"Q: What is a Pipeline? What is a Module? What is the relationship between them?","text":"

A: In PaddleX, a module is defined as the smallest unit that implements basic functions, meaning each module undertakes a specific task, such as text detection. Within this framework, a pipeline is the actual functionality achieved by one or more modules working together, often forming more complex application scenarios, such as Optical Character Recognition (OCR) technology. Therefore, the relationship between modules and pipelines can be understood as the relationship between basics and applications. Modules, as the smallest units, provide the foundation for construction, while pipelines demonstrate the practical application effects of these foundational modules after reasonable combination and configuration. This design approach allows users to flexibly select and combine different modules to achieve the functions they need, significantly enhancing development flexibility and efficiency. The official pipelines also support users with high-performance inference, service-oriented deployment, and other deployment capabilities.

"},{"location":"en/FAQ.html#q-how-to-choose-between-the-wheel-package-installation-mode-and-the-plugin-installation-mode","title":"Q: How to choose between the Wheel package installation mode and the plugin installation mode?","text":"

A: If your application scenario in using PaddleX mainly focuses on model inference and integration, we highly recommend choosing a more convenient and lightweight installation method, namely the Wheel package installation mode. This installation mode aims to provide users with a quick and simple installation experience, especially suitable for scenarios requiring rapid deployment and integration of models. Installing with Wheel packages can significantly reduce the complexity of the installation process, avoid unnecessary configuration issues, and allow developers to focus more time and effort on the practical application and optimization of models. Whether you are a novice or an experienced developer, this lightweight installation method will greatly facilitate your workflow. Therefore, when performing model inference and integration, choosing the Wheel package installation mode will undoubtedly make your entire development process more efficient and smooth.

"},{"location":"en/FAQ.html#q-what-is-the-difference-between-paddlex-and-baidu-aistudio-communitys-zero-code-pipeline","title":"Q: What is the difference between PaddleX and Baidu AIStudio Community's Zero-Code Pipeline?","text":"

A: Baidu AIStudio Community's Zero-Code Pipeline is the cloud-based carrier of PaddleX, with its underlying code consistent with PaddleX, and can be considered as a cloud-based PaddleX. The design philosophy of Baidu AIStudio Community's Zero-Code Pipeline is to enable users to quickly build and deploy model applications without needing to delve deeply into programming and algorithm knowledge. On this basis, Baidu AIStudio Community's Zero-Code Pipeline also provides many special pipelines, such as training high-precision models with a small number of samples and solving complex time-series problems using multi-model fusion schemes. PaddleX, on the other hand, is a local development tool that provides users with powerful functions supporting more in-depth secondary development. This means developers can flexibly adjust and expand based on PaddleX to create solutions that better fit specific application scenarios. Additionally, PaddleX offers a rich set of model interfaces, supporting users in freely combining models for use.

"},{"location":"en/FAQ.html#q-when-i-encounter-problems-while-using-paddlex-how-should-i-provide-feedback","title":"Q: When I encounter problems while using PaddleX, how should I provide feedback?","text":"

A: Welcome to the Discussion Area to communicate with a vast number of developers! If you find errors or deficiencies in PaddleX, you are also welcome to submit an issue, and our on-duty team members will respond to your questions as soon as possible.

"},{"location":"en/quick_start.html","title":"Quick Start","text":""},{"location":"en/quick_start.html#installation","title":"\ud83d\udee0\ufe0f Installation","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

  • Installing PaddlePaddle
# cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

\u2757For more PaddlePaddle versions, please refer to the PaddlePaddle official website.

  • Installing PaddleX
pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n

\u2757For more installation methods, refer to the PaddleX Installation Guide.

"},{"location":"en/quick_start.html#cli-usage","title":"\ud83d\udcbb CLI Usage","text":"

One command can quickly experience the pipeline effect, the unified CLI format is:

paddlex --pipeline [Pipeline Name] --input [Input Image] --device [Running Device]\n

You only need to specify three parameters: * pipeline: The name of the pipeline * input: The local path or URL of the input image to be processed * device: The GPU number used (for example, gpu:0 means using the 0th GPU), you can also choose to use the CPU (cpu)

For example, using the OCR pipeline:

paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png  --device gpu:0\n

{\n'input_path': '/root/.paddlex/predict_input/general_ocr_002.png',\n'dt_polys': [array([[161,  27],\n       [353,  22],\n       [354,  69],\n       [162,  74]], dtype=int16), array([[426,  26],\n       [657,  21],\n       [657,  58],\n       [426,  62]], dtype=int16), array([[702,  18],\n       [822,  13],\n       [824,  57],\n       [704,  62]], dtype=int16), array([[341, 106],\n       [405, 106],\n       [405, 128],\n       [341, 128]], dtype=int16)\n       ...],\n'dt_scores': [0.758478200014338, 0.7021546472698513, 0.8536622648391111, 0.8619181462164781, 0.8321051217096188, 0.8868756173427551, 0.7982964727675609, 0.8289939036796322, 0.8289428877522524, 0.8587063317632897, 0.7786755892491615, 0.8502032769081344, 0.8703346500042997, 0.834490931790065, 0.908291103353393, 0.7614978661708064, 0.8325774055997542, 0.7843421347676149, 0.8680889482955594, 0.8788859304537682, 0.8963341277518075, 0.9364654810069546, 0.8092413027028257, 0.8503743089091863, 0.7920740420391101, 0.7592224394793805, 0.7920547400069311, 0.6641757962457888, 0.8650289477605955, 0.8079483304467047, 0.8532207681055275, 0.8913377034754717],\n'rec_text': ['\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', 'CLASS', '\u200b\u5e8f\u53f7\u200b SERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200b', '\u200b\u65e5\u671f\u200b DATE', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHW', '035', 'MU2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', \u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE10MINUTESBEFOREDEPARTURETIME'],\n'rec_score': [0.9985831379890442, 0.999696917533874512, 0.9985735416412354, 0.9842517971992493, 0.9383274912834167, 0.9943678975105286, 0.9419361352920532, 0.9221674799919128, 0.9555020928382874, 0.9870321154594421, 0.9664073586463928, 0.9988052248954773, 0.9979352355003357, 0.9985110759735107, 0.9943482875823975, 0.9991195797920227, 0.9936401844024658, 0.9974591135978699, 0.9743705987930298, 0.9980487823486328, 0.9874696135520935, 0.9900962710380554, 0.9952947497367859, 0.9950481653213501, 0.989926815032959, 0.9915552139282227, 0.9938777685165405, 0.997239887714386, 0.9963340759277344, 0.9936134815216064, 0.97223961353302]}\n

The visualization result is as follows:

To use the command line for other pipelines, simply adjust the pipeline parameter to the name of the corresponding pipeline. Below are the commands for each pipeline:

Pipeline Name Command Image Classification paddlex --pipeline image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Object Detection paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 Instance Segmentation paddlex --pipeline instance_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png --device gpu:0 Semantic Segmentation paddlex --pipeline semantic_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png --device gpu:0 Image Multi-label Classification paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Small Object Detection paddlex --pipeline small_object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/small_object_detection.jpg --device gpu:0 Image Anomaly Detection paddlex --pipeline anomaly_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_grid.png --device gpu:0 OCR paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 Table Recognition paddlex --pipeline table_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg --device gpu:0 Layout Parsing paddlex --pipeline layout_parsing --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/demo_paper.png --device gpu:0 Formula Recognition paddlex --pipeline formula_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/demo_image/general_formula_recognition.png --device gpu:0 Seal Recognition paddlex --pipeline seal_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/seal_text_det.png --device gpu:0 Time Series Forecasting paddlex --pipeline ts_fc --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv --device gpu:0 Time Series Anomaly Detection paddlex --pipeline ts_ad --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv --device gpu:0 Time Series Classification paddlex --pipeline ts_cls --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv --device gpu:0"},{"location":"en/quick_start.html#python-script-usage","title":"\ud83d\udcdd Python Script Usage","text":"

With just a few lines of code, you can quickly perform inference on a production line. The unified Python script format is as follows:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=[PipelineName])\noutput = pipeline.predict([InputImageName])\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n
The following steps are executed:

  • create_pipeline() instantiates the production line object.
  • An image is passed in and the predict method of the production line object is called for inference and prediction.
  • The prediction results are processed.

For other production lines using the Python script, you only need to adjust the pipeline parameter of the create_pipeline() method to the corresponding production line name. Below is a list of each production line's corresponding parameter name and detailed usage explanation:

Production Line Name Corresponding Parameter Detailed Explanation Document Scene Information Extraction v3 PP-ChatOCRv3-doc Document Scene Information Extraction v3 Python Script Instructions General Image Classification image_classification General Image Classification Python Script Instructions General Object Detection object_detection General Object Detection Python Script Instructions General Instance Segmentation instance_segmentation General Instance Segmentation Python Script Instructions General Semantic Segmentation semantic_segmentation General Semantic Segmentation Python Script Instructions Image Multi-label Classification multi_label_image_classification Image Multi-label Classification Python Script Instructions Small Object Detection small_object_detection Small Object Detection Python Script Instructions Image Anomaly Detection anomaly_detection Image Anomaly Detection Python Script Instructions General OCR OCR General OCR Python Script Instructions General Table Recognition table_recognition General Table Recognition Python Script Instructions General Layout Parsing layout_parsing General Layout Parsing Python Script Instructions Formula Recognition formula_recognition Formula Recognition Python Script Instructions Seal Text Recognition seal_recognition Seal Text Recognition Python Script Instructions Time Series Forecasting ts_fc Time Series Forecasting Python Script Instructions Time Series Anomaly Detection ts_ad Time Series Anomaly Detection Python Script Instructions Time Series Classification ts_cls Time Series Classification Python Script Instructions"},{"location":"en/blog/index.html","title":"Blog","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html","title":"PaddleX Image Classification Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for image classification related single models. Click on the above link to refer to the homepage documentation for installing the data annotation tool and viewing detailed usage procedures.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical interface. It can be used for tasks such as image classification, object detection, and image segmentation. In instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_classification.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt for the dataset to be annotated in the pets folder, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat and dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_classification.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py script to convert the annotated dataset to the ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the path to the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_classification.html#2-data-format","title":"2. Data Format","text":"
  • The dataset defined by PaddleX for image classification tasks is named ClsDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot```bash\nclassname1\nclassname2\nclassname3\n...\n
Modified label.txt:

```bash 0 classname1 1 classname2 2 classname3 ...

"},{"location":"en/data_annotations/cv_modules/image_feature.html","title":"PaddleX Image Feature Task Module Data Annotation Tutorial","text":"

This section will introduce how to use the Labelme annotation tool to complete data annotation for image feature-related single models. Click the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. In image feature annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt in the pets folder for the dataset to be annotated, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat-dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_feature.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select the save path upon the first save. If autosave is enabled, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py to convert the annotated dataset to ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_feature.html#134-data-format-conversion","title":"1.3.4 Data Format Conversion","text":"

After obtaining data in LabelMe format, the data format needs to be converted to ShiTuRecDataset format. Below is a code example that demonstrates how to convert the data labeled using LabelMe according to the previous tutorial.

# Download and unzip the LabelMe format example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n# Convert the LabelMe example dataset\npython main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#3-data-format","title":"3. Data Format","text":"

The dataset defined by PaddleX for image classification tasks is named ShiTuRecDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but should correspond to the content of train.txt, query.txt, gallery.txt\n\u251c\u2500\u2500 gallery.txt   # Annotation file for the gallery set, the file name cannot be changed. Each line gives the path of the image to be retrieved and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_2_side.jpg 3997\n\u2514\u2500\u2500 query.txt     # Annotation file for the query set, the file name cannot be changed. Each line gives the path of the database image and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_1_front.jpg 3997\n

The annotation files use an image feature format. Please refer to the above specifications to prepare your data. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html","title":"PaddleX Instance Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to instance segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is a fruit instance segmentation dataset, covering five different types of fruits, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as fruit.
  • Create an images directory (must be named images) within fruit and store the images to be annotated in the images directory, as shown below:
  • Create a category label file label.txt in the fruit folder for the dataset to be annotated, and write the categories of the dataset to be annotated into label.txt by line. Taking the fruit instance segmentation dataset's label.txt as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/fruit\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* labels is the path to the category labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting labelme, it will look like this:

* Click Edit to select the annotation type, choose Create Polygons. * Create polygons on the image to outline the boundaries of the segmentation areas.

* Click again to select the category of the segmentation area.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

  • Then click Next Image to annotate the next image.

* The final annotated label file will look like this.

  • Adjusting Directory Structure to Obtain a Standard labelme Format Dataset for Fruit Instance Segmentation

  • Prepare the train_anno_list.txt and val_anno_list.txt text files in the root directory of your dataset. Populate these files with the paths of all json files in the annotations directory, distributing them into train_anno_list.txt and val_anno_list.txt at a specified ratio. Alternatively, you can include all paths in train_anno_list.txt and create an empty val_anno_list.txt file, intending to use a zero-code data splitting feature for re-partitioning upon upload. The specific format for filling train_anno_list.txt and val_anno_list.txt is illustrated as follows:

  • The final directory structure after organization should resemble the following:

  • Compress the fruit directory into a .tar or .zip format archive to obtain the standard labelme format dataset for fruit instance segmentation.
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named COCOInstSegDataset for instance segmentation tasks, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Training set annotation file, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Validation set annotation file, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

Annotation files adopt the COCO format. Please refer to the above specifications for data preparation. Additionally, refer to: Example Dataset.

When using PaddleX 2.x version for instance segmentation datasets, please refer to the corresponding format conversion section in Instance Segmentation Module Development Tutorial to convert VOC format datasets to COCO datasets. (Note in module development documentation)

Note:

  • Instance segmentation data requires the use of the COCO data format to annotate the pixel boundaries and categories of each target area in each image in the dataset. The polygon boundaries (segmentation) of objects are represented as [x1,y1,x2,y2,...,xn,yn], where (xn,yn) denotes the coordinates of each corner point of the polygon. Annotation information is stored in json files under the annotations directory, with separate files for the training set (instance_train.json) and validation set (instance_val.json).
  • If you have a batch of unlabeled data, we recommend using LabelMe for data annotation. PaddleX Pipelines support data format conversion for datasets annotated with LabelMe.
  • To ensure successful format conversion, please strictly follow the file naming and organization of the example dataset: LabelMe Example Dataset.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html","title":"PaddleX Multi-Label Classification Task Data Annotation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for multi-label classification tasks with a single model. Click on the above links to install the annotation tools and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is manually collected, covering two categories: safety helmets and human heads, with photos taken from different angles. Image examples:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for image classification, object detection, image segmentation, and other tasks. In object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated into label.txt by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After labeling, click Save. (If the output field is not specified when starting Labelme, it will prompt you to select a save path the first time you save. If the autosave field is used for automatic saving, there is no need to click the Save button).

* Then click Next Image to label the next image.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • It can also be installed with pip in one step
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in the browser after starting. Next, you can start the annotation process based on the task.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#32-annotation-process-with-paddlelabel","title":"3.2 Annotation Process with PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and click on Object Detection.

* Fill in the project name and dataset path. Note that the path is the absolute path on the local machine. Click Create after completion.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding id. Click Add Category to create the required category names. * Start annotating * Select the label you want to annotate with. * Click the rectangular selection button on the left. * Draw a bounding box around the desired region in the image, ensuring semantic partitioning. If there are multiple columns, annotate each separately. * After completing the annotation, the result will appear in the lower-right corner. Check if the annotation is correct. * Once done, click Project Overview.

  • Export Annotated Files

  • In the Project Overview, segment the dataset as needed and click \"Export Dataset\".

  • Fill in the export path and format. The export path should be an absolute path, and the format should be coco.

  • After successful export, the annotated files will be available in the specified path.

  • Adjust directories to obtain COCO-formatted dataset for helmet detection

  • Rename the three json files and the image directory as follows:

Original File/Directory Name Renamed File/Directory Name train.json instance_train.json

|val.json|instance_val.json|

|test.json|instance_test.json| |image|images|

  • Create an annotations directory in the root of the dataset and move all json files into it. The final dataset structure should look like this:

  • Compress the helmet directory into a .tar or .zip file to obtain the COCO-formatted dataset for helmet detection.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#4-image-multi-label-classification-data-format-conversion","title":"4. Image Multi-Label Classification Data Format Conversion","text":"

After obtaining data in COCO format, you need to convert the data format to MLClsDataset format. Below is a code example that follows the previous tutorial to use LabelMe or PaddleLabel annotated data and perform data format conversion:

# Download and unzip the COCO example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n# Convert the COCO example dataset to MLClsDataset\npython main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#5-data-format","title":"5. Data Format","text":"

The dataset defined by PaddleX for image multi-label classification tasks is named MLClsDataset, with the following directory structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot be changed. Each line gives the category ID and category name, for example: 45 wallflower\n\u251c\u2500\u2500 train.txt  # Annotation file for the training set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0041_2456602544.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n\u2514\u2500\u2500 val.txt    # Annotation file for the validation set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0045_845243484.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n

The annotation files use the multi-label classification format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/object_detection.html","title":"PaddleX Object Detection Task Data Preparation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for single-model object detection tasks. Click the above links to install the annotation tools and view detailed usage instructions.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/object_detection.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated, line by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After annotation, click Save. (If output is not specified when starting Labelme, it will prompt to select a save path upon the first save. If autosave is enabled, no need to click Save.)

* Click Next Image to annotate the next.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/object_detection.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • Alternatively, you can install it with pip in one command:
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in your browser after startup. You can then proceed with the annotation process based on your task.
"},{"location":"en/data_annotations/cv_modules/object_detection.html#32-annotation-process-of-paddlelabel","title":"3.2 Annotation Process of PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and then click on Object Detection.

* Fill in the project name and dataset path. Note that the path should be an absolute path on your local machine. Click Create when done.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding ID. Click Add Category to create the required category names. * Start Annotating * First, select the label you need to annotate. * Click the rectangular selection button on the left. * Draw a bounding box around the desired area in the image, paying attention to semantic partitioning. If there are multiple columns, please annotate each separately. * After completing the annotation, the annotation result will appear in the lower right corner. You can check if the annotation is correct. * When all annotations are complete, click Project Overview.

* Export Annotation Files * In Project Overview, divide the dataset as needed, then click Export Dataset.

* Fill in the export path and export format. The export path should also be an absolute path, and the export format should be selected as coco.

* After successful export, you can obtain the annotation files in the specified path.

* Adjust the directory to obtain the standard coco format dataset for helmet detection * Rename the three json files and the image directory according to the following correspondence:

Original File (Directory) Name Renamed File (Directory) Name train.json instance_train.json val.json instance_val.json test.json instance_test.json image images
  • Create an annotations directory in the root directory of the dataset and move all json files to the annotations directory. The final dataset directory structure will look like this:

* Compress the helmet directory into a .tar or .zip format compressed package to obtain the standard coco format dataset for helmet detection.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#4-data-format","title":"4. Data Format","text":"

The dataset defined by PaddleX for object detection tasks is named COCODetDataset, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Annotation file for the training set, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Annotation file for the validation set, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

The annotation files use the COCO format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html","title":"PaddleX Semantic Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to semantic segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":"

This dataset is a manually collected street scene dataset, covering two categories of vehicles and roads, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is an image annotation software written in python with a graphical interface. It can be used for tasks such as image classification, object detection, and semantic segmentation. In semantic segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as seg_dataset
  • Create an images directory within seg_dataset (the directory name can be modified, but ensure the subsequent command's image directory name is correct), and store the images to be annotated in the images directory, as shown below:
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#232-launch-labelme","title":"2.3.2 Launch Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and launch the labelme annotation tool.

# Windows\ncd C:\\path\\to\\seg_dataset\n# Mac/Linux\ncd path/to/seg_dataset\n
labelme images --nodata --autosave --output annotations\n
* nodata stops storing image data in the JSON file * autosave enables automatic saving * output specifies the path for storing label files

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#233-start-image-annotation","title":"2.3.3 Start Image Annotation","text":"
  • After launching labelme, it will look like this:

* Click \"Edit\" to select the annotation type

* Choose to create polygons

* Draw the target contour on the image

  • When the contour line is closed as shown in the left image below, a category selection box will pop up, allowing you to input or select the target category

Typically, only the foreground objects need to be labeled with their respective categories, while other pixels are automatically considered as background. If manual background labeling is required, the category must be set to background, otherwise errors may occur during dataset format conversion. For noisy parts or irrelevant sections in the image that should not participate in model training, the ignore class can be used, and the model will automatically skip those parts during training. For objects with holes, after outlining the main object, draw polygons along the edges of the holes and assign a specific category to the holes. If the hole represents background, assign it as background. An example is shown below:

  • After labeling, click \"Save\". (If the output field is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is enabled, the save button is not required.)

* Then click \"Next Image\" to proceed to the next image for labeling.

  • The final labeled file will look like this:

  • Adjust the directory structure to obtain a standard LabelMe format dataset for safety helmet detection: a. Download and execute the directory organization script in the root directory of your dataset, seg_dataset. After executing the script, the train_anno_list.txt and val_anno_list.txt files will contain content as shown:

    python format_seg_labelme_dataset.py\n
    b. The final directory structure after organization will look like this:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with LabelMe, the data format needs to be converted to the Seg data format. Below is a code example for converting data labeled using LabelMe according to the above tutorial.

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n\npython main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#data-format","title":"Data Format","text":"

The dataset defined by PaddleX for image segmentation tasks is named SegDataset, with the following organizational structure and annotation format:

dataset_dir         # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations     # Directory for storing annotated images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 images          # Directory for storing original images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 train.txt       # Annotation file for the training set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/P0005.jpg annotations/P0005.png\n\u2514\u2500\u2500 val.txt         # Annotation file for the validation set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/N0139.jpg annotations/N0139.png\n
Label images should be single-channel grayscale or single-channel pseudo-color images, and it is recommended to save them in PNG format. Each pixel value in the label image represents a category, and the categories should start from 0 and increase sequentially, for example, 0, 1, 2, 3 represent 4 categories. The pixel storage of the label image is 8bit, so a maximum of 256 categories are supported for labeling.

Please prepare your data according to the above specifications. Additionally, you can refer to: Example Dataset

"},{"location":"en/data_annotations/ocr_modules/table_recognition.html","title":"PaddleX Table Structure Recognition Task Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/table_recognition.html#1-data-annotation","title":"1. Data Annotation","text":"

For annotating table data, use the PPOCRLabelv2 tool. Detailed steps can be found in: \u3010Video Demonstration\u3011

Table annotation focuses on structured extraction of table data, converting tables in images into Excel format. Therefore, annotation requires the use of an external software to open Excel simultaneously. In PPOCRLabel, complete the annotation of text information within the table (text and position), and in the Excel file, complete the annotation of table structure information. The recommended steps are:

  1. Table Recognition: Open the table image, click the Table Recognition button in the upper right corner of the software. The software will call the table recognition model in PP-Structure to automatically label the table, and simultaneously open an Excel file.
  2. Modify Annotation Results: Add annotation boxes with each cell as the unit (i.e., all text within a cell is marked as one box). Right-click on the annotation box and select Cell Re-recognition to automatically recognize the text within the cell using the model.
  3. Adjust Cell Order: Click View - Show Box Number to display the annotation box numbers. Drag all results under the Recognition Results column on the right side of the software interface to arrange the annotation box numbers in order from left to right and top to bottom, annotating by row.
  4. Annotate Table Structure: In an external Excel software, mark cells with text as any identifier (e.g., 1), ensuring that the cell merging in Excel matches the original image (i.e., the text in Excel cells does not need to be identical to the text in the image).
  5. Export JSON Format: Close all Excel files corresponding to the table images, click File - Export Table Annotation, and generate the gt.txt annotation file.
"},{"location":"en/data_annotations/ocr_modules/table_recognition.html#2-data-format","title":"2. Data Format","text":"

The dataset structure and annotation format defined by PaddleX for table recognition tasks are as follows:

```ruby dataset_dir # Root directory of the dataset, the directory name can be changed \u251c\u2500\u2500 images # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt \u251c\u2500\u2500 train.txt # Training set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"\u3001\", \"\u200b\u81ea\u200b\", \"\u200b\u6211\u200b\"], \"bbox\": [[[5, 2], [231, 2], [231, 35], [5, 35]]]}, {\"tokens\": [\"9\"], \"bbox\": [[[168, 68], [231, 68], [231, 98], [168, 98]]]}]}, \"gt\": \"\u3001\u200b\u81ea\u6211\u200bAghas\u200b\u5931\u5434\u200b\u6708\u200b\uff0clonwyCau9\"} \u2514\u2500\u2500 val.txt # Validation set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/no_border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"a"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html","title":"PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#2-ppocrlabel-annotation","title":"2. PPOCRLabel Annotation","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#21-introduction-to-ppocrlabel-annotation-tool","title":"2.1 Introduction to PPOCRLabel Annotation Tool","text":"

PPOCRLabel is a semi-automatic graphical annotation tool tailored for OCR tasks, featuring automatic annotation and re-recognition of data using the built-in PP-OCR model. Written in Python3 and PyQT5, it supports rectangular box annotation, table annotation, irregular text annotation, and key information annotation modes. In OCR annotation tasks, labels are stored as txt files.

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#22-installation-and-running-ppocrlabel","title":"2.2 Installation and Running PPOCRLabel","text":"

PPOCRLabel can be launched through whl packages or Python scripts. The whl package method is more convenient, and only this method is provided here:

  • For Windows:
    pip install PPOCRLabel  # Installation\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n

[!NOTE] Installing PPOCRLabel via whl packages will automatically download the paddleocr whl package. The shapely dependency may encounter a \"[winRrror 126] The specified module could not be found.\" error. It is recommended to download and install the shapely installation package separately.

  • For MacOS:
    pip3 install PPOCRLabel\npip3 install opencv-contrib-python-headless==4.2.0.32 # Add \"-i https://mirror.baidu.com/pypi/simple\" for faster downloads\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n
"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#23-annotation-process-for-text-detection-and-text-recognition","title":"2.3 Annotation Process for Text Detection and Text Recognition","text":"
  1. Installation and Running: Use the above commands to install and run the program.
  2. Open Folder: Click \"File\" - \"Open Directory\" to select the folder containing images to be annotated.

3. Auto Annotation: Click \"Auto Annotation\" to use the PP-OCR ultra-lightweight model to automatically annotate images with a file status of \"X\".

4. Manual Annotation: Click \"Rectangle Annotation\" (recommended to press \"W\" directly in English mode), and users can manually draw bounding boxes for parts undetected by the model in the current image. Press \"Q\" on the keyboard to use the four-point annotation mode (or click \"Edit\" - \"Four-point Annotation\"), and users click 4 points in sequence, double-clicking the left mouse button to indicate completion. 5. After drawing the bounding box, click \"Confirm\", and the detection box will be pre-assigned a \"To Be Recognized\" label. 6. Re-Recognition: After drawing/adjusting all detection boxes in the image, click \"Re-Recognition\", and the PP-OCR model will re-recognize all detection boxes in the current image.

7. Content Modification: Click on the recognition result to manually modify inaccurate recognition results. 8. Confirm Annotation: Click \"Confirm\", the image status changes to \"\u221a\", and proceed to the next image. 9. Deletion: Click \"Delete Image\", and the image will be deleted to the Recycle Bin. 10. Export Results: Users can manually export results through \"File - Export Annotation Results\" or enable automatic export by clicking \"File - Auto Export Annotation Results\". Manually confirmed annotations will be stored in Label.txt under the opened image folder. Clicking \"File - Export Recognition Results\" in the menu bar will save the recognition training data of such images in the crop_img folder, and the recognition labels will be saved in rec_gt.txt.

Notes:

  • PPOCRLabel uses folders as the basic unit for labeling. After opening the folder containing images to be labeled, the images will not be displayed in the window bar. Instead, clicking \"Select Folder\" will directly import the images under the folder into the program.
  • The image status indicates whether the current image has been manually saved by the user. An \"X\" indicates it has not been manually saved, while a \"\u221a\" indicates it has. After clicking the \"Auto Label\" button, PPOCRLabel will not relabel images with a status of \"\u221a\".
  • Clicking \"Re-recognize\" will overwrite the recognition results in the image. Therefore, if manual changes have been made to the recognition results before this, they may be altered after re-recognition.
  • Files generated by PPOCRLabel are placed in the folder containing the labeled images, including the following types. Do not manually modify their contents as it may cause program exceptions.
File Name Description Label.txt Detection labels, which can be directly used for PPOCR detection model training. The program automatically writes to this file every 5 confirmed detection results, or when the application is closed or the file path is changed. fileState.txt Image status marker file, which saves the names of images in the current folder that have been manually confirmed by the user. Cache.cach Cache file, which saves the results of automatic recognition by the model. rec_gt.txt Recognition labels. Can be directly used for PPOCR recognition model training. Generated by manually clicking \"Export Recognition Results\" in the menu bar. crop_img Recognition data. Images cropped according to the detection boxes. Generated simultaneously with rec_gt.txt.

If data partitioning is required, follow these steps:

cd ./PPOCRLabel # Switch to the PPOCRLabel folder\npython gen_ocr_train_val_test.py --trainValTestRatio 7:3:0 --datasetRootPath ../train_data\n
* trainValTestRatio is the ratio for dividing images into training, validation, and test sets. Set it according to your needs. The default is 6:2:2. * datasetRootPath is the full path to the dataset labeled by PPOCRLabel. The default path is PaddleOCR/train_data. Before partitioning the dataset, the structure should be as follows:

|-train_data\n  |-crop_img\n    |- word_001_crop_0.png\n    |- word_002_crop_0.jpg\n    |- word_003_crop_0.jpg\n    | ...\n  | Label.txt\n  | rec_gt.txt\n  |- word_001.png\n  |- word_002.jpg\n  |- word_003.jpg\n  | ...\n
For more tool usage instructions, please refer to Detailed Instructions

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named TextDetDataset specifically for text detection tasks. The organized and annotated data should follow the following file organization and naming conventions:

dataset_dir     # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images      # Directory to store images, the directory name can be changed but should correspond to the content in train.txt and val.txt\n\u251c\u2500\u2500 train.txt   # Annotation file for the training set, the file name cannot be changed. Example content: images/img_0.jpg \\t [{\"transcription\": \"MASA\", \"points\": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]\n\u2514\u2500\u2500 val.txt     # Annotation file for the validation set, the file name cannot be changed. Example content: images/img_61.jpg \\t [{\"transcription\": \"TEXT\", \"points\": [[31, 10], [310, 140], [420, 220], [310, 170]]}, {...}]\n
Place the images in the images directory, and rename the generated Label.txt annotation file to train.txt for the training set. Similarly, rename the Label.txt annotation file for the validation set to val.txt. Both files should be placed in the dataset_dir (the name of which can be changed) directory. Note that the image paths in train.txt/val.txt should be in the format images/xxx.

Each line in the annotation files contains the path to an image and a list of dictionaries. The path and the list must be separated by a tab character \u2018\\t\u2019, not spaces.

For the list of dictionaries, the points key represents the coordinates (x, y) of the four vertices of the text box, starting from the top-left vertex and proceeding clockwise. The transcription key indicates the text within the text box. If the transcription content is \"###\", it indicates that the text box is invalid and will not be used for training. For reference, see the example dataset.

If you use PPOCRLabel to annotate your data, simply rename det_gt_train.txt in the text detection (det) directory to train.txt and det_gt_test.txt to val.txt after dividing your dataset.

"},{"location":"en/data_annotations/time_series_modules/time_series_anomaly_detection.html","title":"PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial","text":"

Time series anomaly detection is an unsupervised learning task, thus there is no need to annotate training data. The collected training samples should ideally consist solely of normal data, i.e., no anomalies (represented by 0 for no anomaly). In the training set, the label column indicating anomalies can be set to 0 or omitted entirely. For the validation set, to evaluate model accuracy, annotations are required. For points that are anomalous at a specific time, set the label for that time point to 1, and the labels for other normal time points to 0.

"},{"location":"en/data_annotations/time_series_modules/time_series_classification.html","title":"PaddleX Time Series Classification Task Data Annotation Tutorial","text":"

When annotating time series classification data, based on the collected real-world data, clearly define the classification objectives of the time series data and establish corresponding classification labels. In the csv file, set a group_id column to represent samples, where the same group_id indicates that the data points belong to the same sample. For example, in stock price prediction, labels might be \"Rise\" (0), \"Flat\" (1), or \"Fall\" (2). For a time series that exhibits an \"upward\" trend over a period, it can be considered as one sample (group), where each time point in this series shares the same group_id, and the label column is set to 0. Similarly, for a time series that exhibits a \"downward\" trend, it forms another sample (group), where each time point shares the same group_id, and the label column is set to 2. As shown in the figure below, the green box represents one sample (group_id=0) with a label of 1, while the red box represents another time series classification sample (group_id=1) with a label of 0. If there are n samples, you can set group_id=0,...,n-1; each sample has a length (time=0,...,9) of 10, and the feature dimensions (dim_0, dim_1) are 2.

"},{"location":"en/data_annotations/time_series_modules/time_series_forecasting.html","title":"PaddleX Time Series Forecasting Task Data Annotation Tutorial","text":"

Data for time series forecasting tasks does not require annotation. Simply collect real-world data and arrange it in a csv file in chronological order. During training, the data will be automatically segmented into multiple time slices to form training samples, as shown in the figure below. The historical time series data and future sequences represent the input data for training the model and its corresponding prediction targets, respectively. To ensure data quality and completeness, missing values can be filled based on expert experience or statistical methods.

"},{"location":"en/installation/installation.html","title":"PaddleX Local Installation Tutorial","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

"},{"location":"en/installation/installation.html#1-quick-installation","title":"1. Quick Installation","text":"

Welcome to PaddleX, Baidu's low-code development tool for AI. Before we dive into the local installation process, please clarify your development needs and choose the appropriate installation mode.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. Below, we introduce their respective application scenarios:

"},{"location":"en/installation/installation.html#11-wheel-package-installation-mode","title":"1.1 Wheel Package Installation Mode","text":"

If your use case for PaddleX involves model inference and integration, we recommend the more convenient and lightweight Wheel package installation mode.

After installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the PaddleX Wheel package by executing the following commands:

\u2757 Note: Please ensure that PaddlePaddle is successfully installed before proceeding to the next step.

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n
"},{"location":"en/installation/installation.html#12-plugin-installation-mode","title":"1.2 Plugin Installation Mode","text":"

If your use case for PaddleX involves custom development (e.g. retraining models, fine-tuning models, customizing model structures, customizing inference codes, etc.), we recommend the more powerful plugin installation mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration with the supported models but also conduct advanced operations such as model training for custom development.

The plugins supported by PaddleX are listed below. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection PP-ChatOCRv3-doc Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionText Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Forecasting Time Series Forecasting Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS Image Multi-Label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin you need to install is PaddleXXX, after installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the corresponding PaddleX plugin by executing the following commands:

git clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\npip install -e .\npaddlex --install PaddleXXX\n

\u2757 Note: The two installation methods are not mutually exclusive, and you can install both simultaneously.

Next, we provide detailed installation tutorials for your reference. If you are using a Linux operating system, please refer to 2. Detailed Tutorial for Installing PaddleX on Linux.

"},{"location":"en/installation/installation.html#2-detailed-tutorial-for-installing-paddlex-on-linux","title":"2. Detailed Tutorial for Installing PaddleX on Linux","text":"

When installing PaddleX on Linux, we strongly recommend using the official PaddleX Docker image. Alternatively, you can use other custom installation methods.

When using the official Docker image, PaddlePaddle, PaddleX (including the wheel package and all plugins), and the corresponding CUDA environment are already pre-installed. You can simply obtain the Docker image and start the container to begin using it.

When using custom installation methods, you need to first install the PaddlePaddle framework, then obtain the PaddleX source code, and finally choose the PaddleX installation mode.

"},{"location":"en/installation/installation.html#21-get-paddlex-based-on-docker","title":"2.1 Get PaddleX based on Docker","text":"

Using the PaddleX official Docker image, create a container called 'paddlex' and map the current working directory to the '/paddle' directory inside the container by following the command.

If your Docker version >= 19.03, please use:

# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • If you want to delve deeper into the principles or usage of Docker, please refer to the Docker Official Website or the Docker Official Tutorial.

"},{"location":"en/installation/installation.html#22-custom-installation-of-paddlex","title":"2.2 Custom Installation of PaddleX","text":"

Before installation, please ensure you have completed the local installation of PaddlePaddle by referring to the PaddlePaddle Local Installation Tutorial.

"},{"location":"en/installation/installation.html#221-obtain-paddlex-source-code","title":"2.2.1 Obtain PaddleX Source Code","text":"

Next, use the following command to obtain the latest PaddleX source code from GitHub:

git clone https://github.com/PaddlePaddle/PaddleX.git\n
If accessing GitHub is slow, you can download from Gitee instead, using the following command:

git clone https://gitee.com/paddlepaddle/PaddleX.git\n
"},{"location":"en/installation/installation.html#222-install-paddlex","title":"2.2.2 Install PaddleX","text":"

After obtaining the latest PaddleX source code, you can choose between Wheel package installation mode or plugin installation mode.

  • If you choose Wheel package installation mode, execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n
  • If you choose plugin installation mode and the plugin you need is named PaddleXXX (there can be multiple), execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX plugins\npaddlex --install PaddleXXX\n

For example, if you need to install the PaddleOCR and PaddleClas plugins, execute the following commands to install the plugins:

# Install PaddleOCR and PaddleClas plugins\npaddlex --install PaddleOCR PaddleClas\n

If you need to install all plugins, you do not need to specify the plugin names, just execute the following command:

# Install all PaddleX plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com as a clone source. You can specify the clone source using --platform.

For example, if you need to use gitee.com as the clone source to install all PaddleX plugins, just execute the following command:

# Install PaddleX plugins\npaddlex --install --platform gitee.com\n

After installation, you will see the following prompt:

All packages are installed.\n

For PaddleX installation on more hardware environments, please refer to the PaddleX Multi-hardware Usage Guide

"},{"location":"en/installation/paddlepaddle_install.html","title":"PaddlePaddle Local Installation Tutorial","text":"

When installing PaddlePaddle, you can choose to install it via Docker or pip.

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-docker","title":"Installing PaddlePaddle via Docker","text":"

If you choose to install via Docker, please refer to the following commands to use the official PaddlePaddle Docker image to create a container named paddlex and map the current working directory to the /paddle directory inside the container:

If your Docker version >= 19.03, please use:

# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\nnvidia-docker run --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • Note: For more official PaddlePaddle Docker images, please refer to the PaddlePaddle official website

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-pip","title":"Installing PaddlePaddle via pip","text":"

If you choose to install via pip, please refer to the following commands to install PaddlePaddle in your current environment using pip:

# CPU\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# GPU, this command is only suitable for machines with CUDA version 11.8\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# GPU, this command is only suitable for machines with CUDA version 12.3\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n
Note: For more PaddlePaddle Wheel versions, please refer to the PaddlePaddle official website.

For installing PaddlePaddle on other hardware, please refer to PaddleX Multi-hardware Usage Guide.

After installation, you can verify if PaddlePaddle is successfully installed using the following command:

python -c \"import paddle; print(paddle.__version__)\"\n
If the installation is successful, the following content will be output:

3.0.0-beta2\n

\u2757 Note: If you encounter any issues during the installation process, feel free to submit an issue in the Paddle repository.

"},{"location":"en/module_usage/instructions/benchmark.html","title":"\u6a21\u578b\u200b\u63a8\u7406\u200b Benchmark","text":"

PaddleX \u200b\u652f\u6301\u200b\u7edf\u8ba1\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff0c\u200b\u9700\u200b\u901a\u8fc7\u200b\u73af\u5883\u53d8\u91cf\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

  • PADDLE_PDX_INFER_BENCHMARK\uff1a\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b True \u200b\u65f6\u5219\u200b\u5f00\u542f\u200b Benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_WARMUP\uff1a\u200b\u8bbe\u7f6e\u200b warm up\uff0c\u200b\u5728\u200b\u5f00\u59cb\u200b\u6d4b\u8bd5\u200b\u524d\u200b\uff0c\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u5faa\u73af\u200b\u8fed\u4ee3\u200b n \u200b\u6b21\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 0\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_DATA_SIZE\uff1a \u200b\u8bbe\u7f6e\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u7684\u200b\u5c3a\u5bf8\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 224\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_ITER\uff1a\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b Benchmark \u200b\u6d4b\u8bd5\u200b\u7684\u200b\u5faa\u73af\u200b\u6b21\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u4e3a\u200b None \u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_OUTPUT\uff1a\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u4fdd\u5b58\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b ./benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b None\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4fdd\u5b58\u200b Benchmark \u200b\u6307\u6807\u200b\uff1b

\u200b\u4f7f\u7528\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

PADDLE_PDX_INFER_BENCHMARK=True \\\nPADDLE_PDX_INFER_BENCHMARK_WARMUP=5 \\\nPADDLE_PDX_INFER_BENCHMARK_DATA_SIZE=320 \\\nPADDLE_PDX_INFER_BENCHMARK_ITER=10 \\\nPADDLE_PDX_INFER_BENCHMARK_OUTPUT=./benchmark \\\npython main.py \\\n    -c ./paddlex/configs/object_detection/PicoDet-XS.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=None \\\n    -o Predict.batch_size=2 \\\n    -o Predict.input=None\n

\u200b\u5728\u200b\u5f00\u542f\u200b Benchmark \u200b\u540e\u200b\uff0c\u200b\u5c06\u200b\u81ea\u52a8\u200b\u6253\u5370\u200b benchmark \u200b\u6307\u6807\u200b\uff1a

+----------------+-----------------+-----------------+------------------------+\n|   Component    | Total Time (ms) | Number of Calls | Avg Time Per Call (ms) |\n+----------------+-----------------+-----------------+------------------------+\n|    ReadCmp     |   99.60412979   |        10       |       9.96041298       |\n|     Resize     |   17.01641083   |        20       |       0.85082054       |\n|   Normalize    |   44.61312294   |        20       |       2.23065615       |\n|   ToCHWImage   |    0.03385544   |        20       |       0.00169277       |\n|    Copy2GPU    |   13.46874237   |        10       |       1.34687424       |\n|     Infer      |   71.31743431   |        10       |       7.13174343       |\n|    Copy2CPU    |    0.39076805   |        10       |       0.03907681       |\n| DetPostProcess |    0.36168098   |        20       |       0.01808405       |\n+----------------+-----------------+-----------------+------------------------+\n+-------------+-----------------+---------------------+----------------------------+\n|    Stage    | Total Time (ms) | Number of Instances | Avg Time Per Instance (ms) |\n+-------------+-----------------+---------------------+----------------------------+\n|  PreProcess |   161.26751900  |          20         |         8.06337595         |\n|  Inference  |   85.17694473   |          20         |         4.25884724         |\n| PostProcess |    0.36168098   |          20         |         0.01808405         |\n|   End2End   |   256.90770149  |          20         |        12.84538507         |\n|    WarmUp   |  5412.37807274  |          10         |        541.23780727        |\n+-------------+-----------------+---------------------+----------------------------+\n

\u200b\u5728\u200b Benchmark \u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u7edf\u8ba1\u200b\u8be5\u200b\u6a21\u578b\u200b\u5168\u90e8\u200b\u7ec4\u4ef6\u200b\uff08Component\uff09\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001\u200b\u8c03\u7528\u200b\u6b21\u6570\u200b\uff08Number of Calls\uff09\u3001\u200b\u8c03\u7528\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Call\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u4ee5\u53ca\u200b\u6309\u200b\u9884\u70ed\u200b\uff08WarmUp\uff09\u3001\u200b\u9884\u5904\u7406\u200b\uff08PreProcess\uff09\u3001\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\uff08Inference\uff09\u3001\u200b\u540e\u5904\u7406\u200b\uff08PostProcess\uff09\u200b\u548c\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\uff08End2End\uff09\u200b\u8fdb\u884c\u200b\u5212\u5206\u200b\u7684\u200b\u8017\u65f6\u200b\u7edf\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u6bcf\u4e2a\u200b\u9636\u6bb5\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001**\u200b\u6837\u672c\u6570\u200b\uff08Number of Instances\uff09\u200b\u548c\u200b**\u200b\u5355\u200b\u6837\u672c\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Instance\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u540c\u65f6\u200b\uff0c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5230\u200b\u5230\u200b\u672c\u5730\u200b\uff1a ./benchmark/detail.csv \u200b\u548c\u200b ./benchmark/summary.csv\uff1a

Component,Total Time (ms),Number of Calls,Avg Time Per Call (ms)\nReadCmp,99.60412979125977,10,9.960412979125977\nResize,17.01641082763672,20,0.8508205413818359\nNormalize,44.61312294006348,20,2.230656147003174\nToCHWImage,0.033855438232421875,20,0.0016927719116210938\nCopy2GPU,13.468742370605469,10,1.3468742370605469\nInfer,71.31743431091309,10,7.131743431091309\nCopy2CPU,0.39076805114746094,10,0.039076805114746094\nDetPostProcess,0.3616809844970703,20,0.018084049224853516\n
Stage,Total Time (ms),Number of Instances,Avg Time Per Instance (ms)\nPreProcess,161.26751899719238,20,8.06337594985962\nInference,85.17694473266602,20,4.258847236633301\nPostProcess,0.3616809844970703,20,0.018084049224853516\nEnd2End,256.90770149230957,20,12.845385074615479\nWarmUp,5412.3780727386475,10,541.2378072738647\n
"},{"location":"en/module_usage/instructions/config_parameters_common.html","title":"PaddleX Common Model Configuration File Parameter Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_common.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_common.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; Image classification, pedestrian attribute recognition, vehicle attribute recognition, document orientation classification, object detection, pedestrian detection, vehicle detection, face detection, anomaly detection, text detection, seal text detection, text recognition, table recognition, image rectification, and layout area detection do not support data format conversion; Image multi-label classification supports COCO format conversion; Image feature, semantic segmentation, and instance segmentation support LabelMe format conversion; Object detection and small object detection support VOC and LabelMe format conversion; Formula recognition supports PKL format conversion; Time series prediction, time series anomaly detection, and time series classification support xlsx and xls format conversion False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null split.gallery_percent int Sets the percentage of gallery samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and query_percent is 100; This parameter is only used in the image feature module null split.query_percent int Sets the percentage of query samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and gallery_percent is 100; This parameter is only used in the image feature module null"},{"location":"en/module_usage/instructions/config_parameters_common.html#train","title":"Train","text":"Parameter Name Data Type Description Default Value num_classes int Number of classes in the dataset; If you need to train on a private dataset, you need to set this parameter; Image rectification, text detection, seal text detection, text recognition, formula recognition, table recognition, time series prediction, time series anomaly detection, and time series classification do not support this parameter Number of classes specified in the YAML file epochs_iters int Number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Training batch size Training batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file pretrain_weight_path str Pre-trained weight path null warmup_steps int Warm-up steps Warm-up steps specified in the YAML file resume_path str Model resume path after interruption null log_interval int Training log printing interval Training log printing interval specified in the YAML file eval_interval int Model evaluation interval Model evaluation interval specified in the YAML file save_interval int Model saving interval; not supported for anomaly detection, semantic segmentation, image rectification, time series forecasting, time series anomaly detection, and time series classification Model saving interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights log_interval int Evaluation log printing interval Evaluation log printing interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_common.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html","title":"PaddleX Time Series Task Model Configuration File Parameters Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; time series prediction, anomaly detection, and classification support data conversion from xlsx and xls formats False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#train","title":"Train","text":""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#common-parameters-for-time-series-tasks","title":"Common Parameters for Time Series Tasks","text":"Parameter Name Data Type Description Default Value epochs_iters int The number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Batch size Batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file time_col str Time column, set the column name of the time series dataset's time column based on your data. Time column specified in the YAML file freq str or int Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h. Frequency specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-forecasting-parameters","title":"Time Series Forecasting Parameters","text":"Parameter Name Data Type Description Default Value target_cols str Target variable column(s), set the column name(s) of the target variable(s) in the time series dataset, can be multiple, separated by commas OT input_len int For time series forecasting tasks, this parameter represents the length of historical time series input to the model; the input length should be considered in conjunction with the prediction length, generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy. 96 predict_len int The length of the future sequence that you want the model to predict; the prediction length should be considered in conjunction with the actual scenario, generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy. 96 patience int Early stopping mechanism parameter, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; a larger patience value generally results in longer training time. 10"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-anomaly-detection","title":"Time Series Anomaly Detection","text":"Parameter Name Data Type Description Default Value input_len int For time series anomaly detection tasks, this parameter represents the length of the time series input to the model, which will slice the time series according to this length to predict whether there is an anomaly in this segment of the time series; the input length should be considered in conjunction with the actual scenario. For example, an input length of 96 indicates that you want to predict whether there are anomalies in 96 time points. 96 feature_cols str Feature variables indicating variables related to whether the device is abnormal, e.g., whether the device is abnormal may be related to the heat dissipation during its operation. Set the column name(s) of the feature variable(s) based on your data, can be multiple, separated by commas. feature_0,feature_1 label_col str Represents the number indicating whether a time series point is abnormal, with 1 for abnormal points and 0 for normal points. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-classification","title":"Time Series Classification","text":"Parameter Name Data Type Description Default Value target_cols str Feature variable columns used for category discrimination. You need to set the column names of the target variables in the time series dataset based on your own data. It can be multiple, separated by commas. dim_0,dim_1,dim_2 freq str or int Frequency, which needs to be set based on your own data. Examples of time frequencies include: 1min, 5min, 1h. 1 group_id str A group ID represents a time series sample. Time series sequences with the same ID constitute a sample. Set the column name of the specified group ID based on your own data, e.g., group_id. group_id static_cov_cols str Represents the category number column of the time series. The labels of the same sample are the same. Set the column name of the category based on your own data, e.g., label. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/model_python_API.html","title":"PaddleX Single Model Python Usage Instructions","text":"

Before using Python scripts for single model quick inference, please ensure you have completed the installation of PaddleX following the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/instructions/model_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification model as an example, the usage is as follows:

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, just three steps:

  • Call the create_model() method to instantiate the prediction model object;
  • Call the predict() method of the prediction model object to perform inference prediction;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/module_usage/instructions/model_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/module_usage/instructions/model_python_API.html#1-instantiate-the-prediction-model-object-by-calling-the-create_model-method","title":"1. Instantiate the Prediction Model Object by Calling the create_model() Method","text":"
  • create_model: Instantiate the prediction model object;
  • Parameters:
    • model_name: str type, model name or local inference model file path, such as \"PP-LCNet_x1_0\", \"/path/to/PP-LCNet_x1_0_infer/\";
    • device: str type, used to set the model inference device, such as \"cpu\", \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/module_usage/instructions/model_python_API.html#2-perform-inference-prediction-by-calling-the-predict-method-of-the-prediction-model-object","title":"2. Perform Inference Prediction by Calling the predict() Method of the Prediction Model Object","text":"
  • predict: Use the defined prediction model to predict the input data;
  • Parameters:
    • input: Any type, supports str type representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV models, supports numpy.ndarray representing image data; for TS models, supports pandas.DataFrame type data; also supports list types composed of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/module_usage/instructions/model_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/module_usage/instructions/model_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes_1","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html","title":"Unsupervised Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#i-overview","title":"I. Overview","text":"

Unsupervised anomaly detection is a technology that automatically identifies and detects anomalies or rare samples that are significantly different from the majority of data in a dataset, without labels or with a small amount of labeled data. This technology is widely used in many fields such as industrial manufacturing quality control and medical diagnosis.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link ROCAUC\uff08Avg\uff09 Model Size (M) Description STFPMInference Model/Trained Model 0.962 22.5 An unsupervised anomaly detection algorithm based on representation consists of a pre-trained teacher network and a student network with the same structure. The student network detects anomalies by matching its own features with the corresponding features in the teacher network.

The above model accuracy indicators are measured from the MVTec_AD dataset.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the unsupervised anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the unsupervised anomaly detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"STFPM\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"uad_grid.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better unsupervised anomaly detection models. Before using PaddleX to develop unsupervised anomaly detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mvtec_examples.tar -P ./dataset\ntar -xf ./dataset/mvtec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"train_samples\": 264,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"val_samples\": 57,\n    \"num_classes\": 231\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mvtec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 264;
  • attributes.val_samples: The number of validation samples in this dataset is 57;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of STFPM as an example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is STFPM.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's STFPM.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"uad_grid.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is STFPM.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The unsupervised anomaly detection module can be integrated into PaddleX pipelines such as Image_anomaly_detection. Simply replace the model path to update the unsupervised anomaly detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the unsupervised anomaly detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html","title":"Face Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#i-overview","title":"I. Overview","text":"

Face detection is a fundamental task in object detection, aiming to automatically identify and locate the position and size of faces in input images. It serves as the prerequisite and foundation for subsequent tasks such as face recognition and face analysis. Face detection accomplishes this by constructing deep neural network models that learn the feature representations of faces, enabling efficient and accurate face detection.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 An improved model of BlazeFace, incorporating FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face Detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face Detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the face detection module. You can switch models under this module freely, and you can also integrate the model inference of the face detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet_LCNet_x2_5_face\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_detection.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better face detection models. Before using PaddleX to develop face detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerface_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerface_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_849.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_Parade_0_904.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_799.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_384.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_538.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_429.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerface_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1;
  • attributes.train_samples: The number of training samples in this dataset is 500;
  • attributes.val_samples: The number of validation samples in this dataset is 100;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Face detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet_LCNet_x2_5_face as an example:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet_LCNet_x2_5_face.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet_LCNet_x2_5_face.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_detection.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet_LCNet_x2_5_face.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The face detection module can be integrated into PaddleX pipelines such as Face Recognition. Simply replace the model path to update the face detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the face detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html","title":"Face Feature Module Usage Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#i-overview","title":"I. Overview","text":"

Face feature models typically take standardized face images processed through detection, extraction, and keypoint correction as input. These models extract highly discriminative facial features from these images for subsequent modules, such as face matching and verification tasks.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"\ud83d\udc49Details of Model List ModelModel Download Link Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face feature model trained on MobileFaceNet with MS1Mv3 dataset ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face feature model trained on ResNet50 with MS1Mv3 dataset

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Tutorial

After installing the whl package, a few lines of code can complete the inference of the face feature module. You can switch models under this module freely, and you can also integrate the model inference of the face feature module into your project. Before running the following code, please download the example image to your local machine.

from paddlex import create_model\n\nmodel_name = \"MobileFaceNet\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_recognition_001.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n

For more information on using the PaddleX single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better face feature models. Before developing face feature models with PaddleX, ensure you have installed the PaddleX PaddleClas plugin. The installation process can be found in the PaddleX Local Installation Tutorial

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the official demo data. If you wish to use a private dataset for subsequent model training, the training dataset for the face feature module is organized in a general image classification dataset format. You can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial. If you wish to use a private dataset for subsequent model evaluation, note that the validation dataset format for the face feature module differs from the training dataset format. Please refer to Section 4.1.4 Data Organization Face Feature Module

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_rec_examples.tar -P ./dataset\ntar -xf ./dataset/face_rec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_label_file\": \"../../dataset/face_rec_examples/train/label.txt\",\n    \"train_num_classes\": 995,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/01378592.jpg\",\n      \"check_dataset/demo_img/04331410.jpg\",\n      \"check_dataset/demo_img/03485713.jpg\",\n      \"check_dataset/demo_img/02382123.jpg\",\n      \"check_dataset/demo_img/01722397.jpg\",\n      \"check_dataset/demo_img/02682349.jpg\",\n      \"check_dataset/demo_img/00272794.jpg\",\n      \"check_dataset/demo_img/03151987.jpg\",\n      \"check_dataset/demo_img/01725764.jpg\",\n      \"check_dataset/demo_img/02580369.jpg\"\n    ],\n    \"val_label_file\": \"../../dataset/face_rec_examples/val/pair_label.txt\",\n    \"val_num_classes\": 2,\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/Don_Carcieri_0001.jpg\",\n      \"check_dataset/demo_img/Eric_Fehr_0001.jpg\",\n      \"check_dataset/demo_img/Harry_Kalas_0001.jpg\",\n      \"check_dataset/demo_img/Francis_Ford_Coppola_0001.jpg\",\n      \"check_dataset/demo_img/Amer_al-Saadi_0001.jpg\",\n      \"check_dataset/demo_img/Sergei_Ivanov_0001.jpg\",\n      \"check_dataset/demo_img/Erin_Runnion_0003.jpg\",\n      \"check_dataset/demo_img/Bill_Stapleton_0001.jpg\",\n      \"check_dataset/demo_img/Daniel_Bruehl_0001.jpg\",\n      \"check_dataset/demo_img/Clare_Short_0004.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/face_rec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_num_classes: The number of classes in this training dataset is 995;
  • attributes.val_num_classes: The number of classes in this validation dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 1000;
  • attributes.val_samples: The number of validation samples in this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or adding hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

The face feature module does not support data format conversion or dataset splitting.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#414-data-organization-for-face-feature-module","title":"4.1.4 Data Organization for Face Feature Module","text":"

The format of the validation dataset for the face feature module differs from the training dataset. If you need to evaluate model accuracy on private data, please organize your dataset as follows:

face_rec_dataroot      # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 train              # Directory for saving the training dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500label.txt       # Training set annotation file, the file name cannot be changed. Each line gives the relative path of the image to `train` and the face image class (face identity) id, separated by a space. Example content: images/image_06765.jpg 0\n\u251c\u2500\u2500 val                # Directory for saving the validation dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in pair_label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500 pair_label.txt  # Validation dataset annotation file, the file name cannot be changed. Each line gives the paths of two images to be compared and a 0 or 1 label indicating whether the pair of images belong to the same person, separated by spaces.\n

Example content of the validation set annotation file pair_label.txt:

# Face image 1.jpg Face image 2.jpg Label (0 indicates the two face images do not belong to the same person, 1 indicates they do)\nimages/Angela_Merkel_0001.jpg images/Angela_Merkel_0002.jpg 1\nimages/Bruce_Gebhardt_0001.jpg images/Masao_Azuma_0001.jpg 0\nimages/Francis_Ford_Coppola_0001.jpg images/Francis_Ford_Coppola_0002.jpg 1\nimages/Jason_Kidd_0006.jpg images/Jason_Kidd_0008.jpg 1\nimages/Miyako_Miyazaki_0002.jpg images/Munir_Akram_0002.jpg 0\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here is an example of training MobileFaceNet:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file for the model (here it is MobileFaceNet.yaml)
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or by appending parameters in the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • When training other models, specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU). After completing model training, all outputs are saved in the specified output directory (default is ./output/). Typically, the following outputs are included:
  • train_result.json: A file that records the training results, indicating whether the training task was successfully completed, and includes metrics, paths to related files, etc.
  • train.log: A log file that records changes in model metrics, loss variations, and other details during the training process.
  • config.yaml: A configuration file that logs the hyperparameter settings for the current training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Files related to model weights, including network parameters, optimizer, EMA (Exponential Moving Average), static graph network parameters, and static graph network structure.
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/face_detection/MobileFaceNet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `MobileFaceNet.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to [PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand) During model evaluation, the path to the model weights file needs to be specified. Each configuration file has a default weight save path built in. If you need to change it, you can set it by appending a command line parameter, such as `-o Evaluate.weight_path=\"./output/best_model/best_model/model.pdparams\"`. After completing the model evaluation, an `evaluate_result.json` file will be produced, which records the evaluation results. Specifically, it records whether the evaluation task was completed normally and the model's evaluation metrics, including Accuracy. ### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be implemented through two methods: command line and wheel package. #### 4.4.1 Model Inference * To perform inference predictions through the command line, you only need the following command. Before running the following code, please download the [example image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/face_recognition_001.jpg) to your local machine.
python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the path to the model's `.yaml` configuration file (here it is `MobileFaceNet.yaml`) * Specify the mode as model inference prediction: `-o Global.mode=predict` * Specify the path to the model weights: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the path to the input data: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.md). #### 4.4.2 Model Integration The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The face feature module can be integrated into the PaddleX pipeline for [Face Recognition](../../../pipeline_usage/tutorials/face_recognition_pipelines/face_recognition.en.md). You only need to replace the model path to update the face feature module of the relevant pipeline. In pipeline integration, you can use high-performance deployment and service-oriented deployment to deploy the model you obtained. 2. Module Integration The weights you produced can be directly integrated into the face feature module. You can refer to the Python example code in [Quick Integration](#III.-Quick-Integration) and only need to replace the model with the path to the model you trained."},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html","title":"Human Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#i-overview","title":"I. Overview","text":"

Human detection is a subtask of object detection, which utilizes computer vision technology to identify the presence of pedestrians in images or videos and provide the specific location information for each pedestrian. This information is crucial for various applications such as intelligent video surveillance, human behavior analysis, autonomous driving, and intelligent robots.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Human detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The evaluation set for the above accuracy metrics is CrowdHuman dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform human detection with just a few lines of code. You can easily switch between models in this module and integrate the human detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_human\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"human_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better human detection models. Before using PaddleX to develop human detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerperson_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerperson_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000041.jpg\",\n      \"check_dataset/demo_img/000042.jpg\",\n      \"check_dataset/demo_img/000044.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/001138.jpg\",\n      \"check_dataset/demo_img/001140.jpg\",\n      \"check_dataset/demo_img/001141.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerperson_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Human detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE-S_human as an example:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE-S_human.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE-S_human.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer toPaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"human_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-YOLOE-S_human.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the human detection module. You can refer to the Python sample code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html","title":"Image Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#i-overview","title":"I. Overview","text":"

The image classification module is a crucial component in computer vision systems, responsible for categorizing input images. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. Typically, the image classification module receives an image as input and, through deep learning or other machine learning algorithms, classifies it into predefined categories based on its characteristics and content. For instance, in an animal recognition system, the image classification module might need to classify an input image as \"cat,\" \"dog,\" \"horse,\" etc. The classification results from the image classification module are then output for use by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can complete image classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the image classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better image classification models. Before using PaddleX to develop image classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset\ntar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

One command is all you need to complete data validation:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Results Details (Click to Expand)
{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"dataset/label.txt\",\n    \"num_classes\": 102,\n    \"train_samples\": 1020,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/image_01904.jpg\",\n      \"check_dataset/demo_img/image_06940.jpg\"\n    ],\n    \"val_samples\": 1020,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/image_01937.jpg\",\n      \"check_dataset/demo_img/image_06958.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/cls_flowers_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The above validation results, with check_pass being True, indicate that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 102;
  • attributes.train_samples: The number of training set samples in this dataset is 1020;
  • attributes.val_samples: The number of validation set samples in this dataset is 1020;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Image classification does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
  • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which should be an integer between 0-100, ensuring that the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters also support being set through appending command line arguments:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image classification model PP-LCNet_x1_0 as an example:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml. When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. Using PaddleX for model evaluation, a single command can complete the model evaluation:

python main.py -c  paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
Similar to model training, the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path of the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including val.top1, val.top5;

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_classification_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The image classification module can be integrated into the General Image Classification Pipeline of PaddleX. Simply replace the model path to update the image classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

2.Module Integration

The weights you produce can be directly integrated into the image classification module. You can refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html","title":"Image Feature Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#i-overview","title":"I. Overview","text":"

The image feature module is one of the important tasks in computer vision, primarily referring to the automatic extraction of useful features from image data using deep learning methods, to facilitate subsequent image retrieval tasks. The performance of this module directly affects the accuracy and efficiency of the subsequent tasks. In practical applications, image features typically output a set of feature vectors, which can effectively represent the content, structure, texture, and other information of the image, and will be passed as input to the subsequent retrieval module for processing.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_recInference Model/Trained Model 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: object detection, feature extraction, and vector retrieval. These models are part of the feature extraction module and can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_baseInference Model/Trained Model 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_largeInference Model/Trained Model 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are Recall@1 from AliProducts. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the image feature module. You can switch between models under this module freely, and you can also integrate the model inference of the image feature module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-ShiTuV2_rec\")\noutput = model.predict(\"general_image_recognition_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better image feature models. Before developing image feature models with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Feature Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/Inshop_examples.tar -P ./dataset\ntar -xf ./dataset/Inshop_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/05_1_front.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/04_2_side.jpg\",\n      \"check_dataset/demo_img/12_1_front.jpg\",\n      \"check_dataset/demo_img/07_2_side.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/01_1_front.jpg\"\n    ],\n    \"gallery_samples\": 110,\n    \"gallery_sample_paths\": [\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/01_4_full.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/03_4_full.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\",\n      \"check_dataset/demo_img/03_2_side.jpg\"\n    ],\n    \"query_samples\": 125,\n    \"query_sample_paths\": [\n      \"check_dataset/demo_img/08_7_additional.jpg\",\n      \"check_dataset/demo_img/01_7_additional.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/09_7_additional.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/02_7_additional.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/Inshop_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ShiTuRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 1000; * attributes.gallery_samples: The number of gallery (or reference) samples in this dataset is 110; * attributes.query_samples: The number of query samples in this dataset is 125; * attributes.train_sample_paths: A list of relative paths to the visual images of training samples in this dataset; * attributes.gallery_sample_paths: A list of relative paths to the visual images of gallery (or reference) samples in this dataset; * attributes.query_sample_paths: A list of relative paths to the visual images of query samples in this dataset;

Additionally, the dataset verification also analyzes the number of images and image categories within the dataset, and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is null, optional value is LabelMe;

For example, if you want to convert a LabelMe format dataset to ShiTuRecDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, the dataset will be re-split, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, the type is any integer between 0-100, and it needs to ensure that the sum of gallery_percent and query_percent values is 100;

For example, if you want to re-split the dataset with 70% training set, 20% gallery set, and 10% query set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 70\n    gallery_percent: 20\n    query_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=70 \\\n    -o CheckDataset.split.gallery_percent=20 \\\n    -o CheckDataset.split.query_percent=10\n

\u2757Note: Due to the specificity of image feature model evaluation, data partitioning is meaningful only when the train, query, and gallery sets belong to the same category system. During the evaluation of recognition models, it is imperative that the gallery and query sets belong to the same category system, which may or may not be the same as the train set. If the gallery and query sets do not belong to the same category system as the train set, the evaluation after data partitioning becomes meaningless. It is recommended to proceed with caution.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the image feature model PP-ShiTuV2_rec as an example:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

\u2757 Note: The inference result of the recognition model is a set of vectors, which requires a retrieval module to complete image feature.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image feature module can be integrated into the General Image Recognition Pipeline (comming soon) of PaddleX. Simply replace the model path to update the image feature module of the relevant pipeline. In pipeline integration, you can use service-oriented deployment to deploy your trained model.

2.Module Integration

The weights you produce can be directly integrated into the image feature module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html","title":"Image Multi-Label Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#i-overview","title":"I. Overview","text":"

The image multi-label classification module is a crucial component in computer vision systems, responsible for assigning multiple labels to input images. Unlike traditional image classification tasks that assign a single category to an image, multi-label classification tasks require assigning multiple relevant categories to an image. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The image multi-label classification module typically takes an image as input and, through deep learning or other machine learning algorithms, classifies it into multiple predefined categories based on its characteristics and content. For example, an image containing both a cat and a dog might be labeled as both \"cat\" and \"dog\" by the image multi-label classification module. These classification labels are then output for subsequent processing and analysis by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(%) Model Size (M) Description CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 325.6 M CLIP_ML is an image multi-label classification model based on CLIP, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 M PP-HGNetV2_ML is an image multi-label classification model based on PP-HGNetV2, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 M PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 M PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 M PP-LCNet_ML is an image multi-label classification model based on PP-LCNet, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. ResNet50_MLInference Model/Trained Model 83.50 108.9 M ResNet50_ML is an image multi-label classification model based on ResNet50, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder.

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete multi-label classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the multi-label classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_ML\")\noutput = model.predict(\"multilabel_classification_005.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better multi-label classification models. Before using PaddleX to develop multi-label classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Multi-Label Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mlcls_nus_examples.tar -P ./dataset\ntar -xf ./dataset/mlcls_nus_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/mlcls_nus_examples/label.txt\",\n    \"num_classes\": 33,\n    \"train_samples\": 17463,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0543_4338693.jpg\",\n      \"check_dataset/demo_img/0272_347806939.jpg\",\n      \"check_dataset/demo_img/0069_2291994812.jpg\",\n      \"check_dataset/demo_img/0012_1222850604.jpg\",\n      \"check_dataset/demo_img/0238_53773041.jpg\",\n      \"check_dataset/demo_img/0373_541261977.jpg\",\n      \"check_dataset/demo_img/0567_519506868.jpg\",\n      \"check_dataset/demo_img/0023_289621557.jpg\",\n      \"check_dataset/demo_img/0581_484524659.jpg\",\n      \"check_dataset/demo_img/0325_120753036.jpg\"\n    ],\n    \"val_samples\": 17463,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0546_130758157.jpg\",\n      \"check_dataset/demo_img/0284_2230710138.jpg\",\n      \"check_dataset/demo_img/0090_1491261559.jpg\",\n      \"check_dataset/demo_img/0013_392798436.jpg\",\n      \"check_dataset/demo_img/0246_2248376356.jpg\",\n      \"check_dataset/demo_img/0377_1349296474.jpg\",\n      \"check_dataset/demo_img/0570_2457645006.jpg\",\n      \"check_dataset/demo_img/0027_309333946.jpg\",\n      \"check_dataset/demo_img/0584_132639537.jpg\",\n      \"check_dataset/demo_img/0329_206031527.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/mlcls_nus_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 33;
  • attributes.train_samples: The number of training set samples in this dataset is 17463;
  • attributes.val_samples: The number of validation set samples in this dataset is 17463;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)(2) Dataset Splitting","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

The multi-label image classification supports the conversion of COCO format datasets to MLClsDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Multi-label image classification supports converting COCO format datasets to MLClsDataset format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with the optional value of COCO;

For example, if you want to convert a COCO format dataset to MLClsDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: COCO\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image multi-label classification model PP-LCNet_x1_0_ML as an example:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_ML.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"multilabel_classification_005.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image multi-label classification module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the image multi-label classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the image multi-label classification module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html","title":"Instance Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#i-overview","title":"I. Overview","text":"

The instance segmentation module is a crucial component in computer vision systems, responsible for identifying and marking pixels that contain specific object instances in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The instance segmentation module typically outputs pixel-level masks (masks) for each target instance, which are then passed as input to the object recognition module for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the instance segmentation module. You can switch models under this module freely, and you can also integrate the model inference of the instance segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"Mask-RT-DETR-L\")\noutput = model.predict(\"general_instance_segmentation_004.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better instance segmentation models. Before using PaddleX to develop instance segmentation models, please ensure that you have installed the relevant model training plugins for segmentation in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides data verification functionality for each module, and only data that passes the verification can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the officially provided demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_coco_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#412-data-verification","title":"4.1.2 Data Verification","text":"

Data verification can be completed with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 2,\n    \"train_samples\": 79,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/pexels-photo-634007.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-59576.png\"\n    ],\n    \"val_samples\": 19,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/peasant-farmer-farmer-romania-botiza-47862.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-715546.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/instance_seg_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 79;
  • attributes.val_samples: The number of validation samples in this dataset is 19;
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset; Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The instance segmentation task supports converting LabelMe format to COCO format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Below are some example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Set to True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. The available source format is LabelMe; For example, if you want to convert a LabelMe dataset to COCO format, you need to modify the configuration file as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset will be re-split. The default is False;
  • train_percent: If the dataset is to be re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After data splitting, the original annotation files will be renamed as xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete model training. Taking the training of the instance segmentation model Mask-RT-DETR-L as an example:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
The following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is Mask-RT-DETR-L.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify the first 2 GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters Instructions.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is Mask-RT-DETR-L.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_instance_segmentation_004.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's Mask-RT-DETR-L.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX Pipeline or into your own project.

1.Pipeline Integration

The instance segmentation module can be integrated into the General Instance Segmentation Pipeline of PaddleX. Simply replace the model path to update the instance segmentation module of the relevant pipeline.

2.Module Integration The weights you produce can be directly integrated into the instance segmentation module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html","title":"Mainbody detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#i-overview","title":"I. Overview","text":"

Mainbody detection is a fundamental task in object detection, aiming to identify and extract the location and size of specific target objects, people, or entities from images and videos. By constructing deep neural network models, mainbody detection learns the feature representations of image subjects to achieve efficient and accurate detection.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_detInference Model/Trained Model 41.5 62.0 33.7 537.0 27.54 A mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common subjects simultaneously.

Note: The evaluation set for the above accuracy metrics is PaddleClas mainbody detection dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform mainbody detection inference with just a few lines of code. You can easily switch between models under this module, and integrate the mainbody detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-ShiTuV2_det\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better mainbody detection models. Before developing mainbody detection models with PaddleX, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mainbody_det_examples.tar -P ./dataset\ntar -xf ./dataset/mainbody_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mainbody_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 701.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 176.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Mainbody detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-ShiTuV2_det as an example:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-ShiTuV2_det.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-ShiTuV2_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The main body detection module can be integrated into PaddleX pipelines such as General Object Detection (comming soon). Simply replace the model path to update the main body detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the main body detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html","title":"Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#i-overview","title":"I. Overview","text":"

The object detection module is a crucial component in computer vision systems, responsible for locating and marking regions containing specific objects in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The object detection module typically outputs bounding boxes for the target regions, which are then passed as input to the object recognition module for further processing.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before proceeding with quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can perform object detection inference with just a few lines of code. You can easily switch between models within the module and integrate the object detection inference into your projects. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PicoDet-S\")\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher precision from existing models, you can leverage PaddleX's custom development capabilities to develop better object detection models. Before developing object detection models with PaddleX, ensure you have installed the object detection related training plugins. For installation instructions, refer to the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, prepare the corresponding dataset for the task module. PaddleX provides a data validation feature for each module, and only datasets that pass validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Object Detection Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Validate your dataset with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\",\n      \"check_dataset/demo_img/road237.png\",\n      \"check_dataset/demo_img/road733.png\",\n      \"check_dataset/demo_img/road861.png\",\n      \"check_dataset/demo_img/road762.png\",\n      \"check_dataset/demo_img/road515.png\",\n      \"check_dataset/demo_img/road754.png\",\n      \"check_dataset/demo_img/road173.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\",\n      \"check_dataset/demo_img/road544.png\",\n      \"check_dataset/demo_img/road596.png\",\n      \"check_dataset/demo_img/road857.png\",\n      \"check_dataset/demo_img/road203.png\",\n      \"check_dataset/demo_img/road589.png\",\n      \"check_dataset/demo_img/road655.png\",\n      \"check_dataset/demo_img/road245.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 704;
  • attributes.val_samples: The number of validation samples in this dataset is 176;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes in the dataset and generates a histogram (histogram.png) for visualization:

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, dataset splitting is performed. Default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After dataset splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the object detection model PicoDet-S as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The object detection module can be integrated into the General Object Detection Pipeline of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the object detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Pedestrian attribute recognition is a crucial component in computer vision systems, responsible for locating and labeling specific attributes of pedestrians in images or videos, such as gender, age, clothing color, and type. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The pedestrian attribute recognition module typically outputs attribute information for each pedestrian, which is then passed as input to other modules (e.g., pedestrian tracking, pedestrian re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the pedestrian attribute recognition module. You can easily switch models under this module and integrate the model inference of pedestrian attribute recognition into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_pedestrian_attribute\")\noutput = model.predict(\"pedestrian_attribute_006.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

Note: The index of the output value represents the following attributes: index 0 indicates whether a hat is worn, index 1 indicates whether glasses are worn, indexes 2-7 represent the style of the upper garment, indexes 8-13 represent the style of the lower garment, index 14 indicates whether boots are worn, indexes 15-17 represent the type of bag carried, index 18 indicates whether an object is held in front, indexes 19-21 represent age, index 22 represents gender, and indexes 23-25 represent orientation. Specifically, the attributes include the following types:

- Gender: Male, Female\n- Age: Under 18, 18-60, Over 60\n- Orientation: Front, Back, Side\n- Accessories: Glasses, Hat, None\n- Holding Object in Front: Yes, No\n- Bag: Backpack, Shoulder Bag, Handbag\n- Upper Garment Style: Striped, Logo, Plaid, Patchwork\n- Lower Garment Style: Striped, Patterned\n- Short-sleeved Shirt: Yes, No\n- Long-sleeved Shirt: Yes, No\n- Long Coat: Yes, No\n- Pants: Yes, No\n- Shorts: Yes, No\n- Skirt: Yes, No\n- Boots: Yes, No\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better pedestrian attribute recognition models. Before developing pedestrian attribute recognition with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/pedestrian_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/pedestrian_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/pedestrian_attribute_examples/label.txt\",\n    \"num_classes\": 26,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/020907.jpg\",\n      \"check_dataset/demo_img/004274.jpg\",\n      \"check_dataset/demo_img/009412.jpg\",\n      \"check_dataset/demo_img/026873.jpg\",\n      \"check_dataset/demo_img/030560.jpg\",\n      \"check_dataset/demo_img/022846.jpg\",\n      \"check_dataset/demo_img/009055.jpg\",\n      \"check_dataset/demo_img/015399.jpg\",\n      \"check_dataset/demo_img/006435.jpg\",\n      \"check_dataset/demo_img/055307.jpg\"\n    ],\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/080381.jpg\",\n      \"check_dataset/demo_img/080469.jpg\",\n      \"check_dataset/demo_img/080146.jpg\",\n      \"check_dataset/demo_img/080003.jpg\",\n      \"check_dataset/demo_img/080283.jpg\",\n      \"check_dataset/demo_img/080104.jpg\",\n      \"check_dataset/demo_img/080149.jpg\",\n      \"check_dataset/demo_img/080313.jpg\",\n      \"check_dataset/demo_img/080131.jpg\",\n      \"check_dataset/demo_img/080412.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/pedestrian_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 26;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Pedestrian attribute recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command-line arguments:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Taking the training of the PP-LCNet pedestrian attribute recognition model (PP-LCNet_x1_0_pedestrian_attribute) as an example:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"pedestrian_attribute_006.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" . Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The pedestrian attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the pedestrian attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the pedestrian attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html","title":"Semantic Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#i-overview","title":"I. Overview","text":"

Semantic segmentation is a technique in computer vision that classifies each pixel in an image, dividing the image into distinct semantic regions, with each region corresponding to a specific category. This technique generates detailed segmentation maps, clearly revealing objects and their boundaries in the image, providing powerful support for image analysis and understanding.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Semantic Segmentation module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Semantic Segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LiteSeg-T\")\noutput = model.predict(\"general_semantic_segmentation_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Semantic Segmentation models. Before developing a Semantic Segmentation model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Semantic Segmentation Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset\ntar -xf ./dataset/seg_optic_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/P0005.jpg\",\n      \"check_dataset/demo_img/P0050.jpg\"\n    ],\n    \"train_samples\": 267,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/N0139.jpg\",\n      \"check_dataset/demo_img/P0137.jpg\"\n    ],\n    \"val_samples\": 76,\n    \"num_classes\": 2\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/seg_optic_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 267;
  • attributes.val_samples: The number of validation samples in this dataset is 76;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Semantic segmentation supports converting LabelMe format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting LabelMe format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null, and the supported source dataset format is LabelMe;

For example, if you want to convert a LabelMe format dataset, you can download a sample LabelMe format dataset as follows:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n

After downloading, modify the paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the semantic segmentation model (PP-LiteSeg-T) as an example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mIoU.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model\" \\\n    -o Predict.input=\"general_semantic_segmentation_002.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document semantic segmentation module can be integrated into PaddleX pipelines such as the Semantic Segmentation Pipeline (Seg). Simply replace the model path to update the The document semantic segmentation module's model.

  1. Module Integration

The weights you produce can be directly integrated into the semantic segmentation module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html","title":"Small Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#i-overview","title":"I. Overview","text":"

Small object detection typically refers to accurately detecting and locating small-sized target objects in images or videos. These objects often have a small pixel size in images, typically less than 32x32 pixels (as defined by datasets like MS COCO), and may be obscured by the background or other objects, making them difficult to observe directly by the human eye. Small object detection is an important research direction in computer vision, aiming to precisely detect small objects with minimal visual features in images.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description (VisDrone) PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 52.1 57.1 1007.0 324.93 PP-YOLOE_plus small object detection model trained on VisDrone. VisDrone is a benchmark dataset specifically for unmanned aerial vehicle (UAV) visual data, which is used for small object detection due to the small size of the targets and the inherent challenges they pose. PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 42.8 65.5 324.4 77.29 PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 65.9 458.5 11172.7 340.42

Note: The evaluation set for the above accuracy metrics is VisDrone-DET dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete the inference of the small object detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the small object detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE_plus_SOD-S\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"small_object_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better small object detection models. Before using PaddleX to develop small object detection models, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/small_det_examples.tar -P ./dataset\ntar -xf ./dataset/small_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 1610,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/9999938_00000_d_0000352.jpg\",\n      \"check_dataset/demo_img/9999941_00000_d_0000014.jpg\",\n      \"check_dataset/demo_img/9999973_00000_d_0000043.jpg\"\n    ],\n    \"val_samples\": 548,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0000330_00801_d_0000804.jpg\",\n      \"check_dataset/demo_img/0000103_00180_d_0000026.jpg\",\n      \"check_dataset/demo_img/0000291_04001_d_0000888.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/small_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 10.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 1610.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 548.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Small object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Small object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE_plus_SOD-S as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o Train.num_classes=10\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE_plus_SOD-S.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"small_object_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Explanation.
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own projects.

  1. Pipeline Integration

The small object detection module can be integrated into the Small Object Detection Pipeline of PaddleX. Simply replace the model path to update the small object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the small object detection module. You can refer to the Python example code in Quick Integration, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, license plate number, etc. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The vehicle attribute recognition module typically outputs bounding boxes (Bounding Boxes) containing vehicle attribute information, which are then passed as input to other modules (e.g., vehicle tracking, vehicle re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the vehicle attribute recognition module. You can easily switch models under this module, and you can also integrate the model inference of the vehicle attribute recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_vehicle_attribute\")\noutput = model.predict(\"vehicle_attribute_007.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

Note: In the output, values indexed from 0-9 represent color attributes, corresponding to the following colors respectively: yellow, orange, green, gray, red, blue, white, golden, brown, black. Indices 10-18 represent vehicle type attributes, corresponding to the following vehicle types: sedan, suv, van, hatchback, mpv, pickup, bus, truck, estate.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better vehicle attribute recognition models. Before using PaddleX to develop vehicle attribute recognition models, ensure you have installed the classification-related model training plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/vehicle_attribute_examples/label.txt\",\n    \"num_classes\": 19,\n    \"train_samples\": 1200,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0018_c017_00033140_0.jpg\",\n      \"check_dataset/demo_img/0010_c019_00034275_0.jpg\",\n      \"check_dataset/demo_img/0015_c019_00068660_0.jpg\",\n      \"check_dataset/demo_img/0016_c017_00049590_1.jpg\",\n      \"check_dataset/demo_img/0018_c016_00052280_0.jpg\",\n      \"check_dataset/demo_img/0023_c001_00006995_0.jpg\",\n      \"check_dataset/demo_img/0022_c004_00065910_0.jpg\",\n      \"check_dataset/demo_img/0007_c019_00048655_1.jpg\",\n      \"check_dataset/demo_img/0022_c007_00072970_0.jpg\",\n      \"check_dataset/demo_img/0022_c008_00065785_0.jpg\"\n    ],\n    \"val_samples\": 300,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0025_c003_00054095_0.jpg\",\n      \"check_dataset/demo_img/0023_c013_00006350_1.jpg\",\n      \"check_dataset/demo_img/0024_c003_00046320_0.jpg\",\n      \"check_dataset/demo_img/0025_c005_00054795_2.jpg\",\n      \"check_dataset/demo_img/0024_c012_00041770_0.jpg\",\n      \"check_dataset/demo_img/0024_c007_00060845_1.jpg\",\n      \"check_dataset/demo_img/0023_c017_00013150_0.jpg\",\n      \"check_dataset/demo_img/0024_c014_00040410_0.jpg\",\n      \"check_dataset/demo_img/0025_c002_00050685_1.jpg\",\n      \"check_dataset/demo_img/0025_c005_00032645_0.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/vehicle_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 19;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1200;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 300;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle attribute recognition does not support dataset format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Training a model can be done with a single command, taking the training of the PP-LCNet vehicle attribute recognition model (PP-LCNet_x1_0_vehicle_attribute) as an example:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_vehicle_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_attribute_007.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The vehicle attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the vehicle attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the vehicle attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html","title":"Vehicle Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#i-overview","title":"I. Overview","text":"

Vehicle detection is a subtask of object detection, specifically referring to the use of computer vision technology to determine the presence of vehicles in images or videos and provide specific location information for each vehicle (such as the coordinates of the bounding box). This information is of great significance for various fields such as intelligent transportation systems, autonomous driving, and video surveillance.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicle 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicle 63.9 32.6 775.6 196.02 Note: The evaluation set for the above accuracy metrics is PPVehicle dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision. ## III. Quick Integration > \u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the [PaddleX Local Installation Guide](../../../installation/installation.en.md) After installing the wheel package, you can complete the inference of the vehicle detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the vehicle detection module into your project. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_vehicle\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"vehicle_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the [PaddleX Single-Model Python Script Usage Instructions](../../instructions/model_python_API.en.md). ## IV. Custom Development If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better vehicle detection models. Before using PaddleX to develop vehicle detection models, please ensure that you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the [PaddleX Local Installation Guide](../../../installation/installation.en.md). ### 4.1 Data Preparation Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to [PaddleX Object Detection Task Module Data Annotation Tutorial](../../../data_annotations/cv_modules/object_detection.en.md). #### 4.1.1 Demo Data Download You can download the demo dataset to a specified folder using the following commands:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_coco_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_coco_examples.tar -C ./dataset/\n
#### 4.1.2 Data Validation You can complete data validation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message `Check dataset passed !`. The validation result file will be saved in `./output/check_dataset_result.json`, and related outputs will be saved in the `./output/check_dataset` directory of the current directory. The output directory includes visualized example images and histograms of sample distributions. \ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20011__img00001.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00005.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00009.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20032__img00401.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00405.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00409.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/vehicle_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 4.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

#### 4.1.3 Dataset Format Conversion / Dataset Splitting (Optional) After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters. \ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
### 4.2 Model Training Model training can be completed with a single command, taking the training of `PP-YOLOE-S_vehicle` as an example:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
The steps required are: * Specify the `.yaml` configuration file path for the model (here it is `PP-YOLOE-S_vehicle.yaml`,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the [PaddleX Model List (CPU/GPU)](../../../support_list/models_list.en.md)) * Specify the mode as model training: `-o Global.mode=train` * Specify the training dataset path: `-o Global.dataset_dir` Other related parameters can be set by modifying the `Global` and `Train` fields in the `.yaml` configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: `-o Global.device=gpu:0,1`; to set the number of training epochs to 10: `-o Train.epochs_iters=10`. For more modifiable parameters and their detailed explanations, refer to the [PaddleX Common Configuration Parameters for Model Tasks](../../instructions/config_parameters_common.en.md). \ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `PP-YOLOE-S_vehicle.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to[PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package. #### 4.4.1 Model Inference The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The object detection module can be integrated into the [General Object Detection Pipeline](../../../pipeline_usage/tutorials/cv_pipelines/object_detection.en.md) of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model. 2. Module Integration The weights you produced can be directly integrated into the object detection module. You can refer to the Python example code in [Quick Integration](#\u200b\u4e09\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b), simply replace the model with the path to your trained model. * To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_detection.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the `.yaml` configuration file path of the model (here it is `PP-YOLOE-S_vehicle.yaml`) * Set the mode to model inference prediction: `-o Global.mode=predict` * Specify the model weight path: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the input data path: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.en.md). #### 4.4.2 Model Integration The weights you produced can be directly integrated into the vehicle detection module. You can refer to the Python example code in [Quick Integration](#iii-quick-integration), simply replace the model with the path to your trained model."},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html","title":"Document Image Orientation Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#i-overview","title":"I. Overview","text":"

The document image orientation classification module is aim to distinguish the orientation of document images and correct them through post-processing. In processes such as document scanning and ID card photography, capturing devices are sometimes rotated to obtain clearer images, resulting in images with varying orientations. Standard OCR pipelines cannot effectively handle such data. By utilizing image classification technology, we can pre-judge the orientation of document or ID card images containing text regions and adjust their orientations, thereby enhancing the accuracy of OCR processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as IDs and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

Just a few lines of code can complete the inference of the document image orientation classification module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the document image orientation classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_doc_ori\")\noutput = model.predict(\"img_rot180_demo.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/demo.png\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better document image orientation classification models. Before developing a document image orientation classification model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Classification Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/text_image_orientation.tar -P ./dataset\ntar -xf ./dataset/text_image_orientation.tar  -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"..\\/..\\/text_image_orientation\\/label.txt\",\n    \"num_classes\": 4,\n    \"train_samples\": 1553,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_10351.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_3908.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_7712.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_7480.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot270_9599.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_10323.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4885.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_3939.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7153.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1747.jpg\"\n    ],\n    \"val_samples\": 2593,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_3190.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_10272.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_9930.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_918.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_2079.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_8574.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7595.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_1751.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1573.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4401.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/text_image_orientation\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 1552;
  • attributes.val_samples: The number of validation samples in this dataset is 2593;
  • attributes.train_sample_paths: A list of relative paths to visual sample images for the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Document image orientation classification does not currently support dataset format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the document image orientation classification model (PP-LCNet_x1_0_doc_ori) as an example:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

You need to follow these steps:

  • Specify the path to the model's .yaml configuration file (here, PP-LCNet_x1_0_doc_ori.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train.
  • Specify the training dataset path: -o Global.dataset_dir.

Other relevant parameters can be set by modifying fields under Global and Train in the .yaml configuration file, or by appending arguments to the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and detailed explanations, refer to the PaddleX General Model Configuration File Parameters.

\ud83d\udc49 More Information (click to expand)
  • During model training, PaddleX automatically saves the model weight files, defaulting to output. If you want to specify a different save path, you can set it using the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concept of dynamic graph weights and static graph weights. During model training, it produces both dynamic and static graph weights. For model inference, it defaults to using static graph weights.
  • After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which records whether the training task was completed normally, as well as the output weight metrics and related file paths.

  • train.log: Training log file, which records changes in model metrics and loss during training.
  • config.yaml: Training configuration file, which records the hyperparameter configuration for this training.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. With PaddleX, model evaluation can be done with just one command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_doc_ori.yaml).
  • Set the mode to model inference prediction: -o Global.mode=predict.
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/best_model/inference\".
  • Specify the input data path: -o Predict.input=\"...\". Other relevant parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Description.
\ud83d\udc49 More Information (click to expand)
  • When conducting model evaluation, it is necessary to specify the model weight file path. Each configuration file has a built-in default path for saving weights. If you need to change this path, you can simply append a command line argument to set it, for example: -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

  • After the model evaluation is completed, typically, the following outputs are generated:

  • Upon finishing the model evaluation, an evaluate_result.json file is produced, which records the results of the evaluation. Specifically, it logs whether the evaluation task was successfully completed and the evaluation metrics of the model, including Top1 Accuracy (Top1 Acc).

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"img_rot180_demo.jpg\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

1.Pipeline Integration

The document image classification module can be integrated into PaddleX pipelines such as the Document Scene Information Extraction Pipeline (PP-ChatOCRv3). Simply replace the model path to update the The document image classification module's model.

2.Module Integration

The weights you produce can be directly integrated into the document image orientation classification module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html","title":"Formula Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#i-overview","title":"I. Overview","text":"

The formula recognition module is a crucial component of OCR (Optical Character Recognition) systems, responsible for converting mathematical formulas in images into editable text or computer-readable formats. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The module typically outputs LaTeX or MathML codes of mathematical formulas, which are then passed on to the text understanding module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Normed Edit Distance BLEU Score ExpRate (%) Model Size (M) Description LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 89.7 M LaTeX-OCR is a formula recognition algorithm based on an autoregressive large model. By adopting Hybrid ViT as the backbone network and transformer as the decoder, it significantly improves the accuracy of formula recognition.

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, a few lines of code can complete the inference of the formula recognition module. You can switch models under this module freely, and you can also integrate the model inference of the formula recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"LaTeX_OCR_rec\")\noutput = model.predict(\"general_formula_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better formula recognition models. Before developing formula recognition models with PaddleX, ensure you have installed the PaddleOCR-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the LaTeX-OCR Formula Recognition Project.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_latexocr_dataset_example.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_latexocr_dataset_example.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 9452,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0109284.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0217434.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0166758.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0022294.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0071799.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0017043.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0026204.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0209202.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0157332.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0232582.png\"\n    ],\n    \"val_samples\": 1050,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0070221.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0157901.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0085392.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0196480.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0096180.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0136149.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0143310.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0004560.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0115191.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0015323.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_latexocr_dataset_example\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"LaTeXOCRDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 9452; * attributes.val_samples: The number of validation samples in this dataset is 1050; * attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset; * attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format ( PKL format ). The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format, default is True;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is MSTextRecDataset;

For example, if you want to convert a MSTextRecDataset format dataset to LaTeXOCRDataset format, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: MSTextRecDataset\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=MSTextRecDataset\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, dataset splitting is performed, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, which is an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% for the training set and 10% for the validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the formula recognition model LaTeX_OCR_rec as an example:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_formula_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the formula recognition module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html","title":"Layout Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#i-overview","title":"I. Overview","text":"

The core task of structure analysis is to parse and segment the content of input document images. By identifying different elements in the image (such as text, charts, images, etc.), they are classified into predefined categories (e.g., pure text area, title area, table area, image area, list area, etc.), and the position and size of these regions in the document are determined.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the structure analysis module. You can switch models under this module freely, and you can also integrate the model inference of the structure analysis module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet-L_layout_3cls\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"layout.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better structure analysis models. Before developing a structure analysis model with PaddleX, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_layout_examples.tar -P ./dataset\ntar -xf ./dataset/det_layout_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 11,\n    \"train_samples\": 90,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/train_0077.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0028.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0012.jpg\"\n    ],\n    \"val_samples\": 20,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/val_0007.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0019.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0010.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/det_layout_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 11;
  • attributes.train_samples: The number of training samples in this dataset is 90;
  • attributes.val_samples: The number of validation samples in this dataset is 20;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Layout detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet-L_layout_3cls as an example:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet-L_layout_3cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet-L_layout_3cls.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"layout.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet-L_layout_3cls.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own project. To integrate, simply add the model_dir=\"/output/best_model/inference\" parameter to the create_model(model_name=model_name, kernel_option=kernel_option) function in the quick integration method from Step 3.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into PaddleX pipelines or into your own projects.

  1. Pipeline Integration The structure analysis module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the layout area localization module. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  2. Module Integration The weights you produce can be directly integrated into the layout area localization module. You can refer to the Python example code in the Quick Integration section, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html","title":"Seal Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#i-overview","title":"I. Overview","text":"

The seal text detection module typically outputs multi-point bounding boxes around text regions, which are then passed as inputs to the distortion correction and text recognition modules for subsequent processing to identify the textual content of the seal. Recognizing seal text is an integral part of document processing and finds applications in various scenarios such as contract comparison, inventory access auditing, and invoice reimbursement verification. The seal text detection module serves as a subtask within OCR (Optical Character Recognition), responsible for locating and marking the regions containing seal text within an image. The performance of this module directly impacts the accuracy and efficiency of the entire seal text OCR system.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Hmean\uff08%\uff09 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 M The server-side seal text detection model of PP-OCRv4 boasts higher accuracy and is suitable for deployment on better-equipped servers. PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 M The mobile-side seal text detection model of PP-OCRv4, on the other hand, offers greater efficiency and is suitable for deployment on end devices.

Note: The evaluation set for the above accuracy metrics is a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Seal Text Detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Seal Text Detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_server_seal_det\")\noutput = model.predict(\"seal_text_det.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Seal Text Detection models. Before developing a Seal Text Detection model with PaddleX, ensure you have installed PaddleOCR plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Text Detection and Recognition Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_curve_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_curve_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 606,\n    \"train_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07834.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09943.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04079.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05701.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08324.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07451.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09562.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08237.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug01788.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06481.png\"\n    ],\n    \"val_samples\": 152,\n    \"val_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03724.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06456.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04029.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03603.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05454.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06269.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00624.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug02818.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00538.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04935.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/ocr_curve_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 606;
  • attributes.val_samples: The number of validation samples in this dataset is 152;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Seal text detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Seal Text Detection model (PP-OCRv4_server_seal_det) as an example:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including precision, recall and Hmean.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"seal_text_det.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_server_seal_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document Seal Text Detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text detection module of the relevant pipeline.

  1. Module Integration

The weights you produce can be directly integrated into the Seal Text Detection module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html","title":"Table Structure Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#i-overview","title":"I. Overview","text":"

Table structure recognition is a crucial component in table recognition systems, converting non-editable table images into editable table formats (e.g., HTML). The goal of table structure recognition is to identify the rows, columns, and cell positions of tables. The performance of this module directly impacts the accuracy and efficiency of the entire table recognition system. The module typically outputs HTML or LaTeX code for the table area, which is then passed to the table content recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddlePaddle Vision Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddlePaddle's Vision Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the table structure recognition module. You can easily switch models within this module and integrate the model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"SLANet\")\noutput = model.predict(\"table_recognition.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better table structure recognition models. Before developing table structure recognition models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Table Structure Recognition Task Module Data Annotation Tutorial

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/table_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/table_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 2000,\n    \"train_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_right_7384_X9UFEPKVMLALY7DDB11A.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_13708_VE2DGBD4DCQU2ITLBTEA.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_6490_14Z6ZN6G52GG4XA0K4XU.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_14236_DG96EX0EDKIIDK8P6ENG.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_19648_SV8B7X34RTYRAT2T5CPI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_7186_HODBC25HISMCSVKY0HJ9.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_5773_4K4H9OVK9X9YVHE4Y1BQ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_7760_8C62CCH5T57QUGE0NTHZ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_15707_B1YVOU3X4NHHB6TL269O.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_5223_HLG406UK35UD5EUYC2AV.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_2945_L7MSRHBZRW6Y347G39O6.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_4825_LH9WI6X104CP3VFXPSON.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_16837_79KHWU9WDM9ZQHNBGQAL.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_10107_9ENLLC29SQ6XI8WZY53E.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_16668_JIS0YFDZKTKETZIEKCKX.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_18653_J9SSKHLFTRJD4J8W17OW.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_8396_VJ3QJ3I0DP63P4JR77FE.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_9017_K2V7QBWSU2BA4R3AJSO7.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_19494_SDFMWP92NOB2OT7109FI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_288_6LK683JUCMOQ38V5BV29.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/table_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"PubTabTableRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 2000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 100;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Table structure recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the table structure recognition model SLANet as an example:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is SLANet.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc ;

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/table_recognition/SLANet.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"table_recognition.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The table structure recognition module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the table structure recognition module in the relevant pipelines. For pipeline integration, you can deploy your obtained model using high-performance inference and service-oriented deployment.

2.Module Integration

The model weights you produce can be directly integrated into the table structure recognition module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html","title":"Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#i-overview","title":"I. Overview","text":"

The text detection module is a crucial component in OCR (Optical Character Recognition) systems, responsible for locating and marking regions containing text within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text detection module typically outputs bounding boxes for text regions, which are then passed on to the text recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#ii-supported-models","title":"II. Supported Models","text":"ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

Just a few lines of code can complete the inference of the text detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_det\")\noutput = model.predict(\"general_ocr_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek even higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better text detection models. Before developing text detection models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After executing the above command, PaddleX will validate the dataset and gather basic information about it. Once the command runs successfully, Check dataset passed ! will be printed in the log. The validation result file is saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory in the current directory. The output directory includes sample images and histograms of sample distribution.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 200,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/train_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/train_img_289.jpg\"\n    ],\n    \"val_samples\": 50,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/val_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/val_img_137.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. The explanation of other metrics is as follows:

  • attributes.train_samples: The number of training samples in the dataset is 200;
  • attributes.val_samples: The number of validation samples in the dataset is 50;
  • attributes.train_sample_paths: List of relative paths for visualizing training sample images in the dataset;
  • attributes.val_sample_paths: List of relative paths for visualizing validation sample images in the dataset;

Additionally, the dataset validation also analyzed the distribution of the length and width of all images in the dataset and plotted a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Text detection does not support data format conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Below are some example explanations for the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text detection model (PP-OCRv4_mobile_det):

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (in this case, PP-OCRv4_mobile_det.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Instructions.

\ud83d\udc49 More Instructions (Click to Expand)

During model evaluation, you need to specify the path to the model weight file. Each configuration file has a built-in default weight save path. If you need to change it, you can set it by adding a command line argument, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including precision, recall, and hmean.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_mobile_det.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline, Table Recognition Pipeline, and PP-ChatOCRv3-doc. Simply replace the model path to update the text detection module of the relevant pipeline.

2.Module Integration

The model weights you produce can be directly integrated into the text detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html","title":"Text Image Unwarping Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#i-overview","title":"I. Overview","text":"

The primary purpose of Text Image Unwarping is to perform geometric transformations on images in order to correct issues such as document distortion, tilt, perspective deformation, etc., enabling more accurate recognition by subsequent text recognition modules.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link MS-SSIM \uff08%\uff09 Model Size (M) information UVDocInference Model/Trained Model 54.40 30.3 M High-precision Text Image Unwarping Model

The accuracy metrics of the above models are measured on the DocUNet benchmark dataset.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Text Image Unwarping module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Text Image Unwarping module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"UVDoc\")\noutput = model.predict(\"doc_test.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iv-custom-development","title":"IV. Custom Development","text":"

The current module temporarily does not support fine-tuning training and only supports inference integration. Fine-tuning training for this module is planned to be supported in the future.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html","title":"Text Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#i-overview","title":"I. Overview","text":"

The text recognition module is the core component of an OCR (Optical Character Recognition) system, responsible for extracting text information from text regions within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text recognition module typically receives bounding boxes of text regions output by the text detection module as input. Through complex image processing and deep learning algorithms, it converts the text in images into editable and searchable electronic text. The accuracy of text recognition results is crucial for subsequent applications such as information extraction and data mining.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 4 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the text recognition module. You can switch models under this module freely, and you can also integrate the model inference of the text recognition module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_rec\")\noutput = model.predict(\"general_ocr_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better text recognition models. Before using PaddleX to develop text recognition models, please ensure that you have installed the relevant model training plugins for OCR in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX offers Demo datasets for each module, allowing you to complete subsequent development based on the officially provided Demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can use the following commands to download the Demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 4468,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_10.png\"\n    ],\n    \"val_samples\": 2077,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_10.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 4468;
  • attributes.val_samples: The number of validation set samples in this dataset is 2077;
  • attributes.train_sample_paths: A list of relative paths to the visualized training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation set samples in this dataset; Additionally, the dataset validation also analyzes the distribution of character length ratios in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Text recognition does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and it must sum up to 100 with val_percent; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n

After data splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text recognition model (PP-OCRv4_mobile_rec):

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

```bash\npython main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Information (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc\u3001norm_edit_dis\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text recognition module can be integrated into PaddleX pipelines such as the General OCR Pipeline, General Table Recognition Pipeline, and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text recognition module of the relevant pipeline.

2.Module Integration

The weights you produce can be directly integrated into the text recognition module. Refer to the Quick Integration Python example code. Simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#i-overview","title":"I. Overview","text":"

Time series anomaly detection focuses on identifying abnormal points or periods in time series data that do not conform to expected patterns, trends, or periodic regularities. These anomalies can be caused by system failures, external shocks, data entry errors, or rare events, and are of great significance for timely response, risk assessment, and business decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Precision Recall F1-Score Model Size (M) Description AutoEncoder_ad_adInference Model/Trained Model 0.9898 0.9396 0.9641 72.8K AutoEncoder_ad_ad is a simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_adInference Model/Trained Model 0.9855 0.8895 0.9351 1.5MB Based on the transformer structure, optimized for anomaly detection in non-stationary time series AutoEncoder_adInference Model/Trained Model 0.9936 0.8436 0.9125 32K AutoEncoder_ad is a classic autoencoder-based, efficient, and easy-to-use time series anomaly detection model PatchTST_adInference Model/Trained Model 0.9878 0.9070 0.9457 164K PatchTST is a high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_adInference Model/Trained Model 0.9837 0.9480 0.9656 732K Through multi-period analysis, TimesNet is an adaptive and high-precision time series anomaly detection model

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the time series anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the time series anomaly detection module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"AutoEncoder_ad\")\noutput = model.predict(\"ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better time series anomaly detection models. Before developing time series anomaly models with PaddleX, please ensure that the PaddleTS plugin is installed. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to the PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_anomaly_examples.tar -P ./dataset\ntar -xf ./dataset/ts_anomaly_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22032,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        0.0,\n        0.7326893750079723,\n        \"...\",\n        0.1382488479262673,\n        0.0\n      ]\n    ],\n    \"val_samples\": 198290,\n    \"val_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        22032.0,\n        0.8604795809835284,\n        \"...\",\n        0.1428571428571428,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_anomaly_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 22032;
  • attributes.val_samples: The number of validation samples in this dataset is 198290;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset. Note: Only data that has passed validation can be used for training and evaluation.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time series anomaly detection supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, supporting xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, time series anomaly detection only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (AutoEncoder_ad) as an example:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's AutoEncoder_ad.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, the following outputs are typically generated:

Upon completion of model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically indicating whether the evaluation task was completed successfully and the model's evaluation metrics, including f1, recall, and precision.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions through the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_ad.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Anomaly Detection. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series anomaly detection module. Refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html","title":"Time Series Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#i-overview","title":"I. Overview","text":"

Time series classification involves identifying and categorizing different patterns in time series data by analyzing trends, periodicity, seasonality, and other factors that vary over time. This technique is widely used in medical diagnosis and other fields, effectively classifying key information in time series data to provide robust support for decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Acc(%) Model Size (M) Description TimesNet_clsInference Model/Trained Model 87.5 792K TimesNet is an adaptive and high-accuracy time series classification model through multi-period analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform inference for the time series classification module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the time series classification module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better time series classification models. Before using PaddleX to develop time series classification models, ensure you have installed the PaddleTS plugin. Refer to the PaddleX Local Installation Guide for the installation process.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to PaddleX Time Series Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.000949,\n        ...,\n        0.12107,\n        1.0,\n        0.0\n      ]\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.004578,\n        ...,\n        0.15728,\n        1.0,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;

Furthermore, the dataset validation also involved an analysis of the distribution of sample numbers across all categories within the dataset, and a distribution histogram (histogram.png) was generated accordingly.

Note: Only data that has passed validation can be used for training and evaluation.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time-series classification supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, supporting conversion from xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, True to enable, default is False;
  • src_dataset_type: If dataset format conversion is performed, time-series classification only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (TimesNet_cls) as an example:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's TimesNet_cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other relevant parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, an evaluate_result.json file is produced, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including Top-1 Accuracy and F1 score.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_cls.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml - Note: This should likely be TimesNet_cls.yaml for consistency)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other relevant parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipeline or directly into your own projects.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Classification. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series classification module. Refer to the Python example code in Quick Integration (Note: This section header is in Chinese and should be translated or removed for consistency), simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html","title":"Time Series Forecasting Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#i-overview","title":"I. Overview","text":"

Time series forecasting aims to predict the possible values or states at a future point in time or within a future time period by analyzing patterns, trends, periodicity, and other characteristics in historical data. This helps enterprises and organizations make more accurate decisions, optimize resource allocation, reduce risks, and seize potential market opportunities. These time series data typically originate from various sensors, economic activities, social behaviors, and other real-world application scenarios. For example, stock prices, temperature changes, website traffic, sales data, and the like are all typical examples of time series data.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mse mae Model Size (M) Introduce DLinearInference Model/Trained Model 0.382 0.394 76k Simple structure, high efficiency and easy-to-use time series prediction model NonstationaryInference Model/Trained Model 0.600 0.515 60.3M Based on the transformer structure, targeted optimization of long-term time series prediction models for non-stationary time series PatchTSTInference Model/Trained Model 0.385 0.397 2.2M High-precision long-term time series prediction model that takes into account both local patterns and global dependencies TiDEInference Model/Trained Model 0.405 0.412 34.9M High-precision model suitable for handling multivariate, long-term time series prediction problems TimesNetInference Model/Trained Model 0.417 0.431 5.2M Through multi-period analysis, TimesNet is a highly adaptable high-precision time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset, with an input sequence length of 96, and a prediction sequence length of 96 for all models except TiDE, which has a prediction sequence length of 720.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Time Series Forecasting module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Time Series Forecasting module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Time Series Forecasting models. Before developing a Time Series Forecasting model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Time Series Forecasting Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ts_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 12194,\n    \"train_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2016-07-01 00:00:00\",\n        5.827000141143799,\n        2.009000062942505,\n        1.5989999771118164,\n        0.4620000123977661,\n        4.203000068664552,\n        1.3400000333786009,\n        30.5310001373291\n      ],\n      [\n        \"2016-07-01 01:00:00\",\n        5.692999839782715,\n        2.075999975204468,\n        1.4919999837875366,\n        0.4259999990463257,\n        4.142000198364259,\n        1.371000051498413,\n        27.78700065612793\n      ]\n    ],\n    \"val_samples\": 3484,\n    \"val_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2017-11-21 02:00:00\",\n        12.994000434875488,\n        4.889999866485597,\n        10.055999755859377,\n        2.878000020980835,\n        2.559000015258789,\n        1.2489999532699585,\n        4.7129998207092285\n      ],\n      [\n        \"2017-11-21 03:00:00\",\n        11.92199993133545,\n        4.554999828338623,\n        9.097000122070312,\n        3.0920000076293945,\n        2.559000015258789,\n        1.2790000438690186,\n        4.8540000915527335\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_dataset_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Time Series Forecasting supports converting xlsx and xls format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting xlsx and xls format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null.

Modify the paddlex/configs/ts_forecast/DLinear.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (DLinear) as an example:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mse and mae.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_fc.csv\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's DLinear.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The Time Series Forecasting module can be integrated into PaddleX pipelines such as the Time Series Forecasting Pipeline (ts_fc). Simply replace the model path to update the Time Series Forecasting module's model.

  1. Module Integration

The weights you produce can be directly integrated into the Time Series Forecasting module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/other_devices_support/how_to_contribute_device.html","title":"1. More Device Support","text":"

The prosperity of the PaddlePaddle ecosystem is inseparable from the contributions of developers and users. We warmly welcome you to provide more device compatibility for PaddleX and greatly appreciate your feedback.

Currently, PaddleX supports Intel/Apple M series CPU, NVIDIA GPUs, XPU, Ascend NPU, Hygon DCU, and MLU. If the device you wish to support is not within the current scope, you can contribute by following the methods below.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#11-integration-device-into-paddlepaddle-backend","title":"1.1 Integration Device into PaddlePaddle Backend","text":"

The PaddlePaddle deep learning framework provides multiple integration solutions, including operator development and mapping, subgraph and whole graph integration, deep learning compiler backend integration, and open neural network format conversion. Device vendors can flexibly choose based on their chip architecture design and software stack maturity. For specific details, please refer to PaddlePaddle Custom Device Integration Solutions.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#12-support-for-paddlecv-devkits","title":"1.2 Support for PaddleCV devkits","text":"

Since PaddleX is based on the PaddlePaddle model library, after the device completes the integration into the PaddlePaddle backend, select the corresponding devkit to submit code based on the models already supported by the device to ensure that the relevant devkits are adapted to the corresponding device. Refer to the contribution guides for each devkit:

  1. PaddleClas

  2. PaddleDetection

  3. PaddleSeg

  4. PaddleOCR

  5. PaddleTS

"},{"location":"en/other_devices_support/how_to_contribute_device.html#2-updating-paddlex","title":"2. Updating PaddleX","text":"

After completing the device integration into PaddlePaddle and the PaddleCV devkits, you need to update the device recognition-related code and documentation in PaddleX.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#21-inference-support","title":"2.1 Inference Support","text":""},{"location":"en/other_devices_support/how_to_contribute_device.html#211-version-support-optional","title":"2.1.1 Version Support (Optional)","text":"

If the relevant device has specific requirements for the PaddlePaddle version, you can make judgments based on device information and version information during initialization. The relevant code is located in the _check_paddle_version function in PaddleX Initialization.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#212-setting-environment-variables-optional","title":"2.1.2 Setting Environment Variables (Optional)","text":"

If special environment variables need to be set when using the relevant device, you can modify the device environment setup code. The relevant code is located in the set_env_for_device function in PaddleX Environment Variable Settings.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#213-creating-a-predictor","title":"2.1.3 Creating a Predictor","text":"

PaddleX's inference capability is provided based on the Paddle Inference Predictor. When creating a Predictor, you need to select different device based on device information and create passes. The relevant code is located in the _create function in PaddleX Predictor Creation.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#214-updating-the-device-support-list","title":"2.1.4 Updating the Device Support List","text":"

When creating a Predictor, it will judge whether the device is already supported. The relevant code is located in the SUPPORT_DEVICE constant in PaddleX Predictor Option.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#215-updating-the-multi-devices-user-guide","title":"2.1.5 Updating the Multi-Devices User Guide","text":"

Please update the PaddleX multi-devices user guide and add the newly supported device information to the documentation. Both Chinese and English versions need to be updated. The Chinese version is PaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b, and the English version is PaddleX Multi-Devices Usage Guide.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#216-updating-the-installation-tutorial","title":"2.1.6 Updating the Installation Tutorial","text":"

Please provide device-related installation tutorials in both Chinese and English. The Chinese version can refer to \u200b\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b, and the English version can refer to Ascend NPU PaddlePaddle Installation Tutorial.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#217-updating-the-model-list","title":"2.1.7 Updating the Model List","text":"

Please provide a list of models supported by the device in both Chinese and English. The Chinese version can refer to PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6607\u200b\u817e\u200b NPU\uff09, and the English version can refer to PaddleX Model List (Huawei Ascend NPU).

"},{"location":"en/other_devices_support/how_to_contribute_device.html#22-training-support","title":"2.2 Training Support","text":"

TODO

"},{"location":"en/other_devices_support/how_to_contribute_device.html#3-submitting-a-pr","title":"3. Submitting a PR","text":"

When you complete the device adaptation work, please submit a Pull Request to PaddleX with relevant information. We will validate the model and merge the relevant code after confirmation.

The relevant PR needs to provide information on reproducing model accuracy, including at least the following:

  • The software versions used to validate model accuracy, including but not limited to:

  • Paddle version

  • PaddleCustomDevice version (if any)

  • The branch of PaddleX or the corresponding devkit

  • The machine environment used to validate model accuracy, including but not limited to:

  • Chip model

  • Operating system version

  • Device driver version

  • Operator library version, etc.

"},{"location":"en/other_devices_support/how_to_contribute_model.html","title":"1. Contributing Models","text":"

The prosperity of the PaddlePaddle ecosystem is inseparable from the contributions of developers and users. We warmly welcome you to contribute more models for multi-hardware compatibility to PaddlePaddle and greatly appreciate your feedback.

The current list of hardware-compatible models in PaddleX is as follows. You can check whether the relevant models have been adapted for the corresponding hardware:

  • NPU Model List

  • XPU Model List

  • DCU Model List

  • MLU Model List

The source code for current PaddleX-related models is placed in various kits, and some kits and models have not been integrated into PaddleX. Therefore, before adapting a model, please ensure that your model is already integrated into PaddleX. For the current list of PaddleX models, see PaddleX Model Library. If you have specific model requirements, please submit an issue to inform us.

If the model you are adapting involves modifications to the model networking code on the relevant hardware, please submit the code to the corresponding kit first, referring to the contribution guides for each kit:

  1. PaddleClas

  2. PaddleDetection

  3. PaddleSeg

  4. PaddleOCR

  5. PaddleTS

"},{"location":"en/other_devices_support/how_to_contribute_model.html#2-submitting-an-issue-for-explanation","title":"2. Submitting an Issue for Explanation","text":"

When you have completed the adaptation of a model on a specific hardware, please submit an issue to PaddleX explaining the relevant information. We will verify the model and, upon confirmation of no issues, merge the relevant code and update the model list in the documentation.

The relevant issue needs to provide information to reproduce the model's accuracy, including at least the following:

  • The software versions used to verify the model's accuracy, including but not limited to:

  • Paddle version

  • PaddleCustomDevice version (if applicable)

  • Branch of PaddleX or the corresponding kit

  • The machine environment used to verify the model's accuracy, including but not limited to:

  • Chip model

  • Operating system version

  • Hardware driver version

  • Operator library version, etc.

"},{"location":"en/other_devices_support/how_to_contribute_model.html#3-more-documentation","title":"3. More Documentation","text":"

For more documentation related to multi-hardware compatibility and usage in PaddlePaddle, please refer to:

  • PaddlePaddle User Guide

  • PaddlePaddle Hardware Support

  • PaddleX Multi-device Usage Guide

  • PaddleCustomDevice Repository

"},{"location":"en/other_devices_support/multi_devices_use_guide.html","title":"PaddleX Multi-Devices Usage Guide","text":"

This document focuses on the usage guide of PaddleX for Huawei Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU hardware platforms.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#1-installation","title":"1. Installation","text":""},{"location":"en/other_devices_support/multi_devices_use_guide.html#11-paddlepaddle-installation","title":"1.1 PaddlePaddle Installation","text":"

First, please complete the installation of PaddlePaddle according to your hardware platform. The installation tutorials for each hardware are as follows:

Ascend NPU: Ascend NPU PaddlePaddle Installation Guide

Cambricon MLU: Cambricon MLU PaddlePaddle Installation Guide

Kunlun XPU: Kunlun XPU PaddlePaddle Installation Guide

Hygon DCU: Hygon DCU PaddlePaddle Installation Guide

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#12-paddlex-installation","title":"1.2 PaddleX Installation","text":"

Welcome to use PaddlePaddle's low-code development tool, PaddleX. Before we officially start the local installation, please clarify your development needs and choose the appropriate installation mode based on your requirements.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. The following details the application scenarios and installation methods for these two modes.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#121-wheel-package-installation-mode","title":"1.2.1 Wheel Package Installation Mode","text":"

If your application scenario for PaddleX is model inference and integration, we recommend using the more convenient and lightweight Wheel Package Installation Mode.

After installing PaddlePaddle, you can directly execute the following commands to quickly install the PaddleX Wheel package:

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b1-py3-none-any.whl\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#122-plugin-installation-mode","title":"1.2.2 Plugin Installation Mode","text":"

If your application scenario for PaddleX is secondary development, we recommend using the more powerful Plugin Installation Mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration on the models supported by the plugins but also conduct more advanced operations such as model training for secondary development.

The plugins supported by PaddleX are as follows. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR General Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection Document Scene Information Extraction v3 Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionDocument Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Prediction Time Series Prediction Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS General Multi-label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin(s) you need to install is/are PaddleXXX (can be multiple), after installing PaddlePaddle, you can directly execute the following commands to quickly install the corresponding PaddleX plugin(s):

# obtain PaddleX source code\ngit clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX Plugins\npaddlex --install PaddleXXX\n
For example, if you need to install the PaddleOCR and PaddleClas plugins, you can execute the following command:

# Install PaddleOCR and PaddleClas Plugins\npaddlex --install PaddleOCR PaddleClas\n

If you wish to install all plugins, you do not need to specify the plugin names. Simply execute the following command:

# Install All PaddleX Plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com. You can specify the clone source using --platform.

For instance, if you want to install all PaddleX plugins using the gitee.com clone source, execute the following command:

# Install PaddleX Plugins using gitee.com\npaddlex --install --platform gitee.com\n

Upon successful installation, you will see the following prompt:

All packages are installed.\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#2-usage","title":"2. Usage","text":"

The usage of PaddleX model pipeline development tool on hardware platforms such as Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU is identical to that on GPU. You only need to modify the device configuration parameters according to your hardware platform. For detailed usage tutorials, please refer to PaddleX Pipeline Development Tool Local Usage Guide.

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html","title":"Hygon DCU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Haiguang Z100 series chips. Considering environmental differences, we recommend using the officially released Haiguang DCU development image by PaddlePaddle, which is pre-installed with the Haiguang DCU basic runtime library (DTK).

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. Note that this image is only for development environments and does not include pre-compiled PaddlePaddle installation packages.

docker pull registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-dcu-dev -v `pwd`:/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#2-install-paddlepaddle-package","title":"2. Install PaddlePaddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle's official website. Note: The DCU version of PaddlePaddle framework only supports Hygon C86 architecture.

# Download and install the wheel package\npip install paddlepaddle-rocm -i https://www.paddlepaddle.org.cn/packages/nightly/dcu\n

After the installation package is installed, run the following command to verify it:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is as follows:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html","title":"Cambricon MLU Installation Tutorial for PaddlePaddle","text":"

Currently, PaddleX supports the Cambricon MLU370X8 chip. Considering environmental differences, we recommend using the Cambricon MLU development image provided by PaddlePaddle to prepare your environment.

"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is for development only and does not include a pre-compiled PaddlePaddle installation package.

# Applicable to X86 architecture, Arch64 architecture image is not provided for now\ndocker pull registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-mlu-dev -v $(pwd):/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v /usr/bin/cnmon:/usr/bin/cnmon \\\n  registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle. Currently, Python 3.10 wheel packages are provided. If you require other Python versions, refer to the PaddlePaddle official documentation for compilation and installation instructions.

# Download and install the wheel package\n# Note: You need to install the CPU version of PaddlePaddle first\npython -m pip install paddlepaddle==3.0.0.dev20240624 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython -m pip install paddle-custom-mlu==3.0.0.dev20240806 -i https://www.paddlepaddle.org.cn/packages/nightly/mlu/\n

Verify the installation. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 mlu.\nPaddlePaddle works well on 16 mlus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html","title":"Ascend NPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports the Ascend 910B chip (more models are under support. If you have a related need for other models, please submit an issue to inform us). The Ascend driver version is 23.0.3. Considering the differences in environments, we recommend using the Ascend development image provided by PaddlePaddle to complete the environment preparation.

"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"
  • Pull the image. This image is only for the development environment and does not contain a pre-compiled PaddlePaddle installation package. The image has CANN-8.0.T13, the Ascend operator library, installed by default.
    # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-x86_64-gcc84-py39\n# For Aarch64 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-aarch64-gcc84-py39\n
  • Start the container with the following command. ASCEND_RT_VISIBLE_DEVICES specifies the visible NPU card numbers.
    docker run -it --name paddle-npu-dev -v $(pwd):/work \\\n    --privileged --network=host --shm-size=128G -w=/work \\\n    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \\\n    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\\n    -v /usr/local/dcmi:/usr/local/dcmi \\\n    -e ASCEND_RT_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" \\\n    registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-$(uname -m)-gcc84-py39 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python 3.9 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

  • Download and install the Python 3.9 wheel installation package
    # Note: You need to install the CPU version of PaddlePaddle first\npython3.9 -m pip install paddlepaddle==3.0.0.dev20240520 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython3.9 -m pip install paddle_custom_npu==3.0.0.dev20240719 -i https://www.paddlepaddle.org.cn/packages/nightly/npu/\n
  • After verifying that the installation package is installed, run the following command
    python -c \"import paddle; paddle.utils.run_check()\"\n
    The expected output is as follows
Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 npu.\nPaddlePaddle works well on 8 npus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html","title":"Kunlun XPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Kunlun R200/R300 and other chips. Considering environmental differences, we recommend using the Kunlun XPU development image officially released by PaddlePaddle, which is pre-installed with the Kunlun basic runtime environment library (XRE).

"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is only for the development environment and does not include a pre-compiled PaddlePaddle installation package.

docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # For ARM architecture\n
Refer to the following command to start the container:

docker run -it --name=xxx -m 81920M --memory-swap=81920M \\\n    --shm-size=128G --privileged --net=host \\\n    -v $(pwd):/workspace -w /workspace \\\n    registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python3.10 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

Install the Python3.10 wheel installation package:

pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # For X86 architecture\npip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # For ARM architecture\n

Verify the installation package. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/pipeline_deploy/edge_deploy.html","title":"PaddleX Edge Deployment Demo Usage Guide","text":"
  • PaddleX Edge Deployment Demo Usage Guide
  • Installation Process and Usage
    • Environment Preparation
    • Material Preparation
    • Deployment Steps
  • Reference Materials
  • Feedback Section

This guide mainly introduces the operation method of the PaddleX edge deployment demo on the Android shell. This guide applies to 8 models across 6 modules:

Module Specific Model CPU GPU Object Detection PicoDet-S \u2705 \u2705 PicoDet-L \u2705 \u2705 Layout Area Detection PicoDet_layout_1x \u2705 \u2705 Semantic Segmentation PP-LiteSeg-T \u2705 \u2705 Image Classification PP-LCNet_x1_0 \u2705 \u2705 MobileNetV3_small_x1_0 \u2705 \u2705 Text Detection PP-OCRv4_mobile_det \u2705 Text Recognition PP-OCRv4_mobile_rec \u2705

Note - GPU refers to mapping computations to GPU execution using OpenCL to fully utilize GPU hardware computing power and improve inference performance.

"},{"location":"en/pipeline_deploy/edge_deploy.html#installation-process-and-usage","title":"Installation Process and Usage","text":""},{"location":"en/pipeline_deploy/edge_deploy.html#environment-preparation","title":"Environment Preparation","text":"
  1. Install CMake build tool locally and download the required version of NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK official website.

    Environment Requirements - CMake >= 3.10 (Minimum version not verified, recommend 3.20 and above) - Android NDK >= r17c (Minimum version not verified, recommend r20b and above)

    Tested Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Locate Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install ADB tool on your computer for debugging. ADB installation methods:

    3.1. For Mac:

    brew cask install android-platform-tools\n

    3.2. For Linux:

    # Debian-based Linux distributions\nsudo apt update\nsudo apt install -y wget adb\n\n# Red Hat-based Linux distributions\nsudo yum install adb\n

    3.3. For Windows:

    Install ADB by downloading the ADB software package from Google's Android platform: Link

    Open a terminal, connect your phone to the computer, and enter in the terminal:

     adb devices\n

    If there is an output from the device, it indicates that the installation was successful.

     List of devices attached\n 744be294    device\n
"},{"location":"en/pipeline_deploy/edge_deploy.html#material-preparation","title":"Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified unzip directory, switch to the specified unzip directory, and execute the unzip command.

    • Object Detection Survey
    • Semantic Segmentation Survey
    • Image Classification Survey
    • OCR Survey

    Below is an example of the unzip operation for object_detection. Refer to the table below for other pipelines.

    # 1. Switch to the specified unzip directory\ncd PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection\n\n# 2. Execute the unzip command\nunzip object_detection.zip\n

    Pipeline Name Unzip Directory Unzip Command Object Detection PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection unzip object_detection.zip Semantic Segmentation PaddleX-Lite-Deploy/semantic_segmentation/android/shell/cxx/semantic_segmentation unzip semantic_segmentation.zip Image Classification PaddleX-Lite-Deploy/image_classification/android/shell/cxx/image_classification unzip image_classification.zip OCR PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo unzip ocr.zip

"},{"location":"en/pipeline_deploy/edge_deploy.html#deployment-steps","title":"Deployment Steps","text":"
  1. Switch the working directory to PaddleX_Lite_Deploy/libs and run the download.sh script to download the necessary Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/assets, run the download.sh script to download the paddle_lite_opt tool optimized model, test images, label files, etc.

  3. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the build.sh script to complete the compilation and execution of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the run.sh script to complete the prediction on the edge.

    Note: - {Pipeline_Name} and {Demo_Name} are placeholders. Refer to the table at the end of this section for specific values. - download.sh and run.sh support passing in model names to specify models. If not specified, the default model will be used. Refer to the Model_Name column in the table at the end of this section for currently supported models. - To use your own trained model, refer to the Model Conversion Method to obtain the .nb model, place it in the PaddleX_Lite_Deploy/{Pipeline_Name}/assets/{Model_Name} directory, where {Model_Name} is the model name, e.g., PaddleX_Lite_Deploy/object_detection/assets/PicoDet-L. - Before running the build.sh script, change the path specified by NDK_ROOT to the actual installed NDK path. - Keep ADB connected when running the build.sh script. - On Windows systems, you can use Git Bash to execute the deployment steps. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME to windows in CMakeLists.txt. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME to darwin in CMakeLists.txt.

Below is an example for object_detection. For other demos, change the directories switched in steps 2 and 3 according to the table at the end of this section.

# 1. Download the necessary Paddle Lite prediction library\ncd PaddleX_Lite_Deploy/libs\nsh download.sh\n\n# 2. Download the paddle_lite_opt tool optimized model, test images, and label files\ncd ../object_detection/assets\nsh download.sh\n# Supports passing in model names to specify the downloaded model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh download.sh PicoDet-L\n\n# 3. Complete the compilation of the executable file\ncd ../android/app/shell/cxx/picodet_detection\nsh build.sh\n\n# 4. Prediction\nsh run.sh\n# Supports passing in model names to specify the prediction model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh run.sh PicoDet-L\n

The run results are shown below, and a result image named dog_picodet_detection_result.jpg is generated:

======= benchmark summary =======\ninput_shape(s) (NCHW): {1, 3, 320, 320}\nmodel_dir:./models/PicoDet-S/model.nb\nwarmup:1\nrepeats:10\npower_mode:1\nthread_num:0\n<b>* time info(ms) </b>*\n1st_duration:320.086\nmax_duration:277.331\nmin_duration:272.67\navg_duration:274.91\n\n====== output summary ======\ndetection, image size: 768, 576, detect object: bicycle, score: 0.905929, location: x=125, y=1\n

This section describes the deployment steps applicable to the demos listed in the following table:

Pipeline Pipeline_Name Module Demo_Name Specific Model Model_Name General Object Detection object_detection Object Detection picodet_detection PicoDet-S PicoDet-S\uff08default\uff09PicoDet-S_gpu PicoDet-L PicoDet-LPicoDet-L_gpu PicoDet_layout_1x PicoDet_layout_1xPicoDet_layout_1x_gpu General Semantic Segmentation semantic_segmentation Semantic Segmentation semantic_segmentation PP-LiteSeg-T PP-LiteSeg-T\uff08default\uff09PP-LiteSeg-T_gpu General Image Classification image_classification Image Classification image_classification PP-LCNet_x1_0 PP-LCNet_x1_0\uff08default\uff09PP-LCNet_x1_0_gpu MobileNetV3_small_x1_0 MobileNetV3_small_x1_0MobileNetV3_small_x1_0_gpu General OCR ocr Text Detection ppocr_demo PP-OCRv4_mobile_det PP-OCRv4_mobile_det Text Recognition PP-OCRv4_mobile_rec PP-OCRv4_mobile_rec

Note - Currently, there is no demo for deploying the Layout Area Detection module on the edge, so the picodet_detection demo is reused to deploy the PicoDet_layout_1x model.

"},{"location":"en/pipeline_deploy/edge_deploy.html#reference-materials","title":"Reference Materials","text":"

This guide only introduces the basic installation and usage process of the edge deployment demo. If you want to learn more detailed information, such as code introduction, code explanation, updating models, updating input and output preprocessing, updating prediction libraries, etc., please refer to the following documents:

  • Object Detection
  • Semantic Segmentation
  • Image Classification
  • OCR
"},{"location":"en/pipeline_deploy/edge_deploy.html#feedback-section","title":"Feedback Section","text":"

The edge deployment capabilities are continuously optimized. Welcome to submit issue to report problems and needs, and we will follow up promptly.

"},{"location":"en/pipeline_deploy/high_performance_inference.html","title":"PaddleX High-Performance Inference Guide","text":"

In real-world production environments, many applications have stringent standards for deployment strategy performance metrics, particularly response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins designed to deeply optimize model inference and pre/post-processing, achieving significant speedups in the end-to-end process. This document will first introduce the installation and usage of the high-performance inference plugins, followed by a list of pipelines and models currently supporting the use of these plugins.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#1-installation-and-usage-of-high-performance-inference-plugins","title":"1. Installation and Usage of High-Performance Inference Plugins","text":"

Before using the high-performance inference plugins, ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial, and have successfully run the quick inference of the pipeline using either the PaddleX pipeline command line instructions or the Python script instructions.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#11-installing-high-performance-inference-plugins","title":"1.1 Installing High-Performance Inference Plugins","text":"

Find the corresponding installation command based on your processor architecture, operating system, device type, and Python version in the table below and execute it in your deployment environment. Please replace {paddlex version number} with the actual paddlex version number, such as the current latest stable version 3.0.0b2. If you need to use the version corresponding to the development branch, replace {paddlex version number} with 0.0.0.dev0.

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0(CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • For Linux systems, execute the installation instructions using Bash.
  • When using NVIDIA GPUs, please use the installation instructions corresponding to the CUDA and cuDNN versions that match your environment. Otherwise, you will not be able to use the high-performance inference plugin properly.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/pipeline_deploy/high_performance_inference.html#12-obtaining-serial-numbers-and-activation","title":"1.2 Obtaining Serial Numbers and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Platform page, under the \"Open-source Pipeline Deployment Serial Number Inquiry and Acquisition\" section, select \"Acquire Now\" as shown in the following image:

Select the pipeline you wish to deploy and click \"Acquire\". Afterwards, you can find the acquired serial number in the \"Open-source Pipeline Deployment SDK Serial Number Management\" section at the bottom of the page:

After using the serial number to complete activation, you can utilize high-performance inference plugins. PaddleX provides both online and offline activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and enable online activation to automatically complete the process.
  • Offline Activation: Follow the instructions in the serial number management interface (click \"Offline Activation\" under \"Operations\") to obtain the device fingerprint of your machine. Bind the serial number with the device fingerprint to obtain a certificate and complete the activation. For this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI.

Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

For Linux systems, if using the high-performance inference plugin in a Docker container, please mount the host machine's /dev/disk/by-uuid and ${HOME}/.baidu/paddlex/licenses directories to the container.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate the license online, specify --update_license when using the serial number for the first time. Taking the general image classification pipeline as an example:

paddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number} \\\n    --update_license\n

For PaddleX Python API, enabling the high-performance inference plugin is similar. Still taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"image_classification\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": \"{serial_number}\"},\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\n

The inference results obtained with the high-performance inference plugin enabled are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache the relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent runs to improve initialization speed.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#14-modifying-high-performance-inference-configurations","title":"1.4 Modifying High-Performance Inference Configurations","text":"

PaddleX combines model information and runtime environment information to provide default high-performance inference configurations for each model. These default configurations are carefully prepared to be applicable in several common scenarios and achieve relatively optimal performance. Therefore, users typically may not need to be concerned with the specific details of these configurations. However, due to the diversity of actual deployment environments and requirements, the default configuration may not yield ideal performance in certain scenarios and could even result in inference failures. In cases where the default configuration does not meet the requirements, users can manually adjust the configuration by modifying the Hpi field in the inference.yml file within the model directory (if this field does not exist, it needs to be added). The following are two common situations:

  • Switching inference backends:

    When the default inference backend is not available, the inference backend needs to be switched manually. Users should modify the selected_backends field (if it does not exist, it needs to be added).

    Hpi:\n  ...\n  selected_backends:\n    cpu: paddle_infer\n    gpu: onnx_runtime\n  ...\n

    Each entry should follow the format {device type}: {inference backend name}.

    The currently available inference backends are:

    • paddle_infer: The Paddle Inference engine. Supports CPU and GPU. Compared to the PaddleX quick inference, TensorRT subgraphs can be integrated to enhance inference performance on GPUs.
    • openvino: OpenVINO, a deep learning inference tool provided by Intel, optimized for model inference performance on various Intel hardware. Supports CPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • onnx_runtime: ONNX Runtime, a cross-platform, high-performance inference engine. Supports CPU and GPU. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • tensorrt: TensorRT, a high-performance deep learning inference library provided by NVIDIA, optimized for NVIDIA GPUs to improve speed. Supports GPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
  • Modifying dynamic shape configurations for Paddle Inference or TensorRT:

    Dynamic shape is the ability of TensorRT to defer specifying parts or all of a tensor\u2019s dimensions until runtime. If the default dynamic shape configuration does not meet requirements (e.g., the model may require input shapes beyond the default range), users need to modify the trt_dynamic_shapes or dynamic_shapes field in the inference backend configuration:

    Hpi:\n  ...\n  backend_configs:\n    # Configuration for the Paddle Inference backend\n    paddle_infer:\n      ...\n      trt_dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n    # Configuration for the TensorRT backend\n    tensorrt:\n      ...\n      dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n

    In trt_dynamic_shapes or dynamic_shapes, each input tensor requires a specified dynamic shape in the format: {input tensor name}: [{minimum shape}, [{optimal shape}], [{maximum shape}]]. For details on minimum, optimal, and maximum shapes and further information, please refer to the official TensorRT documentation.

    After completing the modifications, please delete the cache files in the model directory (shape_range_info.pbtxt and files starting with trt_serialized).

"},{"location":"en/pipeline_deploy/high_performance_inference.html#2-pipelines-and-models-supporting-high-performance-inference-plugins","title":"2. Pipelines and Models Supporting High-Performance Inference Plugins","text":"Pipeline Module Model Support List OCR Text Detection \u2705 Text Recognition \u2705 PP-ChatOCRv3 Table Recognition \u2705 Layout Detection \u2705 Text Detection \u2705 Text Recognition \u2705 Seal Text Detection \u2705 Text Image Unwarping \u2705 Document Image Orientation Classification \u2705 Table Recognition Layout Detection \u2705 Table Recognition \u2705 Text Detection \u2705 Text Recognition \u2705 Object Detection Object Detection FasterRCNN-Swin-Tiny-FPN \u274cCenterNet-DLA-34 \u274c CenterNet-ResNet50 \u274c Instance Segmentation Instance Segmentation Mask-RT-DETR-S \u274c Image Classification Image Classification \u2705 Semantic Segmentation Semantic Segmentation \u2705 Time Series Forecasting Time Series Forecasting \u274c Time Series Anomaly Detection Time Series Anomaly Forecasting \u274c Time Series Classification Time Series Classification \u274c Small Object Detection Small Object Detection \u2705 Multi-Label Image Classification Multi-Label Image Classification \u2705 Image Anomaly Detection Unsupervised Anomaly Detection \u2705 Layout Parsing Table Structure Recognition \u2705 Layout Region Analysis \u2705 Text Detection \u2705 Text Recognition \u2705 Formula Recognition \u274c Seal Text Detection \u2705 Text Image Unwarping \u2705 Document Image Orientation Classification \u2705 Formula Recognition Layout Detection \u274c Formula Recognition \u274c Seal Recognition Layout Region Analysis \u2705 Seal Text Detection \u2705 Text Recognition \u2705 Image Recognition Subject Detection \u2705 Image Feature \u2705 Pedestrian Attribute Recognition Pedestrian Detection \u274c Pedestrian Attribute Recognition \u274c Vehicle Attribute Recognition Vehicle Detection \u274c Vehicle Attribute Recognition \u274c Face Recognition Face Detection \u2705 Face Feature \u2705"},{"location":"en/pipeline_deploy/service_deploy.html","title":"PaddleX Serving Deployment Guide","text":"

Serving deployment is a common form of deployment in real-world production environments. By encapsulating inference capabilities as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost serving deployment for production lines. This document will first introduce the basic process of serving deployment using PaddleX, followed by considerations and potential operations when using the service in a production environment.

Note - Serving deployment provides services for model pipelines, not specific to individual pipeline modules.

Serving Deployment Example Diagram:

"},{"location":"en/pipeline_deploy/service_deploy.html#1-basic-process","title":"1. Basic Process","text":""},{"location":"en/pipeline_deploy/service_deploy.html#11-install-the-serving-deployment-plugin","title":"1.1 Install the Serving Deployment Plugin","text":"

Execute the following command to install the serving deployment plugin:

paddlex --install serving\n
"},{"location":"en/pipeline_deploy/service_deploy.html#12-start-the-service","title":"1.2 Start the Service","text":"

Start the service through the PaddleX CLI with the following command format:

paddlex --serve --pipeline {pipeline_name_or_path} [{other_command_line_options}]\n

Taking the General Image Classification Pipeline as an example:

paddlex --serve --pipeline image_classification\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or the path to a local pipeline configuration file. PaddleX uses this to build the pipeline and deploy it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General Image Classification Pipeline Tutorial.

Command-line options related to serving deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Defaults to cpu (If GPU is unavailable) or gpu (If GPU is available). --host Hostname or IP address bound to the server. Defaults to 0.0.0.0. --port Port number listened to by the server. Defaults to 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Activates the license online if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/pipeline_deploy/service_deploy.html#13-call-the-service","title":"1.3 Call the Service","text":"

Please refer to the \"Development Integration/Deployment\" section in the usage tutorials for each pipeline. You can find the pipeline tutorials here.

"},{"location":"en/pipeline_deploy/service_deploy.html#2-deploy-services-for-production","title":"2. Deploy Services for Production","text":"

When deploying services into production environments, the stability, efficiency, and security of the services are of paramount importance. Below are some recommendations for deploying services into production.

"},{"location":"en/pipeline_deploy/service_deploy.html#21-utilize-paddlex-high-performance-inference-plugin","title":"2.1 Utilize PaddleX high-performance inference Plugin","text":"

In scenarios where strict response time requirements are imposed on applications, the PaddleX high-performance inference Plugin can be used to accelerate model inference and pre/post-processing, thereby reducing response time and increasing throughput.

To use the PaddleX high-performance inference Plugin, please refer to the PaddleX High-Performance Inference Guide for installing the high-performance inference plugin, obtaining serial numbers, and activating the plugin. Additionally, not all pipelines, models, and environments support the use of the high-performance inference plugin. For detailed support information, please refer to the section on pipelines and models that support the high-performance inference plugin.

When starting the PaddleX pipeline service, you can specify --use_hpip along with the serial number to use the high-performance inference plugin. If you wish to perform online activation, you should also specify --update_license. Example usage:

paddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number} --update_license\n
"},{"location":"en/pipeline_deploy/service_deploy.html#22-consider-security","title":"2.2 Consider Security","text":"

A typical scenario involves an application accepting inputs from the network, with the PaddleX pipeline service acting as a module within the application, interacting with other modules through APIs. In this case, the position of the PaddleX pipeline service within the application is crucial. The service-oriented deployment solution provided by PaddleX focuses on efficiency and ease of use but does not perform sufficient security checks on request bodies. Malicious requests from the network, such as excessively large images or carefully crafted data, can lead to severe consequences like service crashes. Therefore, it is recommended to place the PaddleX pipeline service within the application's internal network, avoiding direct processing of external inputs, and ensuring it only processes trustworthy requests. Appropriate protective measures, such as input validation and authentication, should be added at the application's outer layer.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html","title":"Overview of PaddleX Model Pipeline Usage","text":"

If you have already experienced the pre-trained model pipeline effects in PaddleX and wish to proceed directly with model fine-tuning, you can jump to Model Selection.

The complete PaddleX model pipeline development process is illustrated in the following diagram:

PaddleX Model Pipeline Development Flowchart

graph LR\n    select_pipeline(Select Pipeline) --> online_experience[Quick Experience]\n    online_experience --> online_ok{Satisfied with Results?}\n    online_ok --No--> select_model[Select Model]\n    select_model --> model_finetune[Model Fine-tuning]\n    online_ok --Yes--> development_integration(Development Integration/Deployment)\n    model_finetune --> pipeline_test[Pipeline Testing]\n    pipeline_test --> test_ok{Satisfied with Results?}\n    test_ok --No--> select_model\n    test_ok --Yes--> development_integration

The pre-trained model pipelines provided by PaddleX allow for quick experience of effects. If the pipeline effects meet your requirements, you can directly proceed with development integration/deployment of the pre-trained model pipeline. If the effects are not as expected, you can use your private data to fine-tune the models within the pipeline until satisfactory results are achieved.

Below, let's take the task of boarding pass recognition as an example to introduce the local usage process of the PaddleX model pipeline tool. Before use, please ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#1-select-pipeline","title":"1. Select Pipeline","text":"

Each pipeline in PaddleX can solve specific task scenarios such as object detection, time series prediction, semantic segmentation, etc. You need to select the pipeline for subsequent development based on the specific task. For example, for the boarding pass recognition task, the corresponding PaddleX pipeline is the General OCR Pipeline. More task-pipeline correspondences can be found in the PaddleX Models List (CPU/GPU).

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#2-quick-start","title":"2. Quick Start","text":"

Each pipeline in PaddleX integrates numerous pre-trained models. You can first experience the effects of the PaddleX pre-trained model pipeline. If the effects of the pre-trained model pipeline meet your expectations, you can proceed directly with Development Integration/Deployment. If not, optimize the pipeline effects according to the subsequent steps.

PaddleX provides three ways to quickly experience pipeline effects. You can choose the appropriate method based on your needs:

  • Online Quick Experience URL: PaddleX Pipeline List (CPU/GPU)
  • Command Line Quick Experience: PaddleX Pipeline Command Line Usage Instructions
  • Python Script Quick Experience: PaddleX Pipeline Python API Usage Instructions

To demonstrate the OCR pipeline for the boarding pass recognition task, you can quickly experience the pipeline's effect in three ways:

\ud83c\udf10 Online Experience

You can experience the effects of the universal OCR pipeline in AI Studio online. Use the official demo image provided for recognition, for example:

\ud83d\udcbb Command Line Experience

A single command can quickly experience the pipeline effects. Use the test file, and replace --input with a local path for prediction:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter description:

--pipeline: Pipeline name, which is the OCR pipeline in this case.\n--input: Local path or URL of the input image to be processed.\n--device: GPU serial number used (for example, gpu:0 means using the 0th GPU, gpu:1,2 means using the 1st and 2nd GPUs), or you can choose to use CPU (--device cpu).\n
\ud83d\udc49Click to view the running results

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [array([[ 6, 13],\n       [64, 13],\n       [64, 31],\n       [ 6, 31]], dtype=int16), array([[210,  14],\n       [238,  14],\n       ...\n       [830, 445],\n       [830, 464],\n       [338, 473]], dtype=int16)], 'dt_scores': [0.7629529090100092, 0.7717284653547034, 0.7139251666762622, 0.8057611181556994, 0.8840947658872964, 0.793295938183885, 0.8342027855884783, 0.8081378522874861, 0.8436969344212185, 0.8500845646497226, 0.7932189714842249, 0.8875924621248228, 0.8827884273639948, 0.8322404317386042, 0.8614796803023563, 0.8804252994596097, 0.9069978945305474, 0.8383917914190059, 0.8495824076580516, 0.8825556800041383, 0.852788927706737, 0.8379584696974435, 0.8633519228646618, 0.763234473595298, 0.8602154244410916, 0.9206341882426813, 0.6341425973804049, 0.8490156149797171, 0.758314821564747, 0.8757849788793592, 0.772485060565334, 0.8404023012596349, 0.8190037953773427, 0.851908529295617, 0.6126112758079643, 0.7324388418218587], 'rec_text': ['www.9', '5', 'boarding pass', 'BOARDING', 'PASS', 'cabin class', '', 'CLASS', 'SERIAL NO', 'seat number', 'SEAT NO', 'flight FLIGHT', 'date DATE', '03DEC', 'W', '035', 'MU 2379', 'departure city', 'FROM', 'boarding gate', 'GATE', 'boarding time BDT', 'destination TO', 'Fuzhou', 'Taiyuan', 'G11', 'FUZHOU', 'ID NO', 'NAME', 'ZHANGQIWEI', 'ticket number TKTNO', 'Zhang Qiwei', 'fare FARE', 'ETKT7813699238489/1', 'The boarding gate closes 10 minutes before departure', 'GATES CLOSE 10 MINUTES BEFORE DEPARTURE TIME'], 'rec_score': [0.683099627494812, 0.23417049646377563, 0.9969978928565979, 0.9945957660675049, 0.9787729382514954, 0.9983421564102173, 0.0, 0.9896272420883179, 0.9927973747253418, 0.9976049065589905, 0.9330753684043884, 0.9562691450119019, 0.9312669038772583, 0.9749765396118164, 0.9749416708946228, 0.9988260865211487, 0.9319792985916138, 0.9979889988899231, 0.9956836700439453, 0.9991750717163086, 0.9938803315162659, 0.9982991218566895, 0.9701204299926758, 0.9986245632171631, 0.9888408780097961, 0.9793729782104492, 0.9952947497367859, 0.9945247173309326, 0.9919753670692444, 0.991995632648468, 0.9937331080436707, 0.9963390827178955, 0.9954304695129395, 0.9934715628623962, 0.9974429607391357, 0.9529641270637512]}\n

The visualization result is as follows:

When executing the above command, the default OCR pipeline configuration file is loaded. If you need a custom configuration file, you can follow the steps below:

\ud83d\udc49Click to expand

Get the OCR pipeline configuration file:

paddlex --get_pipeline_config OCR\n

After execution, the OCR pipeline configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ocr.yaml, just execute:

paddlex --pipeline ./ocr.yaml --input general_ocr_002.png\n

Parameters such as --model, --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will prevail.

\ud83d\udcbb Python Script Experience

A few lines of code can quickly experience the pipeline effects:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

The following steps are executed:

  • create_pipeline() instantiates the pipeline object
  • Passes the image and calls the predict method of the pipeline object for inference prediction
  • Processes the prediction results

\u2757 The results obtained from running the Python script are the same as those from the command line method.

If the pre-trained model pipeline meets your expectations, you can proceed directly to development integration/deployment. If not, optimize the pipeline effects according to the following steps.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#3-model-selection-optional","title":"3. Model Selection (Optional)","text":"

Since a pipeline may contain one or more models, when fine-tuning models, you need to determine which model to fine-tune based on testing results. Taking the OCR pipeline for boarding pass recognition as an example, this pipeline includes a text detection model (e.g., PP-OCRv4_mobile_det) and a text recognition model (e.g., PP-OCRv4_mobile_rec). If the text positioning is inaccurate, you need to fine-tune the text detection model. If the text recognition is inaccurate, you need to fine-tune the text recognition model. If you are unsure which models are included in the pipeline, you can refer to the PaddleX Models List (CPU/GPU)

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#4-model-fine-tuning-optional","title":"4. Model Fine-tuning (Optional)","text":"

After determining the model to fine-tune, you need to train the model with your private dataset. PaddleX provides a single-model development tool that can complete model training with a single command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=your/dataset_dir\n
In addition, PaddleX provides detailed tutorials for preparing private datasets for model fine-tuning, single-model inference, and more. For details, please refer to the PaddleX Modules Tutorials

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#5-pipeline-testing-optional","title":"5. Pipeline Testing (Optional)","text":"

After fine-tuning your model with a private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n
Then, refer to the command line method or Python script method to load the modified pipeline configuration file.

If the results are satisfactory, proceed with Development Integration/Deployment. If not, return to Model Selection to continue fine-tuning other task modules until you achieve satisfactory results.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#6-development-integration-and-deployment","title":"6. Development Integration and Deployment","text":"

If the pre-trained pipeline meets your requirements for inference speed and accuracy, you can proceed directly to development integration/deployment.

If you need to apply the pipeline directly in your Python project, you can refer to the PaddleX Pipeline Python Script Usage Guide and the Python example code in the Quick Start section.

In addition, PaddleX also provides three other deployment methods, with detailed instructions as follows:

\ud83d\ude80 high-performance inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

\u2757 PaddleX provides detailed usage instructions for each pipeline. You can choose according to your needs. Here are all the pipelines and their corresponding detailed instructions:

Pipeline Name Detailed Description PP-ChatOCR-doc v3 PP-ChatOCR-doc v3 Pipeline Usage Tutorial Image Classification Image Classification Pipeline Usage Tutorial Object Detection Object Detection Pipeline Usage Tutorial Instance Segmentation Instance Segmentation Pipeline Usage Tutorial Semantic Segmentation Semantic Segmentation Pipeline Usage Tutorial Image Multi-label Classification Image Multi-label Classification Pipeline Usage Tutorial Small Object Detection Small Object Detection Pipeline Usage Tutorial Image Anomaly Detection Image Anomaly Detection Pipeline Usage Tutorial OCR OCR Pipeline Usage Tutorial Table Recognition Table Recognition Pipeline Usage Tutorial Layout Parsing Layout Parsing Pipeline Usage Tutorial Formula Recognition Formula Recognition Pipeline Usage Tutorial Seal Recognition Seal Recognition Pipeline Usage Tutorial Time Series Forecasting Time Series Forecasting Pipeline Usage Tutorial Time Series Anomaly Detection Time Series Anomaly Detection Pipeline Usage Tutorial Time Series Classification Time Series Classification Pipeline Usage Tutorial"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html","title":"PaddleX Pipeline CLI Usage Instructions","text":"

Before using the CLI command line for rapid inference of the pipeline, please ensure that you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#i-usage-example","title":"I. Usage Example","text":""},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#1-quick-experience","title":"1. Quick Experience","text":"

Taking the image classification pipeline as an example, the usage is as follows:

paddlex --pipeline image_classification \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --device gpu:0 \\\n        --save_path ./output/\n
This single step completes the inference prediction and saves the prediction results. Explanations for the relevant parameters are as follows:

  • pipeline: The name of the pipeline or the local path to the pipeline configuration file, such as the pipeline name \"image_classification\", or the path to the pipeline configuration file \"path/to/image_classification.yaml\";
  • input: The path to the data file to be predicted, supporting local file paths, local directories containing data files to be predicted, and file URL links;
  • device: Used to set the model inference device. If set for GPU, you can specify the card number, such as \"cpu\", \"gpu:2\". When not specified, if GPU is available, it will be used; otherwise, CPU will be used;
  • save_path: The save path for prediction results. When not specified, the prediction results will not be saved;
"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#2-custom-pipeline-configuration","title":"2. Custom Pipeline Configuration","text":"

If you need to modify the pipeline configuration, you can retrieve the configuration file and modify it. Still taking the image classification pipeline as an example, the way to retrieve the configuration file is as follows:

paddlex --get_pipeline_config image_classification\n\n# Please enter the path that you want to save the pipeline config file: (default `./`)\n./configs/\n\n# The pipeline config has been saved to: configs/image_classification.yaml\n

After modifying the production line configuration file configs/image_classification.yaml, such as the content for the image classification configuration file:

Global:\n  pipeline_name: image_classification\n  input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\n\nPipeline:\n  model: PP-LCNet_x0_5\n  batch_size: 1\n  device: \"gpu:0\"\n

Once the modification is completed, you can use this configuration file to perform model pipeline inference prediction as follows:

paddlex --pipeline configs/image_classification.yaml \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --save_path ./output/\n\n# {'input_path': '/root/.paddlex/predict_input/general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': array([0.62817, 0.03729, 0.03262, 0.03247, 0.03196]), 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html","title":"PaddleX Model Pipeline Python Usage Instructions","text":"

Before using Python scripts for rapid inference on model pipelines, please ensure you have installed PaddleX following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification pipeline as an example, the usage is as follows:

from paddlex import create_pipeline\npipeline = create_pipeline(\"image_classification\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, there are only three steps:

  • Call the create_pipeline() method to instantiate the prediction model pipeline object;
  • Call the predict() method of the prediction model pipeline object for inference;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#1-instantiate-the-prediction-model-pipeline-object-by-calling-create_pipeline","title":"1. Instantiate the Prediction Model Pipeline Object by Calling create_pipeline()","text":"
  • create_pipeline: Instantiates the prediction model pipeline object;
  • Parameters:
    • pipeline_name: str type, the pipeline name or the local pipeline configuration file path, such as \"image_classification\", \"/path/to/image_classification.yaml\";
    • device: str type, used to set the model inference device, such as \"cpu\" or \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#2-perform-inference-by-calling-the-predict-method-of-the-prediction-model-pipeline-object","title":"2. Perform Inference by Calling the predict() Method of the Prediction Model Pipeline Object","text":"
  • predict: Uses the defined prediction model pipeline to predict input data;
  • Parameters:
    • input: Any type, supporting str representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV tasks, supports numpy.ndarray representing image data; for TS tasks, supports pandas.DataFrame type data; also supports lists of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results of the model pipeline support access, visualization, and saving, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes","title":"Attributes:","text":"
  • str: str type representation of the prediction result;
  • Return Value: str type, string representation of the prediction result;
  • json: Prediction result in JSON format;
  • Return Value: dict type;
  • img: Visualization image of the prediction result;
  • Return Value: PIL.Image type;
  • html: HTML representation of the prediction result;
  • Return Value: str type;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results_1","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_1","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_2","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html","title":"Face Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#1-introduction-to-the-face-recognition-pipeline","title":"1. Introduction to the Face Recognition Pipeline","text":"

Face recognition is a crucial component in the field of computer vision, aiming to automatically identify individuals by analyzing and comparing facial features. This task involves not only detecting faces in images but also extracting and matching facial features to find corresponding identity information in a database. Face recognition is widely used in security authentication, surveillance systems, social media, smart devices, and other scenarios.

The face recognition pipeline is an end-to-end system dedicated to solving face detection and recognition tasks. It can quickly and accurately locate face regions in images, extract facial features, and retrieve and compare them with pre-established features in a feature database to confirm identity information.

The face recognition pipeline includes a face detection module and a face feature module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model size, choose models with smaller storage requirements.

Face Detection Module:

ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 Improved BlazeFace with FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640x640. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Face Recognition Module:

ModelModel Download Link Output Feature Dimension AP (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face recognition model trained on MS1Mv3 based on MobileFaceNet ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face recognition model trained on MS1Mv3 based on ResNet50

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can experience the effects of the face recognition pipeline online or locally using command-line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Oneline Experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the facial recognition pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Command line experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

Please download the test image for testing. In the example of running this pipeline, you need to pre-build a facial feature library. You can refer to the following instructions to download the official demo data to be used for subsequent construction of the facial feature library. You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_demo_gallery.tar\ntar -xf ./face_demo_gallery.tar\n

If you wish to build a facial feature library using a private dataset, please refer to Section 2.3: Data Organization for Building a Feature Library. Afterward, you can complete the establishment of the facial feature library and quickly perform inference with the facial recognition pipeline using just a few lines of code.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a face recognition pipeline object. The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the build_index method of the face recognition pipeline object to build the facial feature library. The specific parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset, with data organization referring to Section 2.3: Data Organization for Building a Feature Library str None index_dir The save path for the feature library. After successfully calling the build_index method, two files will be generated in this path: \"id_map.pkl\" saves the mapping relationship between image IDs and image feature labels; \"vector.index\" stores the feature vectors of each image. str None

(3) Call the predict method of the face recognition pipeline object for inference prediction: The predict method parameter is x, used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory containing the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(4) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(5) Process the prediction results: The prediction result for each sample is of type dict, and it supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: Boolean, whether to format the output with JSON indentation, default is True; - indent: Integer, JSON formatting setting, effective only when format_json is True, default is 4; - ensure_ascii: Boolean, JSON formatting setting, effective only when format_json is True, default is False; save_to_json Save results as a JSON file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name; - indent: Integer, JSON formatting setting, default is 4; - ensure_ascii: Boolean, JSON formatting setting, default is False; save_to_img Save results as an image file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name;

If you have obtained the configuration file, you can customize various settings of the facial recognition pipeline by simply modifying the pipeline parameter value in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/face_recognition.yaml, you just need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/face_recognition.yaml\")\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#223-adding-and-deleting-operations-in-the-face-feature-library","title":"2.2.3 Adding and Deleting Operations in the Face Feature Library","text":"

If you wish to add more face images to the feature library, you can call the add_index method; to delete face image features, you can call the delete_index method.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.add_index(data_root=\"add_gallery\", index_dir=\"face_gallery_index\")\n\npipeline.delete_index(data_root=\"delete_gallery\", index_dir=\"face_gallery_index\")\n

The add_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be added. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library to which features are added. After successfully calling the add_index method, the face image features in data_root will be added to the face feature library originally saved at index_dir. str None

The delete_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be deleted. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library from which features are deleted. After successfully calling the delete_index method, the face image features in data_root will be deleted from the face feature library originally saved at index_dir. str None"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#23-data-organization-for-feature-library-construction","title":"2.3 Data Organization for Feature Library Construction","text":"

The face recognition pipeline example in PaddleX requires a pre-constructed feature library for face feature retrieval. If you wish to build a face feature library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u251c\u2500\u2500 ID0           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502       ...\n\u2502   \u251c\u2500\u2500 ID1           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the face image to be retrieved and the image feature label, separated by a space. Example content: images/Chandler/Chandler00037.jpg Chandler\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the face recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the face recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is successfully processed, the response status code is 200, and the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result attribute of type object, which stores the operation result information.

  • When the request is not successfully processed, the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • infer

Obtain OCR results for an image.

POST /ocr

  • The attributes of the request body are as follows:
Name Type Meaning Required image string The URL of an accessible image file or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The attributes of```markdown

Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image to Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64 encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // Encode the local image to Base64\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // Call the API\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // Process the response data\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outputImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outputImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n\n
``````markdown # Tutorial on Artificial Intelligence and Computer Vision This tutorial, intended for numerous developers, covers the basics and applications of AI and Computer Vision. Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // Service URL\n        String imagePath = \"./demo.jpg\"; // Local image path\n        String outputImagePath = \"./out.jpg\"; // Output image path\n\n        // Encode the local image to Base64\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64-encoded file content or image URL\n\n        // Create an OkHttpClient instance\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // Call the API and process the response\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // Encode the local image to Base64\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64-encoded file content or image URL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // Call the API\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // Process the response\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }```markdown\n# An English Tutorial on Artificial Intelligence and Computer Vision\n\nThis tutorial document is intended for numerous developers and covers content related to artificial intelligence and computer vision.\n\n<details>\n<summary>C#</summary>\n\n```csharp\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\nstatic readonly string API_URL = \"http://localhost:8080/ocr\";\nstatic readonly string imagePath = \"./demo.jpg\";\nstatic readonly string outputImagePath = \"./out.jpg\";\n\nstatic async Task Main(string[] args)\n{\nvar httpClient = new HttpClient();\n\n// Encode the local image to Base64\nbyte[] imageBytes = File.ReadAllBytes(imagePath);\nstring image_data = Convert.ToBase64String(imageBytes);\n\nvar payload = new JObject{ { \"image\", image_data } }; // Base64 encoded file content or image URL\nvar content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n// Call the API\nHttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\nresponse.EnsureSuccessStatusCode();\n\n// Process the API response\nstring responseBody = await response.Content.ReadAsStringAsync();\nJObject jsonResponse = JObject.Parse(responseBody);\n\nstring base64Image = jsonResponse[\"result\"][\"image\"].ToString();\nbyte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\nFile.WriteAllBytes(outputImagePath, outputImageBytes);\nConsole.WriteLine($\"Output image saved at {outputImagePath}\");\nConsole.WriteLine(\"\\nDetected texts:\");\nConsole.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n}\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr';\nconst imagePath = './demo.jpg';\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64 encoded file content or image URL\n  })\n};\n\n// Encode the local image to Base64\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// Call the API\naxios.request(config)\n.then((response) => {\n    // Process the API response\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP ```php $image_data); // Base64 encoded file content or image URL // Call the API $ch = curl_init($API_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process the API response $result = json_decode($response, true)[\"result\"]; file_put_contents($output ``` \ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the [PaddleX Edge Deployment Guide](../../../pipeline_deploy/edge_deploy.en.md). You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration. ## 4. Custom Development If the default model weights provided by the Face Recognition Pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the pipeline in your scenario. ### 4.1 Model Fine-tuning Since the Face Recognition Pipeline consists of two modules (face detection and face recognition), the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If you find that many faces are not detected during the analysis, it may indicate deficiencies in the face detection model. In this case, you need to refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_detection.en.md#IV.-Custom-Development) section in the [Face Detection Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_detection.en.md) and use your private dataset to fine-tune the face detection model. If matching errors occur in detected faces, it suggests that the face feature model needs further improvement. You should refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_feature.en.md#IV.-Custom-Development) section in the [Face Feature Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_feature.en.md) to fine-tune the face feature model. ### 4.2 Model Application After completing fine-tuning training with your private dataset, you will obtain local model weight files. To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the pipeline configuration file: ```bash ...... Pipeline: device: \"gpu:0\" det_model: \"BlazeFace\" # Can be modified to the local path of the fine-tuned face detection model rec_model: \"MobileFaceNet\" # Can be modified to the local path of the fine-tuned face recognition model det_batch_size: 1 rec_batch_size: 1 device: gpu ...... ``` Subsequently, refer to the command-line method or Python script method in [2.2 Local Experience](#22-Local-Experience) to load the modified pipeline configuration file. Note: Currently, setting separate `batch_size` for face detection and face recognition models is not supported. ## 5. Multi-hardware Support PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the `--device` parameter allows seamless switching between different hardware. For example, when running the face recognition pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the `device` in the script to `npu`: ```python from paddlex import create_pipeline pipeline = create_pipeline( pipeline=\"face_recognition\", device=\"npu:0\" # gpu:0 --> npu:0 ) ``` If you want to use the face recognition pipeline on more types of hardware, please refer to the [PaddleX Multi-device Usage Guide](../../../other_devices_support/multi_devices_use_guide.en.md)."},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html","title":"General Image Recognition Pipeline Usage Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#1-introduction-to-the-general-image-recognition-pipeline","title":"1. Introduction to the General Image Recognition Pipeline","text":"

The General Image Recognition Pipeline aims to solve the problem of open-domain object localization and recognition. Currently, PaddleX's General Image Recognition Pipeline supports PP-ShiTuV2.

PP-ShiTuV2 is a practical general image recognition system mainly composed of three modules: mainbody detection module, image feature module, and vector retrieval module. The system integrates and improves various strategies in multiple aspects, including backbone network, loss function, data augmentation, learning rate scheduling, regularization, pre-trained model, and model pruning and quantization. It optimizes each module and ultimately achieves better performance in multiple application scenarios.

The General Image Recognition Pipeline includes the mainbody detection module and the image feature module, with several models to choose. You can select the model to use based on the benchmark data below. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Object Detection Module:

Model mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_det 41.5 62.0 33.7 537.0 27.54 An mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common objects simultaneously.

Note: The above accuracy metrics are based on the private mainbody detection dataset.

Image Feature Module:

Model Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: mainbody detection, feature extraction, and vector retrieval. These models are part of the feature extraction module, and different models can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are based on AliProducts Recall@1. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can use Python to experience locally.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General Image Recognition Pipeline locally, please ensure you have installed the PaddleX wheel package according to the PaddleX Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

The pipeline does not support command line experience at this time.

By default, the built-in General Image Recognition Pipeline configuration file is used. If you want to change it, you can run the following command to obtain:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config PP-ShiTuV2\n

After execution, the General Image Recognition Pipeline configuration file will be saved in the current directory. If you want to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ShiTuV2 --save_path ./my_path\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"
  • In the example of using this pipeline, a feature vector library needs to be built beforehand. You can download the officially provided drink recognition test dataset drink_dataset_v2.0 to build the feature vector library. If you want to use a private dataset, you can refer to Section 2.3 Data Organization for Building the Feature Library. After that, you can quickly build the feature vector library and predict using the General Image Recognition Pipeline with just a few lines of code.
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"PP-ShiTuV2\")\n\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\", index_dir=\"index_dir\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n\n````\n\nIn the above Python script, the following steps are executed:\n\n(1) Call the `create_pipeline` function to create a general image recognition pipeline object. The specific parameter descriptions are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>pipeline</code></td>\n<td>The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, <code>index_dir</code> needs to be specified in <code>predict()</code>.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>device</code></td>\n<td>The inference device for the pipeline model. Supports: \"gpu\", \"cpu\".</td>\n<td><code>str</code></td>\n<td><code>gpu</code></td>\n</tr>\n<tr>\n<td><code>use_hpip</code></td>\n<td>Whether to enable high-performance inference, which is only available when the pipeline supports it.</td>\n<td><code>bool</code></td>\n<td><code>False</code></td>\n</tr>\n</tbody>\n</table>\n\n(2) Call the `build_index` function of the general image recognition pipeline object to build the feature vector library. The specific parameters are described as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>data_root</code></td>\n<td>The root directory of the dataset. The data organization method refers to <a href=\"#2.3-Data-Organization-for-Building-the-Feature-Library\">Section 2.3 Data Organization for Building the Feature Library</a></td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The save path for the feature library. After successfully calling the <code>build_index</code> function, two files will be generated in this path: <code>\"id_map.pkl\"</code> saves the mapping relationship between image IDs and image feature labels; <code>\"vector.index\"</code> stores the feature vectors of each image.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n</tbody>\n</table>\n\n(3) Call the `predict` function of the general image recognition pipeline object for inference prediction: The `predict` function parameter is `input`, which is used to input the data to be predicted, supporting multiple input methods. Specific examples are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Python Var</td>\n<td>Supports directly passing in Python variables, such as <code>numpy.ndarray</code> representing image data.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the file path of the data to be predicted, such as the local path of an image file: <code>/root/data/img.jpg</code>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: <a href=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/yuanqisenlin.jpeg\">Example</a>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in a local directory that contains the data files to be predicted, such as the local path: <code>/root/data/</code>.</td>\n</tr>\n<tr>\n<td>dict</td>\n<td>Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: <code>{\"img\": \"/root/data1\"}</code>.</td>\n</tr>\n<tr>\n<td>list</td>\n<td>Supports passing in a list, where the elements of the list need to be the above types of data, such as <code>[numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]</code>, <code>[\"/root/data1\", \"/root/data2\"]</code>, <code>[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]</code>.</td>\n</tr>\n</tbody>\n</table>\n\nAdditionally, the `predict` method supports the `index_dir` parameter for setting the retrieval database:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, the default retrieval database specified through the <code>index_dir</code> parameter in <code>create_pipeline()</code> will be used.</td>\n</tr>\n</tbody>\n</table>\n\n(4) Obtain the prediction results by calling the `predict` method: The `predict` method is a `generator`, so prediction results need to be obtained by iteration. The `predict` method predicts data in batches.\n\n(5) Process the prediction results: The prediction result for each sample is of `dict` type and supports printing or saving to a file. The supported save types are related to the specific pipeline, such as:\n\n<table>\n<thead>\n<tr>\n<th>Method</th>\n<th>Description</th>\n<th>Method Parameters</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>print</td>\n<td>Print the results to the terminal</td>\n<td><code>- format_json</code>: bool type, whether to use json indentation formatting for the output content, default is True;<br><code>- indent</code>: int type, json formatting setting, only effective when format_json is True, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, only effective when format_json is True, default is False;</td>\n</tr>\n<tr>\n<td>save_to_json</td>\n<td>Save the results as a json-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;<br><code>- indent</code>: int type, json formatting setting, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, default is False;</td>\n</tr>\n<tr>\n<td>save_to_img</td>\n<td>Save the results as an image-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;</td>\n</tr>\n</tbody>\n</table>\n\nIf you have a configuration file, you can customize the configurations for the general image recognition pipeline by modifying the `pipeline` parameter value in the `create_pipeline` method to the path of the pipeline configuration file.\n\nFor example, if your configuration file is saved at `./my_path/PP-ShiTuV2.yaml`, you only need to execute:\n\n```python\nfrom paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/PP-ShiTuV2.yaml\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#223-add-or-remove-features-from-the-feature-library","title":"2.2.3 Add or Remove Features from the Feature Library","text":"

If you want to add more images to the feature library, you can call the append_index function; to remove image features, you can call the remove_index function.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\"PP-ShiTuV2\")\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.append_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.remove_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\n

The parameter descriptions for the above methods are as follows:

Parameter Description Type Default Value data_root The root directory of the dataset to be added. The data organization should be the same as when building the feature library, refer to Section 2.3 Data Organization for Building the Feature Library str None index_dir The storage directory for the feature library. In append_index and remove_index, it is also the path of the feature library to be modified (or deleted). str None index_type Supports HNSW32, IVF, Flat. Among them, HNSW32 has faster retrieval speed and higher accuracy but does not support the remove_index() operation; IVF has faster retrieval speed but relatively lower accuracy, and supports append_index() and remove_index() operations; Flat has lower retrieval speed but higher accuracy, and supports append_index() and remove_index() operations. str HNSW32 metric_type Supports: IP, Inner Product; L2, Euclidean Distance. str IP"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#23-data-organization-for-building-the-feature-library","title":"2.3 Data Organization for Building the Feature Library","text":"

The PaddleX general image recognition pipeline requires a pre-built feature library for feature retrieval. If you want to build a feature vector library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the image to be retrieved and the image label, separated by a space, for example: \u201c0/0.jpg label\u201d\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result property, which is an object type that stores operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • buildIndex

Build feature vector index.

POST /shitu-index-build

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning indexKey string The key corresponding to the index, used to identify the established index. Can be used as input for other operations. idMap object Mapping from vector ID to label.
  • addImagesToIndex

Add images (corresponding feature vectors) to the index.

POST /shitu-index-add

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • removeImagesFromIndex

Remove images (corresponding feature vectors) from the index.

POST /shitu-index-remove

  • The properties of the request body are as follows:
Name Type Meaning Required ids array IDs of the vectors to be removed from the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • infer

Perform image recognition.

POST /shitu-infer

  • The properties of the request body are as follows:
Name Type Meaning Required image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning detectedObjects array Information of the detected targets. image string Recognition result image. The image is in JPEG format, encoded with Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Meaning bbox array Target location. The elements in the array are the x-coordinate of the upper-left corner, the y-coordinate of the upper-left corner, the x-coordinate of the lower-right corner, and the y-coordinate of the lower-right corner, respectively. recResults array Recognition results. score number Detection score.

Each element in recResults is an object with the following properties:

Name Type Meaning label string Label. score number Recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\n\nbase_image_label_pairs = [\n    {\"image\": \"./demo0.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo1.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo2.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nimage_label_pairs_to_add = [\n    {\"image\": \"./demo3.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nids_to_remove = [1]\ninfer_image_path = \"./demo4.jpg\"\noutput_image_path = \"./out.jpg\"\n\nfor pair in base_image_label_pairs:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": base_image_label_pairs}\nresp_index_build = requests.post(f\"{API_BASE_URL}/shitu-index-build\", json=payload)\nif resp_index_build.status_code != 200:\n    print(f\"Request to shitu-index-build failed with status code {resp_index_build}.\")\n    pprint.pp(resp_index_build.json())\n    sys.exit(1)\nresult_index_build = resp_index_build.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_build['idMap'])}\")\n\nfor pair in image_label_pairs_to_add:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": image_label_pairs_to_add, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_add = requests.post(f\"{API_BASE_URL}/shitu-index-add\", json=payload)\nif resp_index_add.status_code != 200:\n    print(f\"Request to shitu-index-add failed with status code {resp_index_add}.\")\n    pprint.pp(resp_index_add.json())\n    sys.exit(1)\nresult_index_add = resp_index_add.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_add['idMap'])}\")\n\npayload = {\"ids\": ids_to_remove, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_remove = requests.post(f\"{API_BASE_URL}/shitu-index-remove\", json=payload)\nif resp_index_remove.status_code != 200:\n    print(f\"Request to shitu-index-remove failed with status code {resp_index_remove}.\")\n    pprint.pp(resp_index_remove.json())\n    sys.exit(1)\nresult_index_remove = resp_index_remove.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_remove['idMap'])}\")\n\nwith open(infer_image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_infer = requests.post(f\"{API_BASE_URL}/shitu-infer\", json=payload)\nif resp_infer.status_code != 200:\n    print(f\"Request to shitu-infer failed with status code {resp_infer}.\")\n    pprint.pp(resp_infer.json())\n    sys.exit(1)\nresult_infer = resp_infer.json()[\"result\"]\n\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result_infer[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\npprint.pp(result_infer[\"detectedObjects\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Image Recognition Pipeline do not meet your expectations in terms of precision or speed. You can further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-Tuning","text":"

Since the General Image Recognition Pipeline consists of two modules (the mainbody detection module and the image feature module), the suboptimal performance of the pipeline may stem from either module.

You can analyze images with poor recognition results. After analysising, if you find that many mainbody objects are not detected, it may indicate deficiencies in the mainbody detection model. You need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the mainbody detection model. If there are mismatches in the detected mainbody objects, it suggests that the image feature model requires further improvement. You should refer to the Custom Development section in the Image Feature Module Development Tutorial and fine-tune the image feature model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After you complete the fine-tuning training with your private dataset, you will obtain local model files.

To use the fine-tuned model, you only need to modify the pipeline configuration file by replacing with the paths to your fine-tuned model:

Pipeline:\n  device: \"gpu:0\"\n  det_model: \"./PP-ShiTuV2_det_infer/\"        # Can be modified to the local path of the fine-tuned mainbody detection model\n  rec_model: \"./PP-ShiTuV2_rec_infer/\"        # Can be modified to the local path of the fine-tuned image feature model\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n
Subsequently, refer to the command-line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply by modifying the --device parameter, seamless switching between different hardware can be achieved.

For example, when running the General Image Recognition Pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the device in the script to npu:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ShiTuV2\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n)\n

If you want to use the General Image Recognition Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html","title":"Image Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#1-introduction-to-image-anomaly-detection-pipeline","title":"1. Introduction to Image Anomaly Detection Pipeline","text":"

Image anomaly detection is an image processing technique that identifies unusual or non-conforming patterns within images through analysis. It is widely applied in industrial quality inspection, medical image analysis, and security monitoring. By leveraging machine learning and deep learning algorithms, image anomaly detection can automatically recognize potential defects, anomalies, or abnormal behaviors in images, enabling us to promptly identify issues and take corresponding actions. The image anomaly detection system is designed to automatically detect and mark anomalies in images, enhancing work efficiency and accuracy.

The image anomaly detection pipeline includes an unsupervised anomaly detection module, with the following model benchmarks:

Model NameModel Download Link Avg (%) Model Size (M) STFPMInference Model/Trained Model 96.2 21.5 M

Note: The above accuracy metrics are the average anomaly scores on the MVTec AD validation set. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the anomaly detection pipeline, allowing for quick experience of its effects. You can use the command line or Python to experience the image anomaly detection pipeline locally.

Before using the image anomaly detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config anomaly_detection\n

After execution, the image anomaly detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config anomaly_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./anomaly_detection.yaml, simply execute:

paddlex --pipeline ./anomaly_detection.yaml --input uad_grid.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'uad_grid.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference using the pipeline. Taking the image anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"anomaly_detection\")\n\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n

The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the pipeline object for inference prediction: The predict method takes x as its parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path to the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/anomaly_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/anomaly_detection.yaml\")\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs anomaly detection on images.

POST /image-anomaly-detection

  • Request body properties:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order), where 255 represents an anomaly point, and 0 represents a non-anomaly point. size array Image shape. The elements in the array are the height and width of the image in order. image string Anomaly detection result image. The image is in JPEG format and encoded in Base64.

Example of result:

{\n\"labelMap\": [\n0,\n0,\n255,\n0\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-anomaly-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-anomaly-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-anomaly-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-anomaly-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-anomaly-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-anomaly-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the image anomaly detection pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the image anomaly detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the image anomaly detection pipeline includes an unsupervised image anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Unsupervised Anomaly Detection Module Tutorial and use your private dataset to fine-tune the image anomaly detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding position in the pipeline configuration file:

......\nPipeline:\n  model: STFPM   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the image anomaly detection pipeline, the Python command is:

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline anomaly_detection --input uad_grid.png --device npu:0\n
If you want to use the image anomaly detection pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html","title":"General Image Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#1-introduction-to-the-general-image-classification-pipeline","title":"1. Introduction to the General Image Classification Pipeline","text":"

Image classification is a technique that assigns images to predefined categories. It is widely applied in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification.

The General Image Classification Pipeline includes an image classification module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Image Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Image Classification Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config image_classification\n

After execution, the image classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file take effect. For example, if the configuration file's save path is ./image_classification.yaml, simply execute:

paddlex --pipeline ./image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If you still specify parameters, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': [0.62736, 0.03752, 0.03256, 0.0323, 0.03194], 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the results. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string The image classification result image. The image is in JPEG format and encoded using Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image classification pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using data from your specific domain or application scenario to improve the recognition performance of the general image classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image classification pipeline includes an image classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Classification Module Development Tutorial and use your private dataset to fine-tune the image classification model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the image classification pipeline, the Python command is:

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Classification Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html","title":"General Image Multi-Label Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#1-introduction-to-the-general-image-multi-label-classification-pipeline","title":"1. Introduction to the General Image Multi-Label Classification Pipeline","text":"

Image multi-label classification is a technique that assigns multiple relevant categories to a single image simultaneously, widely used in image annotation, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, for example, an image containing both \"dog\" and \"outdoor\" labels. By leveraging deep learning models, image multi-label classification automatically extracts image features and performs accurate classification, providing users with more comprehensive information. This technology is of great significance in applications such as intelligent search engines and automatic content generation.

The General Image Multi-Label Classification Pipeline includes a module for image multi-label classification. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link mAP (%) Model Storage Size (M) CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 - PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 ResNet50_MLInference Model/Trained Model 83.50 108.9

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017. The GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the General Image Multi-Label Classification Pipeline locally using command line or Python.

Before using the General Image Multi-Label Classification Pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the effects of the image multi-label classification pipeline with a single command:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image multi-label classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default configuration file for the image multi-label classification pipeline is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config multi_label_image_classification\n

After execution, the configuration file for the image multi-label classification pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config multi_label_image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./multi_label_image_classification.yaml, simply execute:

paddlex --pipeline ./multi_label_image_classification.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n

Where --model, --device, and other parameters are not specified, the parameters in the configuration file will be used. If parameters are specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [21, 0, 30, 24], 'scores': [0.99257, 0.70596, 0.63001, 0.57852], 'label_names': ['bear', 'person', 'skis', 'backpack']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general image multi-label classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"multi_label_image_classification\")\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result visualization image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path of the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the multi-label classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the file path of the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key of the dictionary needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/multi_label_image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/multi_label_image_classification.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have strict standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed to 0. errorMsg string Error message. Fixed to \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /multilabel-image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the result. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string Image classification result image. The image is in JPEG format and encoded in Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/multilabel-image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/multilabel-image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/multilabel-image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/multilabel-image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/multilabel-image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/multilabel-image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/multilabel-image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a way to place computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image multi-label classification pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general image multi-label classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image multi-label classification pipeline includes an image multi-label classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Multi-Label Classification Module Development Tutorial to fine-tune the image multi-label classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0_ML   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the image multi-label classification pipeline, the Python command is:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/padd\n

At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the Python command to npu:0:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Multi-label Classification Pipeline on more diverse hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html","title":"General Instance Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#1-introduction-to-the-general-instance-segmentation-pipeline","title":"1. Introduction to the General Instance Segmentation Pipeline","text":"

Instance segmentation is a computer vision task that not only identifies the object categories in an image but also distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately label each car, person, or animal in an image, ensuring they are independently processed at the pixel level. For example, in a street scene image containing multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robotic vision, often relying on deep learning models (such as Mask R-CNN) to achieve efficient pixel classification and instance differentiation through Convolutional Neural Networks (CNNs), providing powerful support for understanding complex scenes.

The General Instance Segmentation Pipeline includes a Object Detection module. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of the effects. You can experience the effects of the General Instance Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Instance Segmentation Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline instance_segmentation --input  general_instance_segmentation_004.png --device gpu:0\n

Parameter Description:

--pipeline: The name of the pipeline, here it refers to the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default instance segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config instance_segmentation\n

After execution, the instance segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config instance_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./instance_segmentation.yaml, simply execute:

paddlex --pipeline ./instance_segmentation.yaml --input general_instance_segmentation_004.png --device gpu:0\n

Where --model, --device, and other parameters do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_instance_segmentation_004.png', 'boxes': [{'cls_id': 0, 'label': 'person', 'score': 0.8698326945304871, 'coordinate': [339, 0, 639, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8571141362190247, 'coordinate': [0, 0, 195, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8202633857727051, 'coordinate': [88, 113, 401, 574]}, {'cls_id': 0, 'label': 'person', 'score': 0.7108577489852905, 'coordinate': [522, 21, 767, 574]}, {'cls_id': 27, 'label': 'tie', 'score': 0.554280698299408, 'coordinate': [247, 311, 355, 574]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general instance segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"instance_segmentation\")\n\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualization image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/instance_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/instance_segmentation.yaml\")\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs instance segmentation on an image.

POST /instance-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description instances array Information about the locations and categories of instances. image string The result image of instance segmentation. The image is in JPEG format and encoded in Base64.

Each element in instances is an object with the following properties:

Name Type Description bbox array The location of the instance. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the instance category. score number The score of the instance. mask object The segmentation mask of the instance.

The properties of mask are as follows:

Name Type Description rleResult str The run-length encoding result of the mask. size array The shape of the mask. The elements in the array are the height and width of the mask, respectively.

An example of result is as follows:

{\n\"instances\": [\n{\n\"bbox\": [\n162.39381408691406,\n83.88176727294922,\n624.0797119140625,\n343.4986877441406\n],\n\"categoryId\": 33,\n\"score\": 0.8691174983978271,\n\"mask\": {\n\"rleResult\": \"xxxxxx\",\n\"size\": [\n259,\n462\n]\n}\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/instance-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nInstances:\")\nprint(result[\"instances\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/instance-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto instances = result[\"instances\"];\n        std::cout << \"\\nInstances:\" << std::endl;\n        for (const auto& inst : instances) {\n            std::cout << inst << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/instance-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode instances = result.get(\"instances\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nInstances: \" + instances.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/instance-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Instances []map[string]interface{} `json:\"instances\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nInstances:\")\n    for _, inst := range respData.Result.Instances {\n        fmt.Println(inst)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/instance-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nInstances:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"instances\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/instance-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nInstances:\");\n    console.log(result[\"instances\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/instance-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nInstances:\\n\";\nprint_r($result[\"instances\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#4-ccustom-development","title":"4. CCustom Development","text":"

If the default model weights provided by the general instance segmentation pipeline do not meet your requirements for accuracy or speed in your scenario, you can try to further fine-tune the existing model using data specific to your domain or application scenario to improve the recognition effect of the general instance segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general instance segmentation pipeline includes an instance segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Instance Segmentation Module Development Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: Mask-RT-DETR-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n

Then, refer to the command line method or Python script method in the local experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for instance segmentation pipeline inference, the Python command is:

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device npu:0\n

If you want to use the General Instance Segmentation Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html","title":"General Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#1-introduction-to-general-object-detection-pipeline","title":"1. Introduction to General Object Detection Pipeline","text":"

Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only requires recognizing what objects are present in an image, such as people, cars, and animals, but also accurately determining the specific position of each object within the image, typically represented by rectangular boxes. This technology is widely used in autonomous driving, surveillance systems, smart photo albums, and other fields, relying on deep learning models (e.g., YOLO, Faster R-CNN) that can efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.

ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Object Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Object Detection Pipeline online using the demo images provided by the official source, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Object Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command can quickly experience the effects of the object detection pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

Click to expand \ud83d\udc49
paddlex --get_pipeline_config object_detection\n

After execution, the object detection pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is ./object_detection.yaml, simply execute:

paddlex --pipeline ./object_detection.yaml --input general_object_detection_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_object_detection_002.png', 'boxes': [{'cls_id': 49, 'label': 'orange', 'score': 0.8188097476959229, 'coordinate': [661, 93, 870, 305]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7743489146232605, 'coordinate': [76, 274, 330, 520]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7270504236221313, 'coordinate': [285, 94, 469, 297]}, {'cls_id': 46, 'label': 'banana', 'score': 0.5570532083511353, 'coordinate': [310, 361, 685, 712]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5484835505485535, 'coordinate': [764, 285, 924, 440]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5160726308822632, 'coordinate': [853, 169, 987, 303]}, {'cls_id': 60, 'label': 'dining table', 'score': 0.5142655968666077, 'coordinate': [0, 0, 1072, 720]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5101479291915894, 'coordinate': [57, 23, 213, 176]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#222-integration-via-python-scripts","title":"2.2.2 Integration via Python Scripts","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking General Object Detection as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"object_detection\")\n\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method parameter x is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/object_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/object_detection.yaml\")\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Object Detection pipeline do not meet your requirements for precision or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the General Object Detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Object Detection pipeline includes an object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PicoDet-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the General Object Detection pipeline, the Python command is:

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline object_detection --input general_object_detection_002.png --device npu:0\n
If you want to use the General Object Detection Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#1-introduction-to-pedestrian-attribute-recognition-pipeline","title":"1. Introduction to Pedestrian Attribute Recognition Pipeline","text":"

Pedestrian attribute recognition is a key function in computer vision systems, used to locate and label specific characteristics of pedestrians in images or videos, such as gender, age, clothing color, and style. This task not only requires accurately detecting pedestrians but also identifying detailed attribute information for each pedestrian. The pedestrian attribute recognition pipeline is an end-to-end serial system for locating and recognizing pedestrian attributes, widely used in smart cities, security surveillance, and other fields, significantly enhancing the system's intelligence level and management efficiency.

The pedestrian attribute recognition pipeline includes a pedestrian detection module and a pedestrian attribute recognition module, with several models in each module. Which models to use specifically can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Pedestrian Detection Module:

ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Pedestrian detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Pedestrian Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories.

Note: The above accuracy metrics are mA on PaddleX's internally built dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can quickly demonstrate their effectiveness. You can experience the pedestrian attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the pedestrian attribute recognition pipeline locally, ensure you have completed the installation of the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

You can quickly experience the pedestrian attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the pedestrian attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default pedestrian attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config pedestrian_attribute_recognition\n

After execution, the pedestrian attribute recognition pipeline configuration file will be saved in the current path. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config pedestrian_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./pedestrian_attribute_recognition.yaml, simply execute:

paddlex --pipeline ./pedestrian_attribute_recognition.yaml --input pedestrian_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference of the pipeline. Taking the pedestrian attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"pedestrian_attribute_recognition\")\n\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized image of the result\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the pedestrian attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the pedestrian attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of type dict and supports printing or saving as a file. The supported save types are related to the specific pipeline, such as:

Method Description Method Parameters print Print the results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save the results as a json-formatted file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file name;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save the results as an image file

If you have obtained the configuration file, you can customize various configurations for the pedestrian attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved as ./my_path/pedestrian_attribute_recognition*.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/pedestrian_attribute_recognition.yaml\")\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pedestrian attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pedestrian attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get pedestrian attribute recognition results.

POST /pedestrian-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description pedestrians array Information about the pedestrian's location and attributes. image string The pedestrian attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in pedestrians is an object with the following properties:

Name Type Description bbox array The location of the pedestrian. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The pedestrian attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/pedestrian-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected pedestrians:\")\nprint(result[\"pedestrians\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the pedestrian attribute recognition pipeline includes both a pedestrian attribute recognition module and a pedestrian detection module, the unexpected performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the pedestrian detection model. In this case, you need to refer to the Secondary Development section in the Human Detection Module Development Tutorial and use your private dataset to fine-tune the pedestrian detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Secondary Development section in the Pedestrian Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the pedestrian attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning training with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-YOLOE-L_human\n  cls_model: PP-LCNet_x1_0_pedestrian_attribute  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports multiple mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference in the pedestrian attribute recognition pipeline, the command used is:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device npu:0\n
If you want to use the pedestrian attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html","title":"General Semantic Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#1-introduction-to-the-general-semantic-segmentation-pipeline","title":"1. Introduction to the General Semantic Segmentation Pipeline","text":"

Semantic segmentation is a computer vision technique that aims to assign each pixel in an image to a specific category, enabling a detailed understanding of the image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing regions of the same category to be fully labeled. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, the sky, and roads pixel by pixel, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (such as SegFormer, etc.) to extract features by CNN or Transformer, and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effects of the General Semantic Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Semantic Segmentation Pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Semantic Segmentation Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the semantic segmentation pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n

Parameter Explanation:

--pipeline: The name of the pipeline, here it is the semantic segmentation pipeline\n--input: The local path or URL of the input image to be processed\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs), or choose to use CPU (--device cpu)\n

When executing the above command, the default semantic segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config semantic_segmentation\n

After execution, the semantic segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./semantic_segmentation.yaml, simply execute:

paddlex --pipeline ./semantic_segmentation.yaml --input makassaridn-road_demo.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_object_detection_002.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general semantic segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"semantic_segmentation\")\n\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by calling it. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/semantic_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs semantic segmentation on an image.

POST /semantic-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order). size array Image shape. The elements in the array are the height and width of the image, respectively. image string The semantic segmentation result image. The image is in JPEG format and encoded using Base64.

An example of result is as follows:

{\n\"labelMap\": [\n0,\n0,\n1,\n2\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/semantic-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/semantic-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/semantic-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/semantic-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/semantic-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/semantic-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/semantic-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general semantic segmentation pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general semantic segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general semantic segmentation pipeline includes a semantic segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Semantic Segmentation Module Development Tutorial (GitHub can directly link to headings) and use your private dataset to fine-tune the semantic segmentation model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LiteSeg-T  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for semantic segmentation pipeline inference, the Python command is:

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device npu:0\n
If you want to use the General Semantic Segmentation Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html","title":"Small Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#1-introduction-to-small-object-detection-pipeline","title":"1. Introduction to Small Object Detection Pipeline","text":"

Small object detection is a specialized technique for identifying tiny objects within images, widely applied in fields such as surveillance, autonomous driving, and satellite image analysis. It can accurately locate and classify small-sized objects like pedestrians, traffic signs, or small animals within complex scenes. By leveraging deep learning algorithms and optimized Convolutional Neural Networks (CNNs), small object detection significantly enhances the recognition capabilities for small objects, ensuring no critical information is overlooked in practical applications. This technology plays a pivotal role in enhancing safety and automation levels.

The small object detection pipeline includes a small object detection module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, opt for a model with a smaller storage size.

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 458.521 11172.7 340.5 M

Note: The above accuracy metrics are based on the VisDrone-DET validation set mAP(0.5:0.95). All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the small object detection pipeline's effects through command line or Python locally.

Before using the small object detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the small object detection pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline small_object_detection --input small_object_detection.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the small object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, you can choose to use CPU (--device cpu).\n

When executing the above command, the default small object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config small_object_detection\n

After execution, the small object detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config small_object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file's save path is ./small_object_detection.yaml, simply execute:

paddlex --pipeline ./small_object_detection.yaml --input small_object_detection.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file.```markdown

After running, the result will be:

{'input_path': 'small_object_detection.jpg', 'boxes': [{'cls_id': 3, 'label': 'car', 'score': 0.9243856072425842, 'coordinate': [624, 638, 682, 741]}, {'cls_id': 3, 'label': 'car', 'score': 0.9206348061561584, 'coordinate': [242, 561, 356, 613]}, {'cls_id': 3, 'label': 'car', 'score': 0.9194547533988953, 'coordinate': [670, 367, 705, 400]}, {'cls_id': 3, 'label': 'car', 'score': 0.9162291288375854, 'coordinate': [459, 259, 523, 283]}, {'cls_id': 4, 'label': 'van', 'score': 0.9075379371643066, 'coordinate': [467, 213, 498, 242]}, {'cls_id': 4, 'label': 'van', 'score': 0.9066920876502991, 'coordinate': [547, 351, 577, 397]}, {'cls_id': 3, 'label': 'car', 'score': 0.9041045308113098, 'coordinate': [502, 632, 562, 736]}, {'cls_id': 3, 'label': 'car', 'score': 0.8934890627861023, 'coordinate': [613, 383, 647, 427]}, {'cls_id': 3, 'label': 'car', 'score': 0.8803309202194214, 'coordinate': [640, 280, 671, 309]}, {'cls_id': 3, 'label': 'car', 'score': 0.8727016448974609, 'coordinate': [1199, 256, 1259, 281]}, {'cls_id': 3, 'label': 'car', 'score': 0.8705748915672302, 'coordinate': [534, 410, 570, 461]}, {'cls_id': 3, 'label': 'car', 'score': 0.8654043078422546, 'coordinate': [669, 248, 702, 271]}, {'cls_id': 3, 'label': 'car', 'score': 0.8555219769477844, 'coordinate': [525, 243, 550, 270]}, {'cls_id': 3, 'label': 'car', 'score': 0.8522038459777832, 'coordinate': [526, 220, 553, 243]}, {'cls_id': 3, 'label': 'car', 'score': 0.8392605185508728, 'coordinate': [557, 141, 575, 158]}, {'cls_id': 3, 'label': 'car', 'score': 0.8353804349899292, 'coordinate': [537, 120, 553, 133]}, {'cls_id': 3, 'label': 'car', 'score': 0.8322211503982544, 'coordinate': [585, 132, 603, 147]}, {'cls_id': 3, 'label': 'car', 'score': 0.8298957943916321, 'coordinate': [701, 283, 736, 313]}, {'cls_id': 3, 'label': 'car', 'score': 0.8217393159866333, 'coordinate': [885, 347, 943, 377]}, {'cls_id': 3, 'label': 'car', 'score': 0.820313572883606, 'coordinate': [493, 150, 511, 168]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.8183429837226868, 'coordinate': [203, 701, 224, 743]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.815082848072052, 'coordinate': [185, 710, 201, 744]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7892289757728577, 'coordinate': [311, 371, 344, 407]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7812919020652771, 'coordinate': [345, 380, 388, 405]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7748346328735352, 'coordinate': [295, 500, 309, 532]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7688500285148621, 'coordinate': [851, 436, 863, 466]}, {'cls_id': 3, 'label': 'car', 'score': 0.7466475367546082, 'coordinate': [565, 114, 580, 128]}, {'cls_id': 3, 'label': 'car', 'score': 0.7156463265419006, 'coordinate': [483, 66, 495, 78]}, {'cls_id': 3, 'label': 'car', 'score': 0.704211950302124, 'coordinate': [607, 138, 642, 152]}, {'cls_id': 3, 'label': 'car', 'score': 0.7021926045417786, 'coordinate': [505, 72, 518, 83]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6897469162940979, 'coordinate': [802, 460, 815, 488]}, {'cls_id': 3, 'label': 'car', 'score': 0.671891450881958, 'coordinate': [574, 123, 593, 136]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.6712754368782043, 'coordinate': [445, 317, 472, 334]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6695684790611267, 'coordinate': [479, 309, 489, 332]}, {'cls_id': 3, 'label': 'car', 'score': 0.6273623704910278, 'coordinate': [654, 210, 677, 234]}, {'cls_id': 3, 'label': 'car', 'score': 0.6070230603218079, 'coordinate': [640, 166, 667, 185]}, {'cls_id': 3, 'label': 'car', 'score': 0.6064521670341492, 'coordinate': [461, 59, 476, 71]}, {'cls_id': 3, 'label': 'car', 'score': 0.5860581398010254, 'coordinate': [464, 87, 484, 100]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.5792551636695862, 'coordinate': [390, 390, 419, 408]}, {'cls_id': 3, 'label': 'car', 'score': 0.5559225678443909, 'coordinate': [481, 125, 496, 140]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5531904697418213, 'coordinate': [869, 306, 880, 331]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5468509793281555, 'coordinate': [895, 294, 904, 319]}, {'cls_id': 3, 'label': 'car', 'score': 0.5451828241348267, 'coordinate': [505, 94, 518, 108]}, {'cls_id': 3, 'label': 'car', 'score': 0.5398445725440979, 'coordinate': [657, 188, 681, 208]}, {'cls_id': 4, 'label': 'van', 'score': 0.5318890810012817, 'coordinate': [518, 88, 534, 102]}, {'cls_id': 3, 'label': 'car', 'score': 0.5296525359153748, 'coordinate': [527, 71, 540, 81]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.5168400406837463, 'coordinate': [528, 320, 563, 346]}, {'cls_id': 3, 'label': 'car', 'score': 0.5088561177253723, 'coordinate': [511, 84, 530, 95]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.502006471157074, 'coordinate': [841, 266, 850, 283]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can quickly enable inference on the production line. Taking the General Small Object Detection Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"small_object_detection\")\n\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/small_object_detection, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/small_object_detection.yaml\")\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment directly.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /small-object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/small-object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/small-object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/small-object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/small-object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/small-object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/small-object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/small-object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Small Object Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the small object detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Small Object Detection Pipeline includes a small object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Small Object Detection Module Tutorial and use your private dataset to fine-tune the small object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-YOLOE_plus_SOD-L  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the small object detection pipeline, the Python command would be:

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline multilabel_classification --input small_object_detection.jpg --device npu:0\n

If you want to use the General Small Object Detection Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#1-introduction-to-vehicle-attribute-recognition-pipeline","title":"1. Introduction to Vehicle Attribute Recognition Pipeline","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, and license plate number. This task not only requires accurately detecting vehicles but also identifying detailed attribute information for each vehicle. The vehicle attribute recognition pipeline is an end-to-end serial system for locating and recognizing vehicle attributes, widely used in traffic management, intelligent parking, security surveillance, autonomous driving, and other fields. It significantly enhances system efficiency and intelligence levels, driving the development and innovation of related industries.

The vehicle attribute recognition pipeline includes a vehicle detection module and a vehicle attribute recognition module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Vehicle Detection Module:

ModelModel Download Link mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicleInference Model/Trained Model 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicleInference Model/Trained Model 63.9 32.6 775.6 196.02

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Vehicle Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained models provided by PaddleX can quickly demonstrate results. You can experience the effects of the vehicle attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the vehicle attribute recognition pipeline locally, ensure you have installed the PaddleX wheel package according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#221-experience-via-command-line","title":"2.2.1 Experience via Command Line","text":"

You can quickly experience the vehicle attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the vehicle attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The index of the GPU to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs). You can also choose to use the CPU (--device cpu).\n

When executing the above Python script, the default vehicle attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config vehicle_attribute_recognition\n

After execution, the vehicle attribute recognition pipeline configuration file will be saved in the current directory. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config vehicle_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the saved path of the configuration file is ./vehicle_attribute_recognition.yaml, just execute:

paddlex --pipeline ./vehicle_attribute_recognition.yaml --input vehicle_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#222-integrating-via-python-script","title":"2.2.2 Integrating via Python Script","text":"

A few lines of code suffice for rapid inference on the production line, taking the vehicle attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"vehicle_attribute_recognition\")\n\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized result image\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the vehicle attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the vehicle attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

(4) Processing the Prediction Results: The prediction result for each sample is in dict format, which supports printing or saving to a file. The supported file types for saving depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save results as a json file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save results as an image file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;

If you have obtained the configuration file, you can customize the configurations for the vehicle attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved at ./my_path/vehicle_attribute_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/vehicle_attribute_recognition.yaml\")\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the vehicle attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the vehicle attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get vehicle attribute recognition results.

POST /vehicle-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description vehicles array Information about the vehicle's location and attributes. image string The vehicle attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in vehicles is an object with the following properties:

Name Type Description bbox array The location of the vehicle. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The vehicle attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/vehicle-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected vehicles:\")\nprint(result[\"vehicles\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the vehicle attribute recognition pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the vehicle attribute recognition pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the vehicle attribute recognition pipeline includes both a vehicle attribute recognition module and a vehicle detection module, the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the vehicle detection model. In this case, you need to refer to the Custom Development section in the Vehicle Detection Module Development Tutorial and use your private dataset to fine-tune the vehicle detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Custom Development section in the Vehicle Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the vehicle attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the path to the default model weights with the local path to the fine-tuned model weights:

......\nPipeline:\n  det_model: PP-YOLOE-L_vehicle\n  cls_model: PP-LCNet_x1_0_vehicle_attribute   # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line or Python script methods in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference with the vehicle attribute recognition pipeline, the command is:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device npu:0\n
If you want to use the vehicle attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html","title":"PP-ChatOCRv3-doc Pipeline utorial","text":""},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#1-introduction-to-pp-chatocrv3-doc-pipeline","title":"1. Introduction to PP-ChatOCRv3-doc Pipeline","text":"

PP-ChatOCRv3-doc is a unique intelligent analysis solution for documents and images developed by PaddlePaddle. It combines Large Language Models (LLM) and OCR technology to provide a one-stop solution for complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating with ERNIE Bot, it fuses massive data and knowledge to achieve high accuracy and wide applicability.

The PP-ChatOCRv3-doc pipeline includes modules for Table Structure Recognition, Layout Region Detection, Text Detection, Text Recognition, Seal Text Detection, Text Image Rectification, and Document Image Orientation Classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference speed. If you prioritize model storage size, choose a model with a smaller storage size. Some benchmarks for these models are as follows:

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effect of the Document Scene Information Extraction v3 pipeline online or locally using Python.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effect of the Document Scene Information Extraction v3 pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the PP-ChatOCRv3 pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

A few lines of code are all you need to complete the quick inference of the pipeline. Using the test file, taking the PP-ChatOCRv3-doc pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

After running, the output is as follows:

{'chat_res': {'\u200b\u4e59\u65b9\u200b': '\u200b\u80a1\u4efd\u200b\u6d4b\u8bd5\u200b\u6709\u9650\u516c\u53f8\u200b', '\u200b\u624b\u673a\u53f7\u200b': '19331729920'}, 'prompt': ''}\n

In the above Python script, the following steps are executed:

(1) Call the create_pipeline to instantiate a PP-ChatOCRv3-doc pipeline object, related parameters descriptions are as follows:

Parameter Type Default Description pipeline str None Pipeline name or pipeline configuration file path. If it's a pipeline name, it must be supported by PaddleX; llm_name str \"ernie-3.5\" Large Language Model name, we support ernie-4.0 and ernie-3.5, with more models on the way. llm_params dict {} API configuration; device(kwargs) str/None None Running device, support cpu, gpu, gpu:0, etc. None meaning automatic selection;

(2) Call the visual_predict of the PP-ChatOCRv3-doc pipeline object to visual predict, related parameters descriptions are as follows:

Parameter Type Default Description input Python Var - Support to pass Python variables directly, such as numpy.ndarray representing image data; input str - Support to pass the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg; input str - Support to pass the URL of the file to be predicted, such as: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf; input str - Support to pass the local directory, which should contain files to be predicted, such as: /root/data/; input dict - Support to pass a dictionary, where the key needs to correspond to the specific pipeline, such as: {\"img\": \"/root/data1\"}\uff1b input list - Support to pass a list, where the elements must be of the above types of data, such as: [numpy.ndarray, numpy.ndarray]\uff0c[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]\uff0c[\"/root/data1\", \"/root/data2\"]\uff0c[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]\uff1b use_doc_image_ori_cls_model bool True Whether or not to use the orientation classification model; use_doc_image_unwarp_model bool True Whether or not to use the unwarp model; use_seal_text_det_model bool True Whether or not to use the seal text detection model;

(3) Call the relevant functions of prediction object to save the prediction results. The related functions are as follows:

Function Parameter Description save_to_img save_path Save OCR prediction results, layout results, and table recognition results as image files, with the parameter save_path used to specify the save path; save_to_html save_path Save the table recognition results as an HTML file, with the parameter 'save_path' used to specify the save path; save_to_xlsx save_path Save the table recognition results as an Excel file, with the parameter 'save_path' used to specify the save path;

(4) Call the chat of PP-ChatOCRv3-doc pipeline object to query information with LLM, related parameters are described as follows:

Parameter Type Default Description key_list str - Keywords used to query. A string composed of multiple keywords with \",\" as separators, such as \"Party B, phone number\"; key_list list - Keywords used to query. A list composed of multiple keywords.

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through calls. The predict method predicts data in batches, so the prediction results are represented as a list of prediction results.

(4) Interact with the large model by calling the predict.chat method, which takes as input keywords (multiple keywords are supported) for information extraction. The prediction results are represented as a list of information extraction results.

(5) Process the prediction results: The prediction result for each sample is in the form of a dict, which supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves layout analysis, table recognition, etc. results as image files. save_path: str, the file path to save. save_to_html Saves table recognition results as HTML files. save_path: str, the file path to save. save_to_xlsx Saves table recognition results as Excel files. save_path: str, the file path to save.

When executing the above command, the default Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

paddlex --get_pipeline_config PP-ChatOCRv3-doc\n

After execution, the configuration file for the PP-ChatOCRv3-doc pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n
After obtaining the configuration file, you can customize the various configurations of the PP-ChatOCRv3-doc pipeline:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

In the above configuration, you can modify the models loaded by each module of the pipeline, as well as the large language model used. Please refer to the module documentation for the list of supported models for each module, and the list of supported large language models includes: ernie-4.0, ernie-3.5, ernie-3.5-8k, ernie-lite, ernie-tiny-8k, ernie-speed, ernie-speed-128k, ernie-char-8k.

After making modifications, simply update the pipeline parameter value in the create_pipeline method to the path of your pipeline configuration file to apply the configuration.

For example, if your configuration file is saved at ./my_path/PP-ChatOCRv3-doc.yaml, you would execute:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2 Local Experience.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • analyzeImages

Analyze images using computer vision models to obtain OCR, table recognition results, and extract key information from the images.

POST /chatocr-vision

  • Request body properties:
Name Type Description Required file string The URL of an accessible image file or PDF file, or the Base64 encoded content of the above file types. For PDF files with more than 10 pages, only the first 10 pages will be used. Yes fileType integer File type. 0 represents PDF files, 1 represents image files. If this property is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This feature is enabled by default. No useImgUnwrapping boolean Whether to enable text image correction. This feature is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This feature is enabled by default. No inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description visionResults array Analysis results obtained using the computer vision model. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file in sequence. visionInfo object Key information in the image, which can be used as input for other operations.

Each element in visionResults is an object with the following properties:

Name Type Description texts array Text locations, contents, and scores. tables array Table locations and contents. inputImage string Input image. The image is in JPEG format and encoded in Base64. ocrImage string OCR result image. The image is in JPEG format and encoded in Base64. layoutImage string Layout area detection result image. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text location. The elements in the array are the vertex coordinates of the polygon enclosing the text in sequence. text string Text content. score number Text recognition score.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table location. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box in sequence. html string Table recognition result in HTML format.
  • buildVectorStore

Builds a vector database.

POST /chatocr-vector

  • The request body properties are as follows:
Name Type Description Required visionInfo object Key information from the image. Provided by the analyzeImages operation. Yes minChars integer Minimum data length to enable the vector database. No llmRequestInterval number Interval time for calling the large language model API. No llmName string Name of the large language model. No llmParams object Parameters for the large language model API. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description vectorStore string Serialized result of the vector database, which can be used as input for other operations.
  • retrieveKnowledge

Perform knowledge retrieval.

POST /chatocr-retrieval

  • The request body properties are as follows:
Name Type Description Required keys array List of keywords. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. Yes llmName string Name of the large language model. No llmParams object API parameters for the large language model. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description retrievalResult string The result of knowledge retrieval, which can be used as input for other operations.
  • chat

Interact with large language models to extract key information.

POST /chatocr-chat

  • Request body properties:
Name Type Description Required keys array List of keywords. Yes visionInfo object Key information from images. Provided by the analyzeImages operation. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. No retrievalResult string Results of knowledge retrieval. Provided by the retrieveKnowledge operation. No taskDescription string Task prompt. No rules string Custom extraction rules, e.g., for output formatting. No fewShot string Example prompts. No llmName string Name of the large language model. No llmParams object API parameters for the large language model. No returnPrompts boolean Whether to return the prompts used. Enabled by default. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • On successful request processing, the result in the response body has the following properties:
Name Type Description chatResult object Extracted key information. prompts object Prompts used.

Properties of prompts:

Name Type Description ocr string OCR prompt. table string Table prompt. html string HTML prompt. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\nAPI_KEY = \"{Qianfan Platform API key}\"\nSECRET_KEY = \"{Qianfan Platform secret key}\"\nLLM_NAME = \"ernie-3.5\"\nLLM_PARAMS = {\n    \"apiType\": \"qianfan\",\n    \"apiKey\": API_KEY,\n    \"secretKey\": SECRET_KEY,\n}\n\nfile_path = \"./demo.jpg\"\nkeys = [\"\u200b\u7535\u8bdd\u200b\"]\n\nwith open(file_path, \"rb\") as file:\n    file_bytes = file.read()\n    file_data = base64.b64encode(file_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": file_data,\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\nresp_vision = requests.post(url=f\"{API_BASE_URL}/chatocr-vision\", json=payload)\nif resp_vision.status_code != 200:\n    print(\n        f\"Request to chatocr-vision failed with status code {resp_vision.status_code}.\"\n    )\n    pprint.pp(resp_vision.json())\n    sys.exit(1)\nresult_vision = resp_vision.json()[\"result\"]\n\nfor i, res in enumerate(result_vision[\"visionResults\"]):\n    print(\"Texts:\")\n    pprint.pp(res[\"texts\"])\n    print(\"Tables:\")\n    pprint.pp(res[\"tables\"])\n    ocr_img_path = f\"ocr_{i}.jpg\"\n    with open(ocr_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"ocrImage\"]))\n    layout_img_path = f\"layout_{i}.jpg\"\n    with open(layout_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"layoutImage\"]))\n    print(f\"Output images saved at {ocr_img_path} and {layout_img_path}\")\n\npayload = {\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"minChars\": 200,\n    \"llmRequestInterval\": 1000,\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_vector = requests.post(url=f\"{API_BASE_URL}/chatocr-vector\", json=payload)\nif resp_vector.status_code != 200:\n    print(\n        f\"Request to chatocr-vector failed with status code {resp_vector.status_code}.\"\n    )\n    pprint.pp(resp_vector.json())\n    sys.exit(1)\nresult_vector = resp_vector.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_retrieval = requests.post(url=f\"{API_BASE_URL}/chatocr-retrieval\", json=payload)\nif resp_retrieval.status_code != 200:\n    print(\n        f\"Request to chatocr-retrieval failed with status code {resp_retrieval.status_code}.\"\n    )\n    pprint.pp(resp_retrieval.json())\n    sys.exit(1)\nresult_retrieval = resp_retrieval.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"retrievalResult\": result_retrieval[\"retrievalResult\"],\n    \"taskDescription\": \"\",\n    \"rules\": \"\",\n    \"fewShot\": \"\",\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n    \"returnPrompts\": True,\n}\nresp_chat = requests.post(url=f\"{API_BASE_URL}/chatocr-chat\", json=payload)\nif resp_chat.status_code != 200:\n    print(\n        f\"Request to chatocr-chat failed with status code {resp_chat.status_code}.\"\n    )\n    pprint.pp(resp_chat.json())\n    sys.exit(1)\nresult_chat = resp_chat.json()[\"result\"]\nprint(\"\\nPrompts:\")\npprint.pp(result_chat[\"prompts\"])\nprint(\"Final result:\")\nprint(result_chat[\"chatResult\"])\n
Note: Please fill in your API key and secret key at `API_KEY` and `SECRET_KEY`.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the PP-ChatOCRv3-doc Pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can attempt to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the PP-ChatOCRv3-doc Pipeline comprises six modules, unsatisfactory performance may stem from any of these modules (note that the text image rectification module does not support customization at this time).

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., row/column misidentification, cell position errors) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.

  • Misplaced layout elements (e.g., incorrect positioning of tables or seals) may suggest issues with the layout detection module. Consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.

  • Frequent undetected text (i.e., text leakage) may indicate limitations in the text detection model. Refer to the Customization section in the Text Detection Module Development Tutorial and fine-tune the text detection model using your private dataset.

  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest that the text recognition model requires improvement. Follow the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.

  • Frequent recognition errors in detected seal text indicate that the seal text detection model needs further refinement. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.

  • Frequent misidentifications of document or certificate orientations with text regions suggest that the document image orientation classification model requires improvement. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the document image orientation classification model.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#42-model-deployment","title":"4.2 Model Deployment","text":"

After fine-tuning your models using your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the default model weights with those of your fine-tuned models:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_3cls  # Replace with the local path of your fine-tuned model\n  table_model: SLANet_plus  # Replace with the local path of your fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Replace with the local path of your fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Replace with the local path of your fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det  # Replace with the local path of your fine-tuned model\n  doc_image_ori_cls_model: null   # Replace with the local path of your fine-tuned model if applicable\n  doc_image_unwarp_model: null   # Replace with the local path of your fine-tuned model if applicable\n......\n

Subsequently, load the modified pipeline configuration file using the command-line interface or Python script as described in the local experience section.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Seamless switching between different hardware can be achieved by simply setting the --device parameter.

For example, to perform inference using the PP-ChatOCRv3-doc Pipeline on an NVIDIA GPU. At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the script to npu:

from paddlex import create_pipeline\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"},\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n

If you want to use the PP-ChatOCRv3-doc Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html","title":"General OCR Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#1-introduction-to-ocr-pipeline","title":"1. Introduction to OCR Pipeline","text":"

OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols.

The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, reaching state-of-the-art (SOTA) performance in open-source projects for general scenarios. Based on this project, developers from academia, industry, and research have rapidly deployed various OCR applications across fields such as general use, manufacturing, finance, transportation, and more.

The General OCR Pipeline comprises a text detection module and a text recognition module, each containing several models. The specific models to use can be selected based on the benchmark data provided below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model size, choose models with smaller storage requirements.

Text detection module:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices

Text recognition module:

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the OCR Pipeline, allowing you to quickly experience its effects. You can try the General OCR Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General OCR Pipeline online using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. You can download the deployment package from the cloud or use the local experience method in Section 2.2. If not satisfied, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General OCR Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"
  • Experience the OCR Pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter explanations:

--pipeline: The name of the pipeline, here it is OCR.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default OCR Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config OCR\n

After execution, the OCR Pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path --device gpu:0\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./OCR.yaml, simply execute:

paddlex --pipeline ./OCR.yaml --input general_ocr_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [[[5, 12], [88, 10], [88, 29], [5, 31]], [[208, 14], [249, 14], [249, 22], [208, 22]], [[695, 15], [824, 15], [824, 60], [695, 60]], [[158, 27], [355, 23], [356, 70], [159, 73]], [[421, 25], [659, 19], [660, 59], [422, 64]], [[337, 104], [460, 102], [460, 127], [337, 129]], [[486, 103], [650, 100], [650, 125], [486, 128]], [[675, 98], [835, 94], [835, 119], [675, 124]], [[64, 114], [192, 110], [192, 131], [64, 134]], [[210, 108], [318, 106], [318, 128], [210, 130]], [[82, 140], [214, 138], [214, 163], [82, 165]], [[226, 136], [328, 136], [328, 161], [226, 161]], [[404, 134], [432, 134], [432, 161], [404, 161]], [[509, 131], [570, 131], [570, 158], [509, 158]], [[730, 138], [771, 138], [771, 154], [730, 154]], [[806, 136], [817, 136], [817, 146], [806, 146]], [[342, 175], [470, 173], [470, 197], [342, 199]], [[486, 173], [616, 171], [616, 196], [486, 198]], [[677, 169], [813, 166], [813, 191], [677, 194]], [[65, 181], [170, 177], [171, 202], [66, 205]], [[96, 208], [171, 205], [172, 230], [97, 232]], [[336, 220], [476, 215], [476, 237], [336, 242]], [[507, 217], [554, 217], [554, 236], [507, 236]], [[87, 229], [204, 227], [204, 251], [87, 254]], [[344, 240], [483, 236], [483, 258], [344, 262]], [[66, 252], [174, 249], [174, 271], [66, 273]], [[75, 279], [264, 272], [265, 297], [76, 303]], [[459, 297], [581, 295], [581, 320], [459, 322]], [[101, 314], [210, 311], [210, 337], [101, 339]], [[68, 344], [165, 340], [166, 365], [69, 368]], [[345, 350], [662, 346], [662, 368], [345, 371]], [[100, 459], [832, 444], [832, 465], [100, 480]]], 'dt_scores': [0.8183103704439653, 0.7609575621092027, 0.8662357274035412, 0.8619508290334809, 0.8495855993183273, 0.8676840017933314, 0.8807986687956436, 0.822308525056085, 0.8686617037621976, 0.8279022169854463, 0.952332847006758, 0.8742692553015098, 0.8477013022907575, 0.8528771493227294, 0.7622965906848765, 0.8492388224448705, 0.8344203789965632, 0.8078477124353284, 0.6300434587457232, 0.8359967356998494, 0.7618617265751318, 0.9481573079350023, 0.8712182945408912, 0.837416955846334, 0.8292475059403851, 0.7860382856406026, 0.7350527486717117, 0.8701022267947695, 0.87172526903969, 0.8779847108088126, 0.7020437651809734, 0.6611684983372949], 'rec_text': ['www.997', '151', 'PASS', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', '\u200b\u8231\u4f4d\u200b CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200bSEATNO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200bDATE', 'MU 2379', '03DEC', 'W', '035', 'F', '1', '\u200b\u59cb\u53d1\u5730\u200bFROM', '\u200b\u767b\u673a\u53e3\u200b GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO.', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO.', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE1OMINUTESBEFOREDEPARTURETIME'], 'rec_score': [0.9617719054222107, 0.4199012815952301, 0.9652514457702637, 0.9978302121162415, 0.9853208661079407, 0.9445787072181702, 0.9714463949203491, 0.9841841459274292, 0.9564052224159241, 0.9959094524383545, 0.9386572241783142, 0.9825271368026733, 0.9356589317321777, 0.9985442161560059, 0.3965512812137604, 0.15236201882362366, 0.9976775050163269, 0.9547433257102966, 0.9974752068519592, 0.9646636843681335, 0.9907559156417847, 0.9895358681678772, 0.9374122023582458, 0.9909093379974365, 0.9796401262283325, 0.9899340271949768, 0.992210865020752, 0.9478569626808167, 0.9982215762138367, 0.9924325942993164, 0.9941263794898987, 0.96443772315979]}\n......\n

Among them, dt_polys is the detected text box coordinates, dt_polys is the detected text box coordinates, dt_scores is the confidence of the detected text box, rec_text is the detected text, rec_score is the detection Confidence in the text.

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"
  • Quickly perform inference on the production line with just a few lines of code, taking the general OCR production line as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the OCR production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the OCR production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/OCR.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/OCR.yaml\")\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the general OCR pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain OCR results from an image.

POST /ocr

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. image string OCR result image with detected text positions annotated. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score.

Example of result:

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"Beijing South Railway Station\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"Tianjin Railway Station\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general OCR pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general OCR pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general OCR pipeline consists of two modules (text detection and text recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many texts are undetected (i.e., text miss detection), it may indicate that the text detection model needs improvement. You should refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model. If many recognition errors occur in detected texts (i.e., the recognized text content does not match the actual text content), it suggests that the text recognition model requires further refinement. You should refer to the Customization section in the Text Recognition Module Development Tutorial and fine-tune the text recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be replaced with the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be replaced with the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n

Then, refer to the command line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for OCR pipeline inference, the Python command would be:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline OCR --input general_ocr_002.png --device npu:0\n

If you want to use the General OCR pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html","title":"Formula Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#1-introduction-to-the-formula-recognition-pipeline","title":"1. Introduction to the Formula Recognition Pipeline","text":"

Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. Leveraging computer vision and machine learning algorithms, formula recognition converts complex mathematical formula information into editable LaTeX format, facilitating further data processing and analysis for users.

The Formula Recognition Pipeline comprises a layout detection module and a formula recognition module.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

Layout Detection Module Models:

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.126 3827.25 470.2M

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout detection dataset, containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the formula recognition pipeline through command line or Python locally.

Before using the formula recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the formula recognition pipeline with a single command, using the test file, and replace --input with your local path for prediction:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n

Parameter Explanation:

--pipeline: The pipeline name, which is formula_recognition for this case.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, use CPU (--device cpu).\n

When executing the above command, the default formula recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config formula_recognition\n

After execution, the formula recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config formula_recognition --save_path ./my_path\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./formula_recognition.yaml, simply execute:

paddlex --pipeline ./formula_recognition.yaml --input general_formula_recognition.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After execution, the result is:

\ud83d\udc49Click to Expand
{'input_path': 'general_formula_recognition.png', 'layout_result': {'input_path': 'general_formula_recognition.png', 'boxes': [{'cls_id': 3, 'label': 'number', 'score': 0.7580855488777161, 'coordinate': [1028.3635, 205.46213, 1038.953, 222.99033]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.8882032632827759, 'coordinate': [272.75305, 204.50894, 433.7473, 226.17996]}, {'cls_id': 2, 'label': 'text', 'score': 0.9685840606689453, 'coordinate': [272.75928, 282.17773, 1041.9316, 374.44687]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559416770935059, 'coordinate': [272.39056, 385.54114, 1044.1521, 443.8598]}, {'cls_id': 2, 'label': 'text', 'score': 0.9610629081726074, 'coordinate': [272.40817, 467.2738, 1045.1033, 563.4855]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8916195034980774, 'coordinate': [503.45743, 594.6236, 1040.6804, 619.73895]}, {'cls_id': 2, 'label': 'text', 'score': 0.973675549030304, 'coordinate': [272.32007, 648.8599, 1040.8702, 775.15686]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9038916230201721, 'coordinate': [554.2307, 803.5825, 1040.4657, 855.3159]}, {'cls_id': 2, 'label': 'text', 'score': 0.9025381803512573, 'coordinate': [272.535, 875.1402, 573.1086, 898.3587]}, {'cls_id': 2, 'label': 'text', 'score': 0.8336610794067383, 'coordinate': [317.48013, 909.60864, 966.8498, 933.7868]}, {'cls_id': 2, 'label': 'text', 'score': 0.8779091238975525, 'coordinate': [19.704018, 653.322, 72.433235, 1215.1992]}, {'cls_id': 2, 'label': 'text', 'score': 0.8832409977912903, 'coordinate': [272.13028, 958.50806, 1039.7928, 1019.476]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9088466167449951, 'coordinate': [517.1226, 1042.3978, 1040.2208, 1095.7457]}, {'cls_id': 2, 'label': 'text', 'score': 0.9587949514389038, 'coordinate': [272.03336, 1112.9269, 1041.0201, 1206.8417]}, {'cls_id': 2, 'label': 'text', 'score': 0.8885666131973267, 'coordinate': [271.7495, 1231.8752, 710.44495, 1255.7981]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8907185196876526, 'coordinate': [581.2295, 1287.4525, 1039.8014, 1312.772]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559596180915833, 'coordinate': [273.1827, 1341.421, 1041.0299, 1401.7255]}, {'cls_id': 2, 'label': 'text', 'score': 0.875311553478241, 'coordinate': [272.8338, 1427.3711, 789.7108, 1451.1359]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9152213931083679, 'coordinate': [524.9582, 1474.8136, 1041.6333, 1530.7142]}, {'cls_id': 2, 'label': 'text', 'score': 0.9584835767745972, 'coordinate': [272.81665, 1549.524, 1042.9962, 1608.7157]}]}, 'ocr_result': {}, 'table_result': [], 'dt_polys': [array([[ 503.45743,  594.6236 ],\n       [1040.6804 ,  594.6236 ],\n       [1040.6804 ,  619.73895],\n       [ 503.45743,  619.73895]], dtype=float32), array([[ 554.2307,  803.5825],\n       [1040.4657,  803.5825],\n       [1040.4657,  855.3159],\n       [ 554.2307,  855.3159]], dtype=float32), array([[ 517.1226, 1042.3978],\n       [1040.2208, 1042.3978],\n       [1040.2208, 1095.7457],\n       [ 517.1226, 1095.7457]], dtype=float32), array([[ 581.2295, 1287.4525],\n       [1039.8014, 1287.4525],\n       [1039.8014, 1312.772 ],\n       [ 581.2295, 1312.772 ]], dtype=float32), array([[ 524.9582, 1474.8136],\n       [1041.6333, 1474.8136],\n       [1041.6333, 1530.7142],\n       [ 524.9582, 1530.7142]], dtype=float32)], 'rec_formula': ['F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)', 'p(\\mathbf{x})=c(\\mathbf{u})\\prod_{i}p(x_{i}).\\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\quad~~\\quad~~~~~~~~~~~~~~~(2)', 'H_{c}({\\bf x})=-\\int_{{\\bf{u}}}c({\\bf{u}})\\log c({\\bf{u}})d{\\bf{u}}.~~~~~~~~~~~~~~~~~~~~~(3)', 'I({\\bf x})=-H_{c}({\\bf x}).\\qquad\\qquad\\qquad\\qquad(4)', 'H({\\bf x})=\\sum_{i}H(x_{i})+H_{c}({\\bf x}).\\eqno\\qquad\\qquad\\qquad(5)']}\n

Where dt_polys represents the coordinates of the detected formula area, and rec_formula is the detected formula.

The visualization result is as follows:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path. Formula recognition visualization requires a separate environment configuration. Please refer to 2.3 Formula Recognition Pipeline Visualization to install the LaTeX rendering engine.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"
  • Quickly perform inference on the pipeline with just a few lines of code, taking the formula recognition pipeline as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the formula recognition pipeline object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the formula recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the formula recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/formula_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/formula_recognition.yaml\")\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#23-formula-recognition-pipeline-visualization","title":"2.3 Formula Recognition Pipeline Visualization","text":"

If you need to visualize the formula recognition pipeline, you need to run the following command to install the LaTeX rendering environment:

apt-get install sudo\nsudo apt-get update\nsudo apt-get install texlive\nsudo apt-get install texlive-latex-base\nsudo apt-get install texlive-latex-extra\n
After that, use the save_to_img method to save the visualization image. The specific command is as follows:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
Note: Since the formula recognition visualization process requires rendering each formula image, it may take a relatively long time. Please be patient.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the formula recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the formula recognition pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain formula recognition results from an image.

POST /formula-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the layout detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description formulas array Positions and contents of formulas. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in formulas is an object with the following properties:

Name Type Description poly array Formula position. Elements in the array are the vertex coordinates of the polygon enclosing the formula. latex string Formula content.

Example of result:

{\n\"formulas\": [\n{\n\"poly\": [\n[\n444.0,\n244.0\n],\n[\n705.4,\n244.5\n],\n[\n705.8,\n311.3\n],\n[\n444.1,\n311.0\n]\n],\n\"latex\": \"F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)\"\n}\n],\n\"layoutImage\": \"xxxxxx\",\n\"ocrImage\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/formula-recognition\"\nimage_path = \"./demo.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected formulas:\")\nprint(result[\"formulas\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/formula-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto formulas = result[\"formulas\"];\n        std::cout << \"\\nDetected formulas:\" << std::endl;\n        for (const auto& formula : formulas) {\n            std::cout << formula << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/formula-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode formulas = result.get(\"formulas\");\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected formulas: \" + formulas.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/formula-recognition\"\n    imagePath := \"./demo.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            LayoutImage      string   `json:\"layoutImage\"`\n            Formulas []map[string]interface{} `json:\"formulas\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected formulas:\")\n    for _, formula := range respData.Result.Formulas {\n        fmt.Println(formula)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/formula-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected formulas:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"formulas\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/formula-recognition'\nconst imagePath = './demo.jpg'\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected formulas:\");\n    console.log(result[\"formulas\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/formula-recognition\"\n$image_path = \"./demo.jpg\";\n$layout_image_path = \"./layout.jpg\"\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected formulas:\\n\";\nprint_r($result[\"formulas\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the formula recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the formula recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the formula recognition pipeline consists of two modules (layout detection and formula recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many formula are undetected (i.e., formula miss detection), it may indicate that the layout detection model needs improvement. You should refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model. If many recognition errors occur in detected formula (i.e., the recognized formula content does not match the actual formula content), it suggests that the formula recognition model requires further refinement. You should refer to the Customization section in the Formula Recognition Module Development Tutorial and fine-tune the formula recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_17cls # Can be replaced with the local path of the fine-tuned layout detection model\n  formula_rec_model: LaTeX_OCR_rec # Can be replaced with the local path of the fine-tuned formula recognition model\n  formula_rec_batch_size: 5\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in 2. Quick Start to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for formula pipeline inference, the Python command would be:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device npu:0\n

If you want to use the formula recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html","title":"General Layout Parsing Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#1-introduction-to-the-general-layout-parsing-pipeline","title":"1. Introduction to the General Layout Parsing Pipeline","text":"

Layout parsing is a technology that extracts structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has extensive applications in document management, information extraction, and data digitization. By combining Optical Character Recognition (OCR), image processing, and machine learning algorithms, layout parsing can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. The process typically involves three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data to improve data processing efficiency and accuracy.

The General Layout Parsing Pipeline includes modules for table structure recognition, layout region analysis, text detection, text recognition, formula recognition, seal text detection, text image rectification, and document image orientation classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effect of the General Image Classification pipeline online, or locally using command line or Python.

Before using the General Layout Parsing pipeline locally, please ensure you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

One command is all you need to quickly experience the effect of the Layout Parsing pipeline. Use the test file and replace --input with your local path to make predictions.

paddlex --pipeline layout_parsing --input demo_paper.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the Layout Parsing pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default Layout Parsing pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config layout_parsing\n

After execution, the layout parsing pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config layout_parsing --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it take effect. For example, if the configuration file is saved as ./layout_parsing.yaml, simply execute:

paddlex --pipeline ./layout_parsing.yaml --input layout_parsing.jpg\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

\ud83d\udc49Click to expand
{'input_path': PosixPath('/root/.paddlex/temp/tmp5jmloefs.png'), 'parsing_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmpshsq8_w0.png'), 'layout_bbox': [51.46833, 74.22329, 542.4082, 232.77504], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [213, 221, 238],\n        [217, 223, 240],\n        [233, 234, 241]],\n\n       [[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpcd2q9uyu.png'), 'layout_bbox': [47.68295, 243.08054, 546.28253, 295.71045], 'figure_title': 'Overview of RT-DETR, We feed th', 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpr_iqa8b3.png'), 'layout_bbox': [58.416977, 304.1531, 275.9134, 400.07513], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmphpblxl3p.png'), 'layout_bbox': [100.62961, 405.97458, 234.79774, 414.77414], 'figure_title': 'Figure 5. The fusion block in CCFF.', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmplgnczrsf.png'), 'layout_bbox': [47.81724, 421.9041, 288.01566, 550.538], 'text': 'D, Ds, not only significantly reduces latency (35% faster),\\nRut\\nnproves accuracy (0.4% AP higher), CCFF is opti\\nased on the cross-scale fusion module, which\\nnsisting of convolutional lavers intc\\npath.\\nThe role of the fusion block is t\\n into a new feature, and its\\nFigure 5. The f\\nblock contains tw\\n1 x1\\nchannels, /V RepBlock\\n. anc\\n: two-path outputs are fused by element-wise add. We\\ntormulate the calculation ot the hvbrid encoder as:', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpsq0ey9md.png'), 'layout_bbox': [94.60716, 558.703, 288.04193, 600.19434], 'formula': '\\\\begin{array}{l}{{\\\\Theta=K=\\\\mathrm{p.s.sp{\\\\pm}}\\\\mathrm{i.s.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}}),{\\\\qquad\\\\mathrm{{a.s.}}\\\\mathrm{s.}}}\\\\\\\\ {{\\\\tau_{\\\\mathrm{{s.s.s.s.s.}}(\\\\mathrm{l.s.},\\\\mathrm{l.s.},\\\\mathrm{s.s.}}\\\\mathrm{s.}\\\\mathrm{s.}}\\\\end{array}),}}\\\\\\\\ {{\\\\bar{\\\\mathrm{e-c.c.s.s.}(\\\\mathrm{s.},\\\\mathrm{s.s.},\\\\ s_{s}}\\\\mathrm{s.s.},\\\\tau),}}\\\\end{array}', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpv30qy0v4.png'), 'layout_bbox': [47.975555, 607.12024, 288.5776, 629.1252], 'text': 'tened feature to the same shape as Ss.\\nwhere Re shape represents restoring the shape of the flat-', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp0jejzwwv.png'), 'layout_bbox': [48.383354, 637.581, 245.96404, 648.20496], 'paragraph_title': '4.3. Uncertainty-minimal Query Selection', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpushex416.png'), 'layout_bbox': [47.80134, 656.002, 288.50192, 713.24994], 'text': 'To reduce the difficulty of optimizing object queries in\\nDETR, several subsequent works [42, 44, 45] propose query\\nselection schemes, which have in common that they use the\\nconfidence score to select the top K\u2019 features from the en-\\ncoder to initialize object queries (or just position queries).', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpki7e_6wc.png'), 'layout_bbox': [306.6371, 302.1026, 546.3772, 419.76724], 'text': 'The confidence score represents the likelihood that the fea\\nture includes foreground objects. Nevertheless, the \\nare required to simultaneously model the category\\nojects, both of which determine the quality of the\\npertor\\ncore of the fes\\nBased on the analysis, the current query\\n considerable level of uncertainty in the\\nresulting in sub-optimal initialization for\\nand hindering the performance of the detector.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmppbxrfehp.png'), 'layout_bbox': [306.0642, 422.7347, 546.9216, 539.45734], 'text': 'To address this problem, we propose the uncertainty mini\\nmal query selection scheme, which explicitly const\\noptim\\n the epistemic uncertainty to model the\\nfeatures, thereby providing \\nhigh-quality\\nr the decoder. Specifically,\\n the discrepancy between i\\nalization P\\nand classificat\\n.(2\\ntunction for the gradie', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp1mgiyd21.png'), 'layout_bbox': [331.52808, 549.32635, 546.5229, 586.15546], 'formula': '\\\\begin{array}{c c c}{{}}&{{}}&{{\\\\begin{array}{c}{{i\\\\langle X\\\\rangle=({\\\\bar{Y}}({\\\\bar{X}})+{\\\\bar{Z}}({\\\\bar{X}})\\\\mid X\\\\in{\\\\bar{\\\\pi}}^{\\\\prime}}}&{{}}\\\\\\\\ {{}}&{{}}&{{}}\\\\end{array}}}&{{\\\\emptyset}}\\\\\\\\ {{}}&{{}}&{{C(\\\\bar{X},{\\\\bar{X}})=C..\\\\scriptstyle(\\\\bar{0},{\\\\bar{Y}})+{\\\\mathcal{L}}_{{\\\\mathrm{s}}}({\\\\bar{X}}),\\\\ 6)}}&{{}}\\\\end{array}', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp8t73dpym.png'), 'layout_bbox': [306.44016, 592.8762, 546.84314, 630.60126], 'text': 'where  and y denote the prediction and ground truth,\\n= (c, b), c and b represent the category and bounding\\nbox respectively, X represent the encoder feature.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpftnxeyjm.png'), 'layout_bbox': [306.15652, 632.3142, 546.2463, 713.19073], 'text': 'Effectiveness analysis. To analyze the effectiveness of the\\nuncertainty-minimal query selection, we visualize the clas-\\nsificatior\\nscores and IoU scores of the selected fe\\nCOCO\\na 12017, Figure 6. We draw the scatterplo\\nt with\\ndots\\nrepresent the selected features from the model trained\\nwith uncertainty-minimal query selection and vanilla query', 'layout': 'right'}]}\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking the general layout parsing pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"layout_parsing\")\n\noutput = pipeline.predict(\"demo_paper.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result as an image file\n    res.save_to_xlsx(\"./output/\")  # Save the result as an Excel file\n    res.save_to_html(\"./output/\")  # Save the result as an HTML file\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, e.g., [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving as files, with the supported file types depending on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves the result as an image file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name. save_to_html Saves the result as an HTML file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

| save_to_xlsx | Saves the result as an Excel file. | - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

Within this tutorial on Artificial Intelligence and Computer Vision, we will explore the capabilities of saving and exporting results from various processes, including OCR (Optical Character Recognition), layout analysis, and table structure recognition. Specifically, the save_to_img function enables saving visualization results, save_to_html converts tables directly into HTML files, and save_to_xlsx exports tables as Excel files.

Upon obtaining the configuration file, you can customize various settings for the layout parsing pipeline by simply modifying the pipeline parameter within the create_pipeline method to point to your configuration file path.

For instance, if your configuration file is saved at ./my_path/layout_parsing.yaml, you can execute the following code:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/layout_parsing.yaml\")\noutput = pipeline.predict(\"layout_parsing.jpg\")\nfor res in output:\n    res.print()  # Prints the structured output of the layout parsing prediction\n    res.save_to_img(\"./output/\")  # Saves the img format results from each submodule of the pipeline\n    res.save_to_xlsx(\"./output/\")  # Saves the xlsx format results from the table recognition module\n    res.save_to_html(\"./output/\")  # Saves the html results from the table recognition module\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements in terms of inference speed and accuracy, you can proceed with development integration or deployment.

To directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX offers three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In production environments, many applications require stringent performance metrics, especially response speed, to ensure efficient operation and smooth user experience. PaddleX provides a high-performance inference plugin that deeply optimizes model inference and pre/post-processing for significant end-to-end speedups. For detailed instructions on high-performance inference, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service Deployment: Service deployment is a common form in production environments, where reasoning functions are encapsulated as services accessible via network requests. PaddleX enables cost-effective service deployment of pipelines. For detailed instructions on service deployment, refer to the PaddleX Service Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body attributes are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result attribute, of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body attributes are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs layout parsing.

POST /layout-parsing

  • Request body attributes:
Name Type Description Required file string The URL of an image file or PDF file accessible by the service, or the Base64 encoded result of the content of the above-mentioned file types. For PDF files with more than 10 pages, only the content of the first 10 pages will be used. Yes fileType integer File type. 0 indicates a PDF file, 1 indicates an image file. If this attribute is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This function is enabled by default. No useImgUnwrapping boolean Whether to enable text image rectification. This function is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This function is enabled by default. No inferenceParams object Inference parameters. No

Attributes of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following attributes:
Name Type Description layoutParsingResults array Layout parsing results. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file.

Each element in layoutParsingResults is an object with the following attributes:

Name Type Description layoutElements array Layout element information.

Each element in layoutElements is an object with the following attributes:

Name Type Description bbox array Position of the layout element. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. label string Label of the layout element. text string Text contained in the layout element. layoutType string Arrangement of the layout element. image string Image of the layout element, in JPEG format, encoded using Base64. Multi-language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/layout-parsing\" # \u200b\u670d\u52a1\u200bURL\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": image_data, # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u6587\u4ef6\u200bURL\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(\"\\nDetected layout elements:\")\nfor res in result[\"layoutParsingResults\"]:\n    for ele in res[\"layoutElements\"]:\n        print(\"===============================\")\n        print(\"bbox:\", ele[\"bbox\"])\n        print(\"label:\", ele[\"label\"])\n        print(\"text:\", repr(ele[\"text\"]))\n

\ud83d\udcf1 Edge Deployment: Edge deployment refers to placing computational and data processing capabilities directly on user devices, enabling them to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general layout parsing pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general layout parsing pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general layout parsing pipeline consists of 7 modules, unsatisfactory performance may stem from any of these modules.

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., wrong row/column recognition, incorrect cell positions) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.
  • Misplaced layout elements (e.g., incorrect positioning of tables, seals) may suggest issues with the layout detection module. You should consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.
  • Frequent undetected texts (i.e., text missing detection) indicate potential weaknesses in the text detection model. Follow the Customization section in the Text Detection Module Development Tutorial to fine-tune the text detection model using your private dataset.
  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest further improvements to the text recognition model. Refer to the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.
  • Frequent recognition errors in detected seal texts indicate the need for improvements to the seal text detection model. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.
  • High recognition errors in detected formulas (i.e., recognized formula content does not match the actual formula) suggest further enhancements to the formula recognition model. Follow the Customization section in the Formula Recognition Module Development Tutorial to fine-tune the formula recognition model.
  • Frequent misclassifications of document or certificate orientations with text areas indicate the need for improvements to the document image orientation classification model. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the model.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet_plus  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned model\n  formula_rec_model: LaTeX_OCR_rec  # Can be modified to the local path of the fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det   # Can be modified to the local path of the fine-tuned model\n  doc_image_unwarp_model: UVDoc  # Can be modified to the local path of the fine-tuned model\n  doc_image_ori_cls_model: PP-LCNet_x1_0_doc_ori  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script methods in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the layout parsing pipeline, the Python command is:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, simply modify --device to npu in the Python command:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device npu:0\n
If you want to use the general layout parsing pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html","title":"Seal Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#1-introduction-to-the-seal-recognition-pipeline","title":"1. Introduction to the Seal Recognition Pipeline","text":"

Seal recognition is a technology that automatically extracts and recognizes seal content from documents or images. The recognition of seal is part of document processing and has various applications in many scenarios, such as contract comparison, inventory access approval, and invoice reimbursement approval.

The Seal Recognition pipeline includes a layout area analysis module, a seal detection module, and a text recognition module.

If you prioritize model accuracy, please choose a model with higher accuracy. If you prioritize inference speed, please choose a model with faster inference. If you prioritize model storage size, please choose a model with a smaller storage footprint.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

Model NameModel Download Link Average Recognition Accuracy (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy indicators is a self-built Chinese dataset from PaddleOCR, covering various scenarios such as street scenes, web images, documents, and handwriting. The text recognition subset includes 11,000 images. The GPU inference time for all models above is based on an NVIDIA Tesla T4 machine with a precision type of FP32. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads, and the precision type is also FP32.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre trained model production line provided by PaddleX can quickly experience the effect. You can experience the effect of the seal recognition production line online, or use the command line or Python locally to experience the effect of the seal recognition production line.

Before using the seal recognition production line locally, please ensure that you have completed the wheel package installation of PaddleX according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#21-command-line-experience","title":"2.1 Command line experience","text":"

One command can quickly experience the effect of seal recognition production line, use test file, and replace --input with the local path for prediction

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

Parameter description:

--Pipeline: Production line name, here is the seal recognition production line\n--Input: The local path or URL of the input image to be processed\n--The GPU serial number used by the device (e.g. GPU: 0 indicates the use of the 0th GPU, GPU: 1,2 indicates the use of the 1st and 2nd GPUs), or the CPU (-- device CPU) can be selected for use\n

When executing the above Python script, the default seal recognition production line configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config seal_recognition\n

After execution, the seal recognition production line configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config seal_recognition --save_path ./my_path --save_path output\n

After obtaining the production line configuration file, you can replace '-- pipeline' with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is / seal_recognition.yaml\uff0c Just need to execute:

paddlex --pipeline ./seal_recognition.yaml --input seal_text_det.png --save_path output\n

Among them, parameters such as --model and --device do not need to be specified and will use the parameters in the configuration file. If the parameters are still specified, the specified parameters will prevail.

After running, the result obtained is:

\ud83d\udc49 Click to expand
{'input_path': 'seal_text_det.png', 'layout_result': {'input_path': 'seal_text_det.png', 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9813116192817688, 'coordinate': [0, 5.2238655, 639.59766, 637.6985]}]}, 'ocr_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmp19fn93y5.png'), 'dt_polys': [array([[468, 469],\n       [472, 469],\n       [477, 471],\n       [507, 501],\n       [509, 505],\n       [509, 509],\n       [508, 513],\n       [506, 514],\n       [456, 553],\n       [454, 555],\n       [391, 581],\n       [388, 581],\n       [309, 590],\n       [306, 590],\n       [234, 577],\n       [232, 577],\n       [172, 548],\n       [170, 546],\n       [121, 504],\n       [118, 501],\n       [118, 496],\n       [119, 492],\n       [121, 490],\n       [152, 463],\n       [156, 461],\n       [160, 461],\n       [164, 463],\n       [202, 495],\n       [252, 518],\n       [311, 530],\n       [371, 522],\n       [425, 501],\n       [464, 471]]), array([[442, 439],\n       [445, 442],\n       [447, 447],\n       [449, 490],\n       [448, 494],\n       [446, 497],\n       [440, 499],\n       [197, 500],\n       [193, 499],\n       [190, 496],\n       [188, 491],\n       [188, 448],\n       [189, 444],\n       [192, 441],\n       [197, 439],\n       [438, 438]]), array([[465, 341],\n       [470, 344],\n       [472, 346],\n       [476, 356],\n       [476, 419],\n       [475, 424],\n       [472, 428],\n       [467, 431],\n       [462, 433],\n       [175, 434],\n       [170, 433],\n       [166, 430],\n       [163, 426],\n       [161, 420],\n       [161, 354],\n       [162, 349],\n       [165, 345],\n       [170, 342],\n       [175, 340],\n       [460, 340]]), array([[326,  34],\n       [481,  85],\n       [485,  88],\n       [488,  90],\n       [584, 220],\n       [586, 225],\n       [587, 229],\n       [589, 378],\n       [588, 383],\n       [585, 388],\n       [581, 391],\n       [576, 393],\n       [570, 392],\n       [507, 373],\n       [502, 371],\n       [498, 367],\n       [496, 359],\n       [494, 255],\n       [423, 162],\n       [322, 129],\n       [246, 151],\n       [205, 169],\n       [144, 252],\n       [139, 360],\n       [137, 365],\n       [134, 369],\n       [128, 373],\n       [ 66, 391],\n       [ 61, 392],\n       [ 56, 390],\n       [ 51, 387],\n       [ 48, 382],\n       [ 47, 377],\n       [ 49, 230],\n       [ 50, 225],\n       [ 52, 221],\n       [149,  89],\n       [153,  86],\n       [157,  84],\n       [318,  34],\n       [322,  33]])], 'dt_scores': [0.9943362380813267, 0.9994290391836306, 0.9945320407374245, 0.9908104427126033], 'rec_text': ['5263647368706', '\u200b\u5417\u200b\u7e41\u7269\u200b', '\u200b\u53d1\u7968\u200b\u4e13\u7528\u7ae0\u200b', '\u200b\u5929\u6d25\u200b\u541b\u548c\u7f18\u200b\u5546\u8d38\u200b\u6709\u9650\u516c\u53f8\u200b'], 'rec_score': [0.9921098351478577, 0.997374951839447, 0.9999369382858276, 0.9901710152626038]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code can complete the fast inference of the production line. Taking the seal recognition production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"seal_recognition\")\n\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\") # Save the results in img\n

The result obtained is the same as the command line method.

In the above Python script, the following steps were executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images).

If you have a configuration file, you can customize the configurations of the seal recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved in / my_path/seal_recognition.yaml \uff0c Then only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/seal_recognition.yaml\")\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#3-development-integrationdeployment","title":"3. Development integration/deployment","text":"

If the production line can meet your requirements for inference speed and accuracy, you can directly develop integration/deployment.

If you need to directly apply the production line to your Python project, you can refer to the example code in [2.2.2 Python scripting] (# 222 python scripting integration).

In addition, PaddleX also offers three other deployment methods, detailed as follows:

\ud83d\ude80 ** High performance deployment: In actual production environments, many applications have strict standards for the performance indicators of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deep performance optimization of model inference and pre-processing, achieving significant acceleration of end-to-end processes. For a detailed high-performance deployment process, please refer to the [PaddleX High Performance Deployment Guide] (../../../pipelin_deploy/high_performance_deploy. md).

\u2601\ufe0f ** Service deployment * *: Service deployment is a common form of deployment in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users to achieve service-oriented deployment of production lines at low cost. For detailed service-oriented deployment processes, please refer to the PaddleX Service Deployment Guide (../../../ipeline_deploy/service_deploy. md).

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Obtain seal recognition results from an image.

POST /seal-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/seal-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/seal-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/seal-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/seal-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/seal-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/seal-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/seal-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#4-secondary-development","title":"4. Secondary development","text":"

If the default model weights provided by the seal recognition production line are not satisfactory in terms of accuracy or speed in your scenario, you can try using your own specific domain or application scenario data to further fine tune the existing model to improve the recognition performance of the seal recognition production line in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#41-model-fine-tuning","title":"4.1 Model fine-tuning","text":"

Due to the fact that the seal recognition production line consists of three modules, the performance of the model production line may not be as expected due to any of these modules.

You can analyze images with poor recognition performance and refer to the following rules for analysis and model fine-tuning:

  • If the seal area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If there is a significant amount of text that has not been detected (i.e. text miss detection phenomenon), it may be due to the shortcomings of the text detection model. You need to refer to the Secondary Development section in the Seal Text Detection Module Development Tutorial to fine tune the text detection model using your private dataset.
  • If seal texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.

  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After completing fine-tuning training using a private dataset, you can obtain a local model weight file.

If you need to use the fine tuned model weights, simply modify the production line configuration file and replace the local path of the fine tuned model weights with the corresponding position in the production line configuration file

......\n Pipeline:\n  layout_model: RT-DETR-H_layout_3cls #can be modified to the local path of the fine tuned model\n  text_det_model: PP-OCRv4_server_seal_det  #can be modified to the local path of the fine tuned model\n  text_rec_model: PP-OCRv4_server_rec #can be modified to the local path of the fine tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#5-multiple-hardware-support","title":"5. Multiple hardware support","text":"

PaddleX supports various mainstream hardware devices such as Nvidia GPU, Kunlun Core XPU, Ascend NPU, and Cambrian MLU, and can seamlessly switch between different hardware devices by simply modifying the --device parameter.

For example, if you use Nvidia GPU for inference on a seal recognition production line, the Python command you use is:

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

At this point, if you want to switch the hardware to Ascend NPU, simply modify the --device in the Python command to NPU:

paddlex --pipeline seal_recognition --input seal_text_det.png --device npu:0 --save_path output\n

If you want to use the seal recognition production line on a wider range of hardware, please refer to the PaddleX Multi Hardware Usage Guide\u3002

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html","title":"General Table Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#1-introduction-to-the-general-table-recognition-pipeline","title":"1. Introduction to the General Table Recognition Pipeline","text":"

Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis for users.

The General Table Recognition Pipeline comprises modules for table structure recognition, layout analysis, text detection, and text recognition.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

\ud83d\udc49Model List Details

Table Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are measured on PaddleX's internal self-built English table recognition dataset. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout analysis dataset containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

Model NameModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.2 M PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 100.1M"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Image Classification pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Table Recognition pipeline by using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Table Recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the effects of the table recognition pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the table recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the 1st and 2nd GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default table recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config table_recognition\n

After execution, the table recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config table_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./table_recognition.yaml, simply execute:

paddlex --pipeline ./table_recognition.yaml --input table_recognition.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file. If they are still specified, the specified parameters will take precedence.

After running, the result is:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference with the pipeline. Taking the General Table Recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"table_recognition\")\n\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the results in img format\n    res.save_to_xlsx(\"./output/\")  # Save the results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
The results are the same as those obtained through the command line.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_html Save the results as an html format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_xlsx Save the results as a spreadsheet format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images, table structure recognition result images), save_to_html can directly save the table as an html file (including text and table formatting), and save_to_xlsx can save the table as an Excel format file (including text and formatting).

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/table_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/table_recognition.yaml\")\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save results in img format\n    res.save_to_xlsx(\"./output/\")  # Save results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Locate and recognize tables in images.

POST /table-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description tables array Positions and contents of tables. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table position. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. html string Table recognition result in HTML format. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/table-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected tables:\")\nprint(result[\"tables\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/table-recognition\", headers, body, \"application/json\");\n\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedlayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto tables = result[\"tables\"];\n        std::cout << \"\\nDetected tables:\" << std::endl;\n        for (const auto& table : tables) {\n            std::cout << table << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/table-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode tables = result.get(\"tables\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected tables: \" + tables.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/table-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Tables []map[string]interface{} `json:\"tables\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected tables:\")\n    for _, table := range respData.Result.Tables {\n        fmt.Println(table)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/table-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected tables:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"tables\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/table-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected tables:\");\n    console.log(result[\"tables\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/table-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected tables:\\n\";\nprint_r($result[\"tables\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general table recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general table recognition pipeline consists of four modules, unsatisfactory performance may stem from any of these modules.

Analyze images with poor recognition results and follow the rules below for analysis and model fine-tuning:

  • If the detected table structure is incorrect (e.g., row and column recognition errors, incorrect cell positions), the table structure recognition module may be insufficient. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and use your private dataset to fine-tune the table structure recognition model.
  • If the table area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If many texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.
  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_mobile_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_mobile_rec  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script method in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for table recognition pipeline inference, the Python command is:

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
At this time, if you want to switch the hardware to Ascend NPU, simply modify --device in the Python command to npu:

paddlex --pipeline table_recognition --input table_recognition.jpg --device npu:0\n
If you want to use the general table recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#1-introduction-to-the-general-time-series-anomaly-detection-pipeline","title":"1. Introduction to the General Time Series Anomaly Detection Pipeline","text":"

Time series anomaly detection is a technique for identifying abnormal patterns or behaviors in time series data. It is widely applied in fields such as network security, equipment monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly deviate from expected behaviors, such as sudden spikes in network traffic or unusual transaction activities. Time series anomaly detection enable automatic identification of anomalies in data. This technology provides real-time alerts for enterprises and organizations, helping them promptly address potential risks and issues. It plays a crucial role in ensuring system stability and security.

The General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module. If you prioritize model accuracy, choose a model with higher precision. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage footprint.

Model NameModel Download Link Precision Recall F1-Score Model Storage Size (M) AutoEncoder_adInference Model/Trained Model 99.36 84.36 91.25 52K DLinear_adInference Model/Trained Model 98.98 93.96 96.41 112K Nonstationary_adInference Model/Trained Model 98.55 88.95 93.51 1.8M PatchTST_adInference Model/Trained Model 98.78 90.70 94.57 320K TimesNet_adInference Model/Trained Model 98.37 94.80 96.56 1.3M

Note: The above precision metrics are measured on the PSM dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Anomaly Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Anomaly Detection Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online experience of time series tasks are only model solutions for a specific scenario and are not universal. They are not applicable to other scenarios. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Anomaly Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the effects of the time series anomaly detection pipeline:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_ad --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_ad.yaml --input ts_ad.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'ts_ad.csv', 'anomaly':            label\ntimestamp\n220226         0\n220227         0\n220228         0\n220229         0\n220230         0\n...          ...\n220317         1\n220318         1\n220319         1\n220320         1\n220321         0\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general time series anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_ad\")\n\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the result in CSV format\n

The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_csv Saves results as a csv file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_xlsx Saves results as table file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_ad.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_ad.yaml\")\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs time-series anomaly detection.

POST /time-series-anomaly-detection

  • Attributes of the request body:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string Time-series anomaly detection results in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-anomaly-detection\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-anomaly-detection\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-anomaly-detection'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Anomaly Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Modules Development Tutorial to fine-tune the time series anomaly detection model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear_ad  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the time series anomaly detection pipeline, the Python command is:

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_ad --input ts_ad.csv --device npu:0\n
If you want to use the General Time-Series Anomaly Detection Pipeline on more diverse hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html","title":"Time Series Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#1-introduction-to-general-time-series-classification-pipeline","title":"1. Introduction to General Time Series Classification Pipeline","text":"

Time series classification is a technique that categorizes time-series data into predefined classes, widely applied in fields such as behavior recognition and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, for example, classifying a speech signal as \"greeting\" or \"request,\" or categorizing stock price movements as \"rising\" or \"falling.\" Time series classification typically employs machine learning and deep learning models, effectively capturing temporal dependencies and variation patterns to provide accurate classification labels for data. This technology plays a pivotal role in applications such as intelligent monitoring and market forecasting.

The General Time Series Classification Pipeline includes a Time Series Classification module.

Model NameModel Download Link Acc(%) Model Size (M) TimesNet_clsInference Model/Trained Model 87.5 792K

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Time Series Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Classification Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in model for online experience of time series tasks is only a model solution for a specific scenario and is not a general solution applicable to other scenarios. Therefore, the experience method does not support using arbitrary files to experience the effect of the official model solution. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the effects of the time series classification pipeline quickly with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series classification pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default time series classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_yaml ts_cls\n

After execution, the time series classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config ts_cls --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_cls.yaml --input ts_cls.csv --device gpu:0\n

In this command, parameters such as --model and --device are not required to be specified, as they will use the parameters defined in the configuration file. If these parameters are specified, the specified values will take precedence.

After execution, the result is:

{'input_path': 'ts_cls.csv', 'classification':         classid     score\nsample\n0             0  0.617688}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete rapid inference for production lines. Taking the General Time Series Classification Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_cls\")\n\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n

The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference. Available only if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_cls.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_cls.yaml\")\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Classify time-series data.

POST /time-series-classification

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description label string Class label. score number Class score.

An example of result is as follows:

{\n\"label\": \"running\",\n\"score\": 0.97\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-classification\"\ncsv_path = \"./test.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(f\"label: {result['label']}, score: {result['score']}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n        std::cout << \"label: \" << result[\"label\"] << \", score: \" << result[\"score\"] << std::endl;\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-classification\";\n        String csvPath = \"./test.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                System.out.println(\"label: \" + result.get(\"label\").asText() + \", score: \" + result.get(\"score\").asText());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-classification\"\n    csvPath := \"./test.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Label string `json:\"label\"`\n            Score string `json:\"score\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    fmt.Printf(\"label: %s, score: %s\\n\", respData.Result.Label, respData.Result.Score)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-classification\";\n    static readonly string csvPath = \"./test.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csveBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csveBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string label = jsonResponse[\"result\"][\"label\"].ToString();\n        string score = jsonResponse[\"result\"][\"score\"].ToString();\n        Console.WriteLine($\"label: {label}, score: {score}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-classification'\nconst csvPath = \"./test.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    console.log(`label: ${result[\"label\"]}, score: ${result[\"score\"]}`);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-classification\";\n$csv_path = \"./test.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\necho \"label: \" . $result[\"label\"] . \", score: \" . $result[\"score\"];\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures. Choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Classification Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Classification Pipeline includes a time series classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Classification Module Tutorial to fine-tune the time series classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: TimesNet_cls  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for time series classification pipeline inference, the Python command is:

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command as follows:\n\n```bash\npaddlex --pipeline ts_cls --input ts_cls.csv --device npu:0\n

If you intend to use the General Time Series Classification Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html","title":"Time Series Forecasting Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#1-introduction-to-the-general-time-series-forecasting-pipeline","title":"1. Introduction to the General Time Series Forecasting Pipeline","text":"

Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing the patterns of change in time series data. It is widely applied in fields such as financial markets, weather forecasting, and sales prediction. Time series forecasting often employs statistical methods or deep learning models (e.g., LSTM, ARIMA), capable of handling temporal dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in various industries, including energy management, supply chain optimization, and market analysis.

The General Time Series Forecasting Pipeline includes a time series forecasting module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link MSE MAE Model Storage Size (M) DLinearInference Model/Trained Model 0.382 0.394 72K NLinearInference Model/Trained Model 0.386 0.392 40K NonstationaryInference Model/Trained Model 0.600 0.515 55.5 M PatchTSTInference Model/Trained Model 0.385 0.397 2.0M RLinearInference Model/Trained Model 0.384 0.392 40K TiDEInference Model/Trained Model 0.405 0.412 31.7M TimesNetInference Model/Trained Model 0.417 0.431 4.9M

Note: The above accuracy metrics are measured on ETTH1. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Forecasting Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Time Series Forecasting Pipeline online using the demo provided by the official team, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online time series tasks are scenario-specific and not universal. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model with your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Forecasting Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the time series forecasting pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series forecasting pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_fc --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_fc.yaml, simply execute:

paddlex --pipeline ./ts_fc.yaml --input ts_fc.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'ts_fc.csv', 'forecast':                            OT\ndate\n2018-06-26 20:00:00  9.586131\n2018-06-26 21:00:00  9.379762\n2018-06-26 22:00:00  9.252275\n2018-06-26 23:00:00  9.249993\n2018-06-27 00:00:00  9.164998\n...                       ...\n2018-06-30 15:00:00  8.830340\n2018-06-30 16:00:00  9.291553\n2018-06-30 17:00:00  9.097666\n2018-06-30 18:00:00  8.905430\n2018-06-30 19:00:00  8.993793\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the production line. Taking the general time series prediction production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_fc\")\n\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the results in CSV format\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the production line supports high-performance inference. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_fc.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_fc.yaml\")\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Performs time-series forecasting.

POST /time-series-forecasting

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string The time-series forecasting result in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-forecasting\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-forecasting\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-forecasting\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-forecasting\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-forecasting\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-forecasting'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-forecasting\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Forecasting Pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Forecasting Pipeline includes a time series forecasting module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Forecasting Module Development Tutorial and use your private dataset to fine-tune the time series forecasting model.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 0\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the time series forecasting pipeline, the Python command would be:

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_fc --input ts_fc.csv --device npu:0\n
If you want to use the General Time Series Forecasting Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html","title":"Anomaly detection tutorial","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#paddlex-30","title":"PaddleX 3.0 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4ee5\u4e0b\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u98df\u54c1\u200b\u699b\u5b50\u200b\u5916\u89c2\u200b\u5f02\u5e38\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08\u200b\u94c1\u4e1d\u7f51\u200b \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 1 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b STFPM 96.2 - - 21.5 M STFPM.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b **MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002**

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 391\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 70\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff1a-o Train.epochs_iters=5000\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 4000\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 1\u3002
  2. \u200b\u57fa\u4e8e\u200b STFPM \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.01\uff0c0.1\uff0c0.4\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.4\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\u5230\u200b5000\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u8fbe\u5230\u200b\u66f4\u4f18\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 4000 0.01 1 4\u200b\u5361\u200b 0.9646 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 4000 0.1 1 4\u200b\u5361\u200b 0.9707 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 5000 0.4 1 4\u200b\u5361\u200b 0.9826

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200buad_hazelnut.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/anomaly_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200boutput/best_model/inference\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html","title":"Anomaly detection tutorial en","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#paddlex-30-image-anomaly-detection-pipeline-food-appearance-quality-inspection-tutorial","title":"PaddleX 3.0 Image Anomaly Detection Pipeline \u2014 Food Appearance Quality Inspection Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a Food Appearance Quality Inspection task.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For Food Appearance Quality Inspection, this falls under the category of anomaly detection tasks, corresponding to PaddleX's Image Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers 1 ways to experience the pipeline: one is through the PaddleX wheel package locally.

  • Local Experience:
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 1 end-to-end anomaly detection models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) yaml file STFPM 96.2 - - 21.5 M STFPM.yaml

Note: The above accuracy metrics are measured on the MVTec AD dataset.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Food Appearance Quality Inspection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX anomaly detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 391;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 70;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 4000 and the batch size at 1.
  2. Initiate three experiments based on the STFPM model, with learning rates of: 0.01, 0.1, 0.4.
  3. It can be observed that the configuration with the highest accuracy in Experiment 3 is a learning rate of 0.4. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 5000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 4000 0.01 1 4 0.9646 Experiment 2 4000 0.1 1 4 0.9707 Experiment 3 4000 0.4 1 4 0.9797

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 3 4000 0.4 1 4 0.9797 Experiment 3 with more epochs 5000 0.4 1 4 0.9826

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

The prediction results will be generated under ./output, where the prediction result for uad_hazelnut.png is shown below:

"},{"location":"en/practical_tutorials/anomaly_detection_tutorial_en.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the anomaly detection pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/anomaly_detection.yaml configuration file to your own model path output/best_model/inference:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to Anomaly Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/deployment_tutorial.html","title":"PaddleX 3.0 Pipeline Deployment Tutorial","text":"

Before using this tutorial, you need to install PaddleX. For installation instructions, please refer to the PaddleX Installation guide.

The three deployment methods of PaddleX are detailed below:

  • High-Performance Inference: In actual production environments, many applications have stringent performance standards for deployment strategies, especially in terms of response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.
  • Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment in pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  • Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

This tutorial will introduce the three deployment methods of PaddleX through three practical application examples.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#1-high-performance-inference-example","title":"1 High-Performance Inference Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#11-obtain-serial-number-and-activation","title":"1.1 Obtain Serial Number and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Community page, select \"Get Now\" in the \"Consultation and Acquisition of Serial Numbers for Open Source Pipeline Deployment\" section, as shown in the figure below:

Select the pipeline you need to deploy and click \"Get\". Afterward, you can find the obtained serial number in the \"Serial Number Management for Open Source Pipeline Deployment SDK\" section below:

After using the serial number to complete activation, you can use the high-performance inference plugin. PaddleX provides both offline and online activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and activate online, allowing the program to complete activation automatically.
  • Offline Activation: Follow the instructions on the serial number management interface (click \"Offline Activation\" in \"Operations\") to obtain the device fingerprint of the machine and bind the serial number with the device fingerprint to obtain a certificate for activation. To use this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI. Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#12-install-high-performance-inference-plugin","title":"1.2 Install High-Performance Inference Plugin","text":"

Find the corresponding installation command in the table below based on processor architecture, operating system, device type, Python version, and other information, and execute it in the deployment environment:

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU (CUDA 11.8 + cuDNN 8.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • When the device type is GPU, please use the installation command corresponding to the CUDA and cuDNN versions that match your environment; otherwise, the high-performance inference plugin will not function properly.
  • For Linux systems, use Bash to execute the installation command.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

Before enabling high-performance plugins, ensure that the LD_LIBRARY_PATH in the current environment does not specify the shared library directory of TensorRT, as the plugins already integrate TensorRT to avoid conflicts caused by different TensorRT versions that may prevent the plugins from functioning properly.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate online, specify --update_license when using the serial number for the first time, taking the General OCR pipeline as an example:

paddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to activate online\npaddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --update_license \\\n    --serial_number {serial_number}\n

For the PaddleX Python API, the method to enable the high-performance inference plugin is similar. Again, taking the General OCR pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"OCR\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": xxx}\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \")\n

The inference results obtained with the high-performance inference plugin are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent initializations to improve speed.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#14-inference-steps","title":"1.4 Inference Steps","text":"

This inference process is based on PaddleX CLI, online activation of serial numbers, Python 3.10.0, and using a CPU device with the high-performance inference plugin. For other usage methods (such as different Python versions, device types, or PaddleX Python API), refer to the PaddleX High-Performance Inference Guide to replace the corresponding commands.

# Install the high-performance inference plugin\ncurl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310\n# Ensure that the `LD_LIBRARY_PATH` in the current environment does not specify the shared library directory of TensorRT. You can use the following command to remove it or manually remove it.\nexport LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\\n' | grep -v TensorRT | tr '\\n' ':' | sed 's/:*$//')\n# Perform inference\npaddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

Output:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#15-changing-pipelines-or-models","title":"1.5 Changing Pipelines or Models","text":"
  • Changing Pipelines:

If you want to use a different pipeline with the high-performance inference plugin, simply replace the value passed to --pipeline. Here is an example using the General Object Detection pipeline:

paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n
  • Changing Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to use other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./OCR.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to use another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./object_detection.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The operations for other pipelines are similar to those for the above two pipelines. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#2-service-deployment-example","title":"2 Service Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#21-installing-the-service-deployment-plugin","title":"2.1 Installing the Service Deployment Plugin","text":"

Execute the following command to install the service deployment plugin:

paddlex --install serving\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#22-starting-the-service","title":"2.2 Starting the Service","text":"

Start the service through the PaddleX CLI with the command format:

paddlex --serve --pipeline {Pipeline name or pipeline configuration file path} [{Other command-line options}]\n

Taking the General OCR pipeline as an example:

paddlex --serve --pipeline OCR\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or a local pipeline configuration file path. PaddleX constructs the pipeline based on this and deploys it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General OCR Pipeline Tutorial.

The command-line options related to service deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Default is cpu (if GPU is not available) or gpu (if GPU is available). --host Hostname or IP address bound to the server. Default is 0.0.0.0. --port Port number listened to by the server. Default is 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Please note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Performs online activation if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/practical_tutorials/deployment_tutorial.html#23-calling-the-service","title":"2.3 Calling the Service","text":"

Here, only the Python calling example is shown. For API references and service calling examples in other languages, please refer to the \"Calling the Service\" section in the \"Development Integration/Deployment\" part of each pipeline usage tutorial in the PaddleX Serving Deployment Guide.

import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image in Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64-encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#24-deployment-steps","title":"2.4 Deployment Steps","text":"
# Install the service deployment plugin\npaddlex --install serving\n# Start the service\npaddlex --serve --pipeline OCR\n# Call the service | The code in fast_test.py is a Python calling example from the previous section\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

Running Results:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#25-change-pipelines-or-models","title":"2.5 Change Pipelines or Models","text":"
  • Change Pipelines:

If you want to deploy another pipeline for service, simply replace the value passed to --pipeline. The following example uses the General Object Detection pipeline:

paddlex --serve --pipeline object_detection\n
  • Change Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to switch to other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the OCR pipeline configuration file and save it as ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./OCR.yaml\n# 4. Call the service\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to switch to another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the object detection pipeline configuration file and save it as ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./object_detection.yaml\n# 4. Call the service | fast_test.py needs to be replaced with the Python calling example from the General Object Detection Pipeline Tutorial\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The operations for other pipelines are similar to the above two. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#3-edge-deployment-example","title":"3 Edge Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#31-environment-preparation","title":"3.1 Environment Preparation","text":"
  1. Install the CMake compilation tool locally and download the required version of the NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK website.

    Environment Requirements - CMake >= 3.10 (the minimum version is not verified, but 3.20 and above are recommended) - Android NDK >= r17c (the minimum version is not verified, but r20b and above are recommended)

    Testing Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Find Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install the ADB tool on your computer for debugging. The ADB installation methods are as follows:

    3.1. Install ADB on Mac

     brew cask install android-platform-tools\n

    3.2. Install ADB on Linux

     # Installation method for Debian-based Linux distributions\n sudo apt update\n sudo apt install -y wget adb\n\n # Installation method for Red Hat-based Linux distributions\n sudo yum install adb\n

    3.3. Install ADB on Windows

    To install on Windows, go to Google's Android platform to download the ADB software package for installation: Link

    Open the terminal, connect the phone to the computer, and enter in the terminal

     adb devices\n

    If there is a device output, it indicates successful installation.

     List of devices attached\n 744be294    device\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#32-material-preparation","title":"3.2 Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified extraction directory, switch to the specified extraction directory, and execute the extraction command.

    # 1. Switch to the specified extraction directory\ncd PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo\n\n# 2. Execute the extraction command\nunzip ocr.zip\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#33-deployment-steps","title":"3.3 Deployment Steps","text":"
  1. Switch the working directory to PaddleX-Lite-Deploy/libs, run the download.sh script to download the required Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX-Lite-Deploy/ocr/assets, run the download.sh script to download the model files optimized by the paddle_lite_opt tool.

  3. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the build.sh script to complete the compilation of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the run.sh script to complete the inference on the edge side.

Notes: - Before running the build.sh script, you need to change the path specified by NDK_ROOT to the actual installed NDK path. - You can execute the deployment steps using Git Bash on a Windows system. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to windows. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to darwin. - Maintain an ADB connection when running the run.sh script. - The download.sh and run.sh scripts support passing parameters to specify models. If not specified, the PP-OCRv4_mobile model is used by default. Currently, two models are supported: - PP-OCRv3_mobile - PP-OCRv4_mobile

Here are examples of actual operations:

# 1. Download the required Paddle Lite prediction library\ncd PaddleX-Lite-Deploy/libs\nsh download.sh\n\n# 2. Download the model files optimized by the paddle_lite_opt tool\ncd ../ocr/assets\nsh download.sh PP-OCRv4_mobile\n\n# 3. Complete the compilation of the executable file\ncd ../android/shell/ppocr_demo\nsh build.sh\n\n# 4. Inference\nsh run.sh PP-OCRv4_mobile\n

Detection Results:

Recognition Results:

The detection visualized image saved in ./test_img_result.jpg\n0       Pure Nutrition Hair Conditioner  0.993706\n1       Product Information/Parameters   0.991224\n2       (45 yuan/kg, minimum order 100 kg)    0.938893\n3       Each bottle 22 yuan, minimum order 1000 bottles)  0.988353\n4       [Brand]: OEM/ODM Manufacturing   0.97557\n5       [Product Name]: Pure Nutrition Hair Conditioner  0.986914\n6       OEM/ODM  0.929891\n7       [Product Number]: YM-X-3011 0.964156\n8       [Net Content]: 220ml      0.976404\n9       [Suitable for]: All skin types  0.987942\n10      [Main Ingredients]: Cetyl Stearyl Alcohol, Oat \u03b2-Glucan,  0.968315\n11      Cocoamide Propyl Betaine, Panthenol    0.941537\n12      (Finished Product Packaging)    0.974796\n13      [Main Function]: Can tighten the hair\u200b\u9cde\u7247\u200b, achieving  0.988799\n14      immediate and lasting improvement in hair gloss, providing sufficient nourishment to dry hair  0.989547\n15      [Main Function Continued]: Nourishment    0.998413\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Paper and Literature Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Document information extraction is a part of document processing with widespread applications in numerous scenarios, such as academic research, library management, scientific and technological intelligence analysis, and literature review writing. Through document information extraction technology, we can automatically extract key information from academic papers, including titles, authors, abstracts, keywords, publication years, journal names, citation information, and more, and store this information in a structured format for easy subsequent retrieval, analysis, and application. This not only enhances the work efficiency of researchers but also provides strong support for the in-depth development of academic research.

Firstly, it is necessary to select the corresponding PaddleX pipeline based on the task scenario. This section takes information extraction from academic papers as an example to introduce how to conduct secondary development for tasks related to the Document Scene Information Extraction v3 pipeline, which corresponds to the Document Scene Information Extraction v3 in PaddleX. If you are unsure about the correspondence between tasks and pipelines, you can refer to the capability introductions of related pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpfnss9sq9_layout.jpg.\nThe result has been saved in output/tmpfnss9sq9_ocr.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\n\n{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u56fe\u8868\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of layout area detection, OCR, table recognition, as well as the table results in HTML and XLSX formats, are saved.

Among them, the visualization of the layout area detection results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. Due to the current limitation of the official model, which only distinguishes among figures, tables, and seals, it is currently unable to accurately locate and extract other information such as headers and table titles. The results for these in {'chat_res': {'header': 'unknown', 'table caption': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of academic papers. Utilizing a dataset of academic paper documents, with the extraction of header and chart title information as examples, the layout analysis model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract header and table title information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Paper Document File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 4 end-to-end layout detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1x 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3cls 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17cls 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3cls 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17cls 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3cls 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17cls 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Academic paper literature Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/paperlayout.tar -P ./dataset\ntar -xf ./dataset/paperlayout.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/paperlayout/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 4734,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/train_4612.jpg\",\n      \"check_dataset\\/demo_img\\/train_4844.jpg\",\n      \"check_dataset\\/demo_img\\/train_0084.jpg\",\n      \"check_dataset\\/demo_img\\/train_0448.jpg\",\n      \"check_dataset\\/demo_img\\/train_4703.jpg\",\n      \"check_dataset\\/demo_img\\/train_3572.jpg\",\n      \"check_dataset\\/demo_img\\/train_4516.jpg\",\n      \"check_dataset\\/demo_img\\/train_2836.jpg\",\n      \"check_dataset\\/demo_img\\/train_1353.jpg\",\n      \"check_dataset\\/demo_img\\/train_0225.jpg\"\n    ],\n    \"val_samples\": 928,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/val_0982.jpg\",\n      \"check_dataset\\/demo_img\\/val_0607.jpg\",\n      \"check_dataset\\/demo_img\\/val_0623.jpg\",\n      \"check_dataset\\/demo_img\\/val_0890.jpg\",\n      \"check_dataset\\/demo_img\\/val_0036.jpg\",\n      \"check_dataset\\/demo_img\\/val_0654.jpg\",\n      \"check_dataset\\/demo_img\\/val_0895.jpg\",\n      \"check_dataset\\/demo_img\\/val_0059.jpg\",\n      \"check_dataset\\/demo_img\\/val_0142.jpg\",\n      \"check_dataset\\/demo_img\\/val_0088.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/paperlayout\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 4734;
  • attributes.val_samples: The number of validation set samples in this dataset is 928;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/paperlayout\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate four experiments based on the RT-DETR-H_layout_3cls model, with learning rates of: 0.001\uff0c0.0005\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 50 and 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate mAP@@0.50:0.95 1 0.00001 88.90 2 0.0001 92.41 3 0.0005 92.27 4 0.001 90.66

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [2, 4, 5] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate mAP@@0.50:0.95 2 30 92.41 4 50 92.63 5 100 92.88

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#54-model-inference","title":"5.4 Model Inference","text":"

You can test the fine-tuned single model using test file

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\"\n

By following the above steps, prediction results can be generated under the ./output directory. The layout prediction result for test.jpg is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the academic paper literature test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.layout_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: ./output/best_model/inference\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'header': '\u200b\u7b2c\u200b43\u200b\u5377\u200b\\n \u200b\u822a\u7a7a\u200b\u53d1\u52a8\u673a\u200b\\n 44', 'table caption': '\u200b\u8868\u200b1\u200b\u6a21\u62df\u200b\u6765\u6d41\u200bMa=5\u200b\u98de\u884c\u200b\u7684\u200b\u7a7a\u6c14\u200b\u52a0\u70ed\u5668\u200b\u5de5\u4f5c\u200b\u53c2\u6570\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the layout is as follows, with the correctly added ability to locate the areas of headers and table titles:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Seal Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Seal information extraction is a part of document processing and has applications in many scenarios, such as contract comparison, inventory review, and invoice reimbursement review. Using artificial intelligence technology for automatic seal recognition can effectively save labor costs and improve efficiency for enterprises.

Firstly, it is necessary to select the corresponding PaddleX production line based on the task scenario. This section is about the seal information extraction task, and it is not difficult to find that the seal information extraction task is closely related to the document scenario information extraction task. Document scene information extraction, which extracts text information from documents or images, is a classic problem in the field of computer vision. Corresponding to PaddleX's document scene information extraction v3 production line. If you are unable to determine the correspondence between tasks and production lines, you can learn about the capabilities of the relevant production lines in PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpx5tmgsem_curve_0.jpg.\nThe result has been saved in output/tmpx5tmgsem_layout.jpg.\nThe result has been saved in output/tmpx5tmgsem_ocr.jpg.\nThe retrieved vectorstore is not for PaddleX and will return vectorstore directly\n\n{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of seal_recognition and OCR (if table exits, table recognition, as well as the table results in HTML and XLSX formats), are saved.

Among them, the visualization of the seal_recognition results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. The official model of the document scene information extraction production line has been found to have the following issues in the current demand scenario: in the visualization of OCR recognition, there is a deviation in the text bending detection box of the seal, resulting in incorrect seal text recognition; The information on the seal was not correctly extracted. The results for these in {'chat_res': {'seal': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of Seal Text Recognitions. Utilizing a dataset of Seal Text Recognition, with the extraction of seal information as examples, the seal text detection model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract seal information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Seal File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 2 end-to-end seal text detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description - - - - - - PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml

Note: The evaluation set for the above accuracy metrics is our self-built seal text detection dataset, containing 500 images of circle seal types. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Seal Text Detection Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/practical_seal.tar -P ./dataset\ntar -xf ./dataset/practical_seal.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/practical_seal/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 793,\n    \"train_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4055390_00006_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3712248_00008_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4227328_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3745965_00007_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3980931_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC5896212_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3838814_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4677212_00002_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4058803_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4925966_00001_seal_0_crop.png\"\n    ],\n    \"val_samples\": 277,\n    \"val_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/15.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/16.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/17.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/18.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/19.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/20.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/21.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/22.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/23.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/24.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/practical_seal\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 739;
  • attributes.val_samples: The number of validation set samples in this dataset is 277;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all boxes's width and height in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4 \\\n    -o Train.learning_rate=0.0001\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/practical_seal\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate 3 experiments based on the PP-OCRv4_server_seal_det model, with learning rates of: 0.001\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate Hmean(%) 1 0.001 97.35 2 0.0001 93.32 3 0.00001 87.63

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [1, 4] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate Hmean(%) 1 30 97.35 4 100 98.13

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.seal_text_det_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: ./output/best_accuracy/inference\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u5e7f\u5173\u5e02\u200b\u56fd\u58eb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the seal is as follows, with the correctly added ability to extract the seal text information:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"seal\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html","title":"PaddleX 3.0 General Image Classification Pipeline \u2014 Garbage Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For garbage classification, it falls under the general image classification task, corresponding to PaddleX's universal image classification pipeline. If you're unsure about the task-pipeline correspondence, you can check the capabilities of relevant pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a General Image Classification pipeline for a quick trial.

Quick Trial Output Example:

After trying the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is not satisfactory, you can test alternative models and decide if further fine-tuning is needed. Since this tutorial aims to classify specific garbage types, the default weights (trained on the ImageNet-1k dataset) are insufficient. You need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 80 end-to-end image classification models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model List Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-HGNetV2_B6 86.30 10.46 240.18 288 CLIP_vit_base_patch16_224 85.39 12.03 234.85 331 PP-HGNetV2_B4 83.57 2.45 38.10 76 SwinTransformer_base_patch4_window7_224 83.37 12.35 - 342 PP-HGNet_small 81.51 4.24 108.21 94 PP-HGNetV2_B0 77.77 0.68 6.41 23 ResNet50 76.50 3.12 50.90 98 PP-LCNet_x1_0 71.32 1.01 3.39 7 MobileNetV3_small_x1_0 68.24 1.09 3.65 12

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial will use the PP-LCNet_x1_0 model as an example to complete the full model development process. You can select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within your pipeline and ultimately use them in real-world scenarios.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Garbage Classification Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/trash40.tar -P ./dataset\ntar -xf ./dataset/trash40.tar -C ./dataset/\n
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/trash40/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": ../../dataset/trash40/label.txt\",\n    \"num_classes\": 40,\n    \"train_samples\": 1605,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/img_14950.jpg\",\n      \"check_dataset/demo_img/img_12045.jpg\",\n    ],\n    \"val_samples\": 3558,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/img_198.jpg\",\n      \"check_dataset/demo_img/img_19627.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/trash40/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 40, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 1605;
  • attributes.val_samples: The number of validation set samples in this dataset is 3558;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/trash40 \\\n    -o Train.num_classes=40\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/trash40\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 20, and set the batch size to 64 due to the small size of the training dataset.
  2. Initiate three experiments based on the PP-LCNet_x1_0 model, with learning rates of: 0.01, 0.001, 0.1.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.01. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 2 20 0.001 64 4 GPUs 30.64% Experiment 3 20 0.1 64 4 GPUs 71.53%

Changing Epochs Experiment Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 1 (Increased Epochs) 50 0.01 64 4 GPUs 77.32% Experiment 1 (Increased Epochs) 80 0.01 64 4 GPUs 77.60% Experiment 1 (Increased Epochs) 100 0.01 64 4 GPUs 77.80%

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine, with FP32 precision. CPU inference speed is based on an Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing. Use the test file to perform predictions:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for garbage_demo.png is shown below:

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Image Classification Pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/image_classification.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/image_classification.yaml\")\noutput = pipeline.predict(\"./dataset/trash40/images/test/0/img_154.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Image Classification Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html","title":"PaddleX 3.0 General Instance Segmentation Pipeline \u2014 Tutorial for Remote Sensing Image Instance Segmentation","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of remote sensing image segmentation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For remote sensing image segmentation, this falls under the category of instance segmentation, corresponding to PaddleX's Universal Instance Segmentation Pipeline. If unsure about the task-pipeline correspondence, refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline instance_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Instance Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the included model needs further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for testing until satisfied. If the final results are unsatisfactory, fine-tuning the model is necessary. This tutorial aims to produce a model that segments geospatial objects, and the default weights (trained on the COCO dataset) cannot meet this requirement. Data collection and annotation are required for training and fine-tuning.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides 15 end-to-end instance segmentation models. Refer to the Model List for details. Benchmarks for some models are as follows:

Model List mAP(%) GPU Inference Time(ms) Model Size(M) Mask-RT-DETR-H 48.8 61.40 486 Mask-RT-DETR-X 47.5 45.70 257 Mask-RT-DETR-L 45.7 37.40 123 Mask-RT-DETR-S 40.9 32.40 57

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA V100 machine with FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the Mask-RT-DETR-H model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally apply them in real-world scenarios.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Remote Sensing Image Instance Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/intseg_remote_sense_coco.tar -P ./dataset\ntar -xf ./dataset/intseg_remote_sense_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

When verifying the dataset, you only need one command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print Check dataset passed !, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 2989,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/524.jpg\",\n      \"check_dataset/demo_img/024.jpg\",\n    ],\n    \"val_samples\": 932,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/326.jpg\",\n      \"check_dataset/demo_img/596.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/intseg_remote_sense_coco/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 10, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 2989.
  • attributes.val_samples: The number of validation samples in this dataset is 932.
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples.
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples.

Additionally, the dataset verification also analyzes the sample number distribution of all categories in the dataset and generates a distribution histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations of some parameters in the configuration file:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If re-splitting the dataset, the percentage of the training set needs to be set, which is an integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If re-splitting the dataset, the percentage of the validation set needs to be set, which is an integer between 0-100, and the sum with train_percent must be 100;

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in the original path. The above parameters also support setting through appending command line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco \\\n    -o Train.num_classes=10\n

PaddleX model training supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. The following are example explanations of some parameters in the configuration file:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which logs whether the training task completed successfully, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, which records changes in model metrics, loss variations, etc. during the training process;
  • config.yaml: Training configuration file, which records the hyperparameter configurations for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer states, EMA (Exponential Moving Average), static graph network parameters, and static graph network structures;
"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight files on the validation set to verify the model's accuracy. To perform model evaluation using PaddleX, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

Similar to model training, model evaluation supports setting configurations by modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 80 and the batch size at 2.
  2. Launch three experiments based on the Mask-RT-DETR-H model with learning rates of: 0.0005, 0.005, 0.0001
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results for different epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 80 0.0005 2 4 GPUs 0.695 Experiment 2 80 0.0001 2 4 GPUs 0.825 Experiment 3 80 0.00005 2 4 GPUs 0.706

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 80 0.0001 2 4 GPUs 0.825 Reduced Epochs in Experiment 2 30 0.0001 2 4 GPUs 0.287 Reduced Epochs in Experiment 2 50 0.0001 2 4 GPUs 0.545 Increased Epochs in Experiment 2 100 0.0001 2 4 GPUs 0.813

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above, which is normal.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for remotesensing_demo.png is as follows:

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general instance segmentation pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/instance_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/instance_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the result visualization image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Instance Segmentation Pipline User Guide\u3002

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial on Pedestrian Fall Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of pedestrian fall detection.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the appropriate PaddleX pipeline based on your task scenario. For pedestrian fall detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\n

  • AIStudio Community Experience: Navigate to Baidu AIStudio Community, click \"Create Pipeline,\" and create a General Object Detection pipeline for a quick trial.

Quick trial output example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. Since the default weights (trained on the COCO dataset) are unlikely to meet the requirements for detecting pedestrian falls, you'll need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Here's a benchmark of some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the PP-YOLOE_plus-S model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally deploy

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Pedestrian Fall Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/fall_det.tar -P ./dataset\ntar -xf ./dataset/fall_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/fall_det\n

After executing the above command, PaddleX will verify the dataset and count its basic information. Upon successful execution, the log will print out Check dataset passed ! information, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized example images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 1224,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/fall_1168.jpg\",\n      \"check_dataset/demo_img/fall_1113.jpg\"\n    ],\n    \"val_samples\": 216,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/fall_349.jpg\",\n      \"check_dataset/demo_img/fall_394.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/fall_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 1224.
  • attributes.val_samples: The number of validation samples in this dataset is 216.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False.
      • src_dataset_type: If dataset format conversion is performed, the source dataset format must be specified. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False.
      • train_percent: If dataset splitting is performed, the percentage of the training set must be set. The value should be an integer between 0 and 100, and the sum with val_percent must be 100.
      • val_percent: If dataset splitting is performed, the percentage of the validation set must be set. The value should be an integer between 0 and 100, and the sum with train_percent must be 100.

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support setting through appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/fall_det \\\n    -o Train.num_classes=1\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command-line parameters.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/fall_det\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line parameters.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve model accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The learning rate setting affects the speed and stability of model convergence. Therefore, when optimizing model performance, carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the control variable method when debugging parameters:

  1. First, fix the number of training epochs to 10 and the batch size to 8.
  2. Start three experiments based on the PP-YOLOE_plus-S model with learning rates of: 0.00002, 0.0001, 0.0005.
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results of different epochs. It is found that the best accuracy is basically achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 10 0.00002 8 4 GPUs 0.880 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 3 10 0.0005 8 4 GPUs 0.888

Changing Epochs Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 2 (Increased Epochs) 50 0.0001 8 4 GPUs 0.944 Experiment 2 (Increased Epochs) 100 0.0001 8 4 GPUs 0.947

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\"\n

The prediction results will be generated under ./output, and the prediction result for fall.png is shown below:

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial for Fashion Element Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of fashion element detection in clothing.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For fashion element detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\n

  • AIStudio Community Experience: Visit Baidu AIStudio Community, click \"Create Pipeline,\" and select the General Object Detection pipeline for a quick trial.

Quick Trial Output Example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. For this tutorial, aiming to detect fashion elements in clothing, the default weights (trained on the COCO dataset) are insufficient. Data collection and annotation, followed by training and fine-tuning, are necessary.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Below are benchmarks for some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models with faster inference speed are placed higher in the table, while models with higher accuracy are lower. This tutorial takes the PicoDet-L model as an example to complete a full model development process. You can judge and select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within the pipeline and ultimately use them in practical scenarios.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Fashion Element Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_mini_fashion_pedia_coco.tar -P ./dataset\ntar -xf ./dataset/det_mini_fashion_pedia_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful command execution, \"Check dataset passed !\" will be printed in the log, and relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 15,\n    \"train_samples\": 4000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/297ea597f7dfa6d710b2e8176cb3b913.jpg\",\n      \"check_dataset/demo_img/2d8b75ce472dbebd41ca8527f0a292f3.jpg\"\n    ],\n    \"val_samples\": 800,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/40e13ebcfa281567c92fc9842510abea.jpg\",\n      \"check_dataset/demo_img/87808e379034ac2344f5132d3dccc6e6.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_mini_fashion_pedia_coco\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the dataset format meets the requirements as check_pass is True. The explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 15, which is the number of classes to be passed for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 4000.
  • attributes.val_samples: The number of validation samples in this dataset is 800.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only datasets that pass the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion. The default is False.
      • src_dataset_type: If dataset format conversion is enabled, you need to set the source dataset format. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting. The default is False.
      • train_percent: If dataset splitting is enabled, you need to set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100.
      • val_percent: If dataset splitting is enabled, you need to set the percentage of the validation set. The value should be an integer between 0 and 100, and the sum with train_percent should be 100.

Data conversion and data splitting can be enabled simultaneously. The original annotation files for data splitting will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the training set and validation set ratio: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco \\\n    -o Train.num_classes=15\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 50: -o Train.epochs_iters=50. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

Similar to model training, model evaluation supports modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a built-in default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By reasonably tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 50 and the batch size at 16.
  2. Initiate three experiments based on the PicoDet-L model with learning rates of: 0.02, 0.04, 0.08.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.04. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 80 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 50 0.02 16 4 GPUs 0.428 Experiment 2 50 0.04 16 4 GPUs 0.471 Experiment 3 50 0.08 16 4 GPUs 0.440

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 50 0.04 16 4 GPUs 0.471 Reduced Epochs in Exp. 2 30 0.04 16 4 GPUs 0.425 Increased Epochs in Exp. 2 80 0.04 16 4 GPUs 0.491 Further Increased Epochs 100 0.04 16 4 GPUs 0.459

Note: This tutorial is designed for a 4-GPU setup. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above figures, which is normal.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#6-pipeline-testing","title":"6. Pipeline Testing","text":"

Replace the model in the pipeline with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for FashionPedia_demo.png is as follows:

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in your production line, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n

For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 License Plate Recognition Tutorial","text":"

PaddleX provides a rich set of pipelines, each consisting of one or more models that work together to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a license plate recognition task as an example.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For license plate recognition, this task falls under text detection, corresponding to PaddleX's Universal OCR pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List supported by PaddleX to understand the capabilities of relevant pipelines.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.), and whether the models included in the pipeline need further fine-tuning. If the speed or accuracy of the models does not meet expectations, select replaceable models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tune the models.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides two end-to-end text detection models. For details, refer to the Model List. The benchmarks of the models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The above accuracy metrics are for the Detection Hmean and Recognition Avg Accuracy on PaddleOCR's self-built Chinese dataset validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while from bottom to top, they have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Depending on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"License Plate Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For information on data format, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ccpd_text_det.tar -P ./dataset\ntar -xf ./dataset/ccpd_text_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#42-dataset-validation","title":"4.2 Dataset Validation","text":"

To validate the dataset, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

After executing the above command, PaddleX will validate the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The validation result file is saved in ./output/check_dataset_result.json, and the specific content of the validation result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 5769,\n    \"train_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/0274305555556-90_266-204&460_520&548-516&548_209&547_204&464_520&460-0_0_3_25_24_24_24_26-63-89.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0126171875-90_267-294&424_498&486-498&486_296&485_294&425_496&424-0_0_3_24_33_32_30_31-157-29.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0371516927083-89_254-178&423_517&534-517&534_204&525_178&431_496&423-1_0_3_24_33_31_29_31-117-667.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/03349609375-90_268-211&469_526&576-526&567_214&576_211&473_520&469-0_0_3_27_31_32_29_32-174-48.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0388454861111-90_269-138&409_496&518-496&518_138&517_139&410_491&409-0_0_3_24_27_26_26_30-174-148.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0198741319444-89_112-208&517_449&600-423&593_208&600_233&517_449&518-0_0_3_24_28_26_26_26-87-268.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3027782118055555555-91_92-186&493_532&574-529&574_199&565_186&497_532&493-0_0_3_27_26_30_33_32-73-336.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/034375-90_258-168&449_528&546-528&542_186&546_168&449_525&449-0_0_3_26_30_30_26_33-94-221.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0286501736111-89_92-290&486_577&587-576&577_290&587_292&491_577&486-0_0_3_17_25_28_30_33-134-122.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/02001953125-92_103-212&486_458&569-458&569_224&555_212&486_446&494-0_0_3_24_24_25_24_24-88-24.jpg\"\n    ],\n    \"val_samples\": 1001,\n    \"val_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/3056141493055555554-88_93-205&455_603&597-603&575_207&597_205&468_595&455-0_0_3_24_32_27_31_33-90-213.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0680295138889-88_94-120&474_581&623-577&605_126&623_120&483_581&474-0_0_5_24_31_24_24_24-116-518.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0482421875-87_265-154&388_496&530-490&495_154&530_156&411_496&388-0_0_5_25_33_33_33_33-84-104.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0347504340278-105_106-235&443_474&589-474&589_240&518_235&443_473&503-0_0_3_25_30_33_27_30-162-4.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0205338541667-93_262-182&428_410&519-410&519_187&499_182&428_402&442-0_0_3_24_26_29_32_24-83-63.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0380913628472-97_250-234&403_529&534-529&534_250&480_234&403_528&446-0_0_3_25_25_24_25_25-185-85.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/020598958333333334-93_267-256&471_482&563-478&563_256&546_262&471_482&484-0_0_3_26_24_25_32_24-102-115.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3030323350694444445-86_131-170&495_484&593-434&569_170&593_226&511_484&495-11_0_5_30_30_31_33_24-118-59.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3016158854166666667-86_97-243&471_462&546-462&527_245&546_243&479_453&471-0_0_3_24_30_27_24_29-98-40.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0340831163194-89_264-177&412_488&523-477&506_177&523_185&420_488&412-0_0_3_24_30_29_31_31-109-46.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/ccpd_text_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 5769;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 1001;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to perform dataset format conversion, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, ensuring the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, ensuring the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

PaddleX supports modifying training hyperparameters, single-machine single/multi-GPU training, etc., by modifying the configuration file or appending command line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, related file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires only one command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly according to the actual situation to achieve the best training effect.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs to 10, the batch size to 8, the number of GPUs to 4, and the total batch size to 32.
  2. Start four experiments based on the PP-OCRv4_server_det model with learning rates of: 0.00005, 0.0001, 0.0005, 0.001.
  3. You can find that Experiment 4 with a learning rate of 0.001 has the highest accuracy, and by observing the validation set score, the accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 20 will further improve the model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Detection Hmean (%) 1 0.00005 99.06 2 0.0001 99.55 3 0.0005 99.60 4 0.001 99.70

Next, based on a learning rate of 0.001, we can increase the number of training epochs. Comparing Experiments [4, 5] below, it can be seen that increasing the number of training epochs further improves the model accuracy. Experiment ID Number of Training Epochs Detection Hmean (%) 4 10 99.70 5 20 99.80

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the models in the production line with the fine-tuned models for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir output/best_accuracy/inference None \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

This will generate prediction results under ./output, where the prediction result for case1.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 Handwritten Chinese Recognition Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that collectively solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also support fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of handwritten Chinese recognition.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For handwritten Chinese recognition, this task falls under the Text Recognition category, corresponding to PaddleX's Universal OCR Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the pipeline's models need further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tuning the model is necessary.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides four end-to-end OCR models. For details, refer to the Model List. Benchmarks for some models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The evaluation set is a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts. The text recognition set contains 11,000 images, and the detection set contains 500 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Based on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Handwritten Chinese Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/handwrite_chinese_text_rec.tar -P ./dataset\ntar -xf ./dataset/handwrite_chinese_text_rec.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 23965,\n    \"train_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/64957.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/138926.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/86760.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/83191.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/79882.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/58639.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1187-P16_1.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/8199.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1225-P19_9.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/183335.png\"\n    ],\n    \"val_samples\": 17259,\n    \"val_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/11.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/12.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/13.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/14.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/15.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/16.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/17.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/18.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/19.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/20.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/handwrite_chinese_text_rec\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 23965;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 17259;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of the samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of the samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to convert the dataset format, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, and needs to ensure that the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, and needs to ensure that the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command-line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters carefully and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs at 20, the batch size at 8, select 4 GPUs, and the total batch size is 32.
  2. Initiate four experiments based on the PP-OCRv4_server_rec model with learning rates of: 0.001, 0.005, 0.0002, 0.0001.
  3. It can be observed that Experiment 3, with a learning rate of 0.0002, yields the highest accuracy, and the validation set score indicates that accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 30, 50, and 80 will further improve model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Recognition Acc (%) 1 0.001 43.28 2 0.005 32.63 3 0.0002 49.64 4 0.0001 46.32

Next, based on a learning rate of 0.0002, we can increase the number of training epochs. Comparing Experiments [4, 5, 6, 7] below, it can be seen that increasing the number of training epochs further improves model accuracy. Experiment ID Number of Training Epochs Recognition Acc (%) 4 20 49.64 5 30 52.03 6 50 54.15 7 80 54.35

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir None output/best_accuracy/inference \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

The prediction results will be generated under ./output, and the prediction result for case.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html","title":"PaddleX 3.0 General Semantic Segmentation Pipeline \u2014 Lane Line Segmentation Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a lane line segmentation task.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For lane line segmentation, this falls under the category of semantic segmentation tasks, corresponding to PaddleX's Universal Semantic Segmentation Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline semantic_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Semantic Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 18 end-to-end semantic segmentation models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48 82.15 87.97 2180.76 270 PP-LiteSeg-T 77.04 5.98 140.02 31

Note: The above accuracy metrics are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-LiteSeg-T model as an example to complete the full model development process. You can choose a suitable model for training based on your actual usage scenario, evaluate the appropriate model weights within the pipeline, and finally use them in practical scenarios.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Lane Line Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/semantic-segmentation-makassaridn-road-dataset.tar -P ./dataset\ntar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 300,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/20220311151733_0060_040.jpg\",\n      \"check_dataset/demo_img/20220311153115_0023_039.jpg\"\n    ],\n    \"val_samples\": 74,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/20220311152033_0060_007.jpg\",\n      \"check_dataset/demo_img/20220311144930_0060_026.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/semantic-segmentation-makassaridn-road-dataset\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 300;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 74;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 5000 and the batch size at 2.
  2. Initiate three experiments based on the PP-LiteSeg-T model, with learning rates of: 0.006, 0.008, and 0.01.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.008. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 80000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 5000 0.006 2 4 GPUs 0.623 Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 3 5000 0.01 2 4 GPUs 0.619

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 2 with fewer epochs 10000 0.008 2 4 GPUs 0.773 Experiment 2 with more epochs 40000 0.008 2 4 GPUs 0.855 Experiment 2 with more epochs 80000 0.008 2 4 GPUs 0.863

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\"\n

The prediction results will be generated under ./output, where the prediction result for makassaridn-road_demo.png is shown below:

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general semantic segmentation pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/semantic_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Semantic Segmentation Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html","title":"PaddleX 3.0 Time Series Anomaly Detection Pipeline \u2014 Equipment Anomaly Detection Application Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration of pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Local Installation Tutorial. This tutorial introduces the usage of the pipeline tool with an example of detecting anomalies in equipment nodes.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. This task aims to identify and mark abnormal behaviors or states in equipment nodes, helping enterprises and organizations promptly detect and resolve issues in application server nodes, thereby improving system reliability and availability. Recognizing this as a time series anomaly detection task, we will use PaddleX's Time Series Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"PatchTST_ad\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Visit the Official Time Series Anomaly Detection Application to experience the capabilities of time series anomaly detection tasks. Note: Due to the tight correlation between time series data and scenarios, the online experience of official models for time series tasks is tailored to a specific scenario and is not a general solution. Therefore, the experience mode does not support using arbitrary files to evaluate the official model's performance. However, after training a model with your own scenario data, you can select your trained model and use data from the corresponding scenario for online experience.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series anomaly detection models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name Precision Recall F1-Score Model Size (M) Description DLinear_ad 0.9898 0.9396 0.9641 72.8K A simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_ad 0.9855 0.8895 0.9351 1.5MB A transformer-based model optimized for anomaly detection in non-stationary time series AutoEncoder_ad 0.9936 0.8436 0.9125 32K A classic autoencoder-based model that is efficient and easy to use for time series anomaly detection PatchTST_ad 0.9878 0.9070 0.9457 164K A high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_ad 0.9837 0.9480 0.9656 732K A highly adaptive and high-precision time series anomaly detection model through multi-period analysis

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire process of time series anomaly detection, we will use the publicly available MSL (Mars Science Laboratory) dataset for model training and validation. The PSM (Planetary Science Mission) dataset, sourced from NASA, comprises 55 dimensions and includes telemetry anomaly data reported by the spacecraft's monitoring system for unexpected event anomalies (ISA). With its practical application background, it better reflects real-world anomaly scenarios and is commonly used to test and validate the performance of time series anomaly detection models. This tutorial will perform anomaly detection based on this dataset.

We have converted the dataset into a standard data format, and you can obtain a sample dataset using the following command. For an introduction to the data format, please refer to the Time Series Anomaly Detection Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/msl.tar -P ./dataset\ntar -xf ./dataset/msl.tar -C ./dataset/\n

Data Considerations * Time series anomaly detection is an unsupervised learning task, thus labeled training data is not required. The collected training samples should ideally consist solely of normal data, i.e., devoid of anomalies, with the label column in the training set set to 0 or, alternatively, the label column can be omitted entirely. For the validation set, to assess accuracy, labeling is necessary. Points that are anomalous at a particular timestamp should have their labels set to 1, while normal points should have labels of 0. * Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods. * Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/msl\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 58317,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"0\",\n        \"1\",\n        \"2\",\n        \"...\"\n      ],\n      [\n        \"...\"\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/msl\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, refer to Section 4.1.3 in the Time Series Anomaly Detection Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/msl \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=timestamp \\\n-o Train.feature_cols=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 \\\n-o Train.freq=1 \\\n-o Train.label_col=label \\\n-o Train.seq_len=96\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations for parameters in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset verification (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict).
  • device: Training device, options include cpu and gpu. You can check the models supported on different devices in the PaddleX Model List (CPU/GPU) document at the same level directory.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs.
  • learning_rate: Training learning rate.
  • batch_size: Training batch size for a single GPU.
  • time_col: Time column, set the column name of the time series dataset's time column based on your data.
  • feature_cols: Feature variables indicating variables related to whether the device is abnormal.
  • freq: Frequency of the time series dataset.
  • input_len: The length of the time series input to the model. The time series will be sliced according to this length, and the model will predict whether there is an anomaly in this segment of the time series for that length. The recommended input length should be considered in the context of the actual scenario. In this tutorial, the input length is 96, which means we hope to predict whether there are anomalies at 96 time points.
  • label: Represents the number indicating whether a time point in the time series is abnormal. Anomalous points are labeled as 1, and normal points are labeled as 0. In this tutorial, the anomaly monitoring dataset uses label for this purpose.

For more introductions to hyperparameters, please refer to PaddleX Time Series Task Model Configuration File Parameter Instructions. The above parameters can be set by appending command-line arguments. For example, to specify the mode as model training: -o Global.mode=train; to specify the first GPU for training: -o Global.device=gpu:0; to set the number of training epochs to 10: -o Train.epochs_iters=10.

More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/msl\n
Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including F1, recall, and precision.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series anomaly detection:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5, batch size to 16, and input length to 96.
  2. Initiate three experiments based on the PatchTST_ad model with learning rates of: 0.0001, 0.0005, 0.001.
  3. It can be found that Experiment 3 has the highest accuracy, with a learning rate of 0.001. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 20.
  4. It can be found that the accuracy of Experiment 4 is the same as that of Experiment 3, indicating that there is no need to further increase the number of training epochs.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 1 5 0.0001 16 96 1 GPU 79.5 Experiment 2 5 0.0005 16 96 1 GPU 80.1 Experiment 3 5 0.001 16 96 1 GPU 80.9

Increasing Training Epochs Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 3 5 0.0005 16 96 1 GPU 80.9 Experiment 4 20 0.0005 16 96 1 GPU 80.9"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, using the test file for prediction:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/test.csv\"\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#7-integrationdeployment","title":"7. Integration/Deployment","text":"

If the general-purpose time series anomaly detection pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series anomaly detection pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series Anomaly Detection Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series anomaly detection pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_classification.html","title":"PaddleX 3.0 Time Series Classification Pipeline \u2014 Heartbeat Monitoring Time Series Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also allow fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the pipeline tool with an example of heartbeat time series data classification.

"},{"location":"en/practical_tutorials/ts_classification.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For this task, the goal is to train a time series classification model based on heartbeat monitoring data to classify heartbeat time series conditions. Recognizing this as a time series classification task, we select PaddleX's Time Series Classification Pipeline. If unsure about the task-pipeline correspondence, consult the PaddleX Pipeline List (CPU/GPU) for pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_classification.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Access the Official Time Series Classification Application to experience time series classification capabilities.

Note: Due to the tight coupling between time series data and scenarios, the online experience of official models is tailored to a specific scenario and not a universal solution. It does not support arbitrary files for model effect evaluation. However, after training a model with your scenario data, you can select your trained model and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_classification.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides a time series classification model. Refer to the Model List for details. The model benchmark is as follows:

Model Name Acc (%) Model Size (M) Description TimesNet_cls 87.5 792K TimesNet is an adaptive and high-precision time series classification model through multi-cycle analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/practical_tutorials/ts_classification.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ts_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series classification process, we will use the public Heartbeat Dataset for model training and validation. The Heartbeat Dataset is part of the UEA Time Series Classification Archive, addressing the practical task of heartbeat monitoring for medical diagnosis. The dataset comprises multiple time series groups, with each data point consisting of a label variable, group ID, and 61 feature variables. This dataset is commonly used to test and validate the performance of time series classification prediction models.

We have converted the dataset into a standard format, which can be obtained using the following commands. For data format details, refer to the Time Series Classification Module Development Tutorial.

Dataset Acquisition Command:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n

Data Considerations * Based on collected real data, clarify the classification objectives of the time series data and define corresponding classification labels. For example, in stock price classification, labels might be \"Rise\" or \"Fall.\" For a time series that is \"Rising\" over a period, it can be considered a sample (group), where each time point in this period shares a common group_id. * Uniform Time Series Length: Ensure that the length of the time series for each group is consistent. Missing Value Handling: To guarantee the quality and integrity of the data, missing values can be imputed based on expert experience or statistical methods. * Non-Duplication: Ensure that the data is collected row by row in chronological order, with no duplication of the same time point.

"},{"location":"en/practical_tutorials/ts_classification.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [ ...\n    ],\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [ ...\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_classification.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, please refer to Section 4.1.3 in the Time Series Classification Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_classification.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_classification.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/ts_classify_examples \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=time \\\n-o Train.target_cols=dim_0,dim_1,dim_2 \\\n-o Train.freq=1 \\\n-o Train.group_id=group_id \\\n-o Train.static_cov_cols=label\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time-series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supports dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict);
  • device: Training device, options include cpu, gpu. Check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Set the column names of the target variables of the time series dataset based on your data. Can be multiple, separated by commas. Generally, the more relevant the target variables are to the prediction target, the higher the model accuracy. In this tutorial, the heartbeat monitoring dataset has 61 feature variables for the time column, such as dim_0, dim_1, etc.;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • group_id: A group ID represents a time series sample, and time series sequences with the same ID form a sample. Set the column name of the specified group ID based on your data, e.g., group_id.
  • static_cov_cols: Represents the category ID column of the time series. The same sample has the same label. Set the column name of the category based on your data, e.g., label. For more hyperparameter introductions, please refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_classification.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Evaluate.weight_path=./output/best_model/model.pdparams\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including Acc Top1.

"},{"location":"en/practical_tutorials/ts_classification.html#53-model-optimization","title":"5.3 Model Optimization","text":"

By adjusting the number of training epochs appropriately, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

Using the method of controlled variables, we can start with a fixed, relatively small number of epochs in the initial stage and adjust the learning rate multiple times to find an optimal learning rate. After that, we can increase the number of training epochs to further improve the results. Below, we introduce the parameter tuning method for time series classification in detail:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5 and the batch size to 16.
  2. Launch three experiments based on the TimesNet_cls model with learning rates of 0.00001, 0.0001, and 0.001, respectively.
  3. It can be found that Experiment 3 has the highest accuracy. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 30. Note: Due to the built-in early stopping mechanism for time series tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. If you need to change the patience epochs for early stopping, you can manually modify the value of the patience hyperparameter in the configuration file.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 1 5 0.00001 16 1 GPU 72.20% Experiment 2 5 0.0001 16 1 GPU 72.20% Experiment 3 5 0.001 16 1 GPU 73.20%

Results of Increasing Training Epochs:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 3 5 0.001 16 1 GPU 73.20% Experiment 4 30 0.001 16 1 GPU 75.10%"},{"location":"en/practical_tutorials/ts_classification.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Set the model directory to the trained model for testing, using the test file to perform predictions:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_classification/test.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is TimesNet_cls.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/inference\"
  • Specify the path to the input data: -o Predict.input=\"...\"

Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

"},{"location":"en/practical_tutorials/ts_classification.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general time series classification pipeline meets your requirements for inference speed and accuracy, you can directly proceed with development integration/deployment.

  1. If you need to directly apply the general time series classification pipeline in your Python project, you can refer to the following sample code:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_classification\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n

For more parameters, please refer to the Time Series Classification Pipeline Usage Tutorial

  1. Additionally, PaddleX's time series classification pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_forecast.html","title":"PaddleX 3.0 Time Series Forecasting Pipeline \u2014 Long-term Electricity Consumption Forecasting Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the time series forecasting pipeline tool with an example of long-term electricity consumption forecasting.

"},{"location":"en/practical_tutorials/ts_forecast.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. The goal of this task is to predict future electricity consumption based on historical data. Recognizing this as a time series forecasting task, we will use PaddleX's time series forecasting pipeline. If you're unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_forecast.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its pipelines: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:

    from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n

  • AIStudio Community Experience: Visit the Official Time Series Forecasting Application to experience time series forecasting capabilities. Note: Due to the tight correlation between time series data and scenarios, the official online experience models for time series tasks are tailored to specific scenarios and are not universal. Therefore, the online experience does not support using arbitrary files to test the official model solutions. However, after training your own model with scenario-specific data, you can select your trained model solution and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_forecast.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series forecasting models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name MSE MAE Model Size (M) Description DLinear 0.382 0.394 76k A simple, efficient, and easy-to-use time series forecasting model Nonstationary 0.600 0.515 60.3M Based on transformer architecture, optimized for long-term forecasting of non-stationary time series PatchTST 0.385 0.397 2.2M A high-accuracy long-term forecasting model that balances local patterns and global dependencies TiDE 0.405 0.412 34.9M A high-accuracy model suitable for handling multivariate, long-term time series forecasting problems TimesNet 0.417 0.431 5.2M Through multi-period analysis, TimesNet is an adaptable and high-accuracy time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset with an input sequence length of 96 and a prediction sequence length of 96 for all models except TiDE, which is 720.

Based on your actual usage scenario, select an appropriate model for training. After training, evaluate the model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ts_forecast.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series forecasting process, we will use the Electricity dataset for model training and validation. This dataset collects electricity consumption at a certain node from 2012 to 2014, with data collected every hour. Each data point consists of the current timestamp and corresponding electricity consumption. This dataset is commonly used to test and validate the performance of time series forecasting models.

In this tutorial, we will use this dataset to predict the electricity consumption for the next 96 hours. We have already converted this dataset into a standard data format, and you can obtain a sample dataset by running the following command. For an introduction to the data format, you can refer to the Time Series Prediction Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/electricity.tar -P ./dataset\ntar -xf ./dataset/electricity.tar -C ./dataset/\n

Data Considerations

  • When annotating data for time series forecasting tasks, based on the collected real data, all data is arranged in chronological order. During training, the data is automatically divided into multiple time segments, where the historical time series data and the future sequences respectively represent the input data for training the model and its corresponding prediction targets, forming a set of training samples.
  • Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods.
  • Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.
"},{"location":"en/practical_tutorials/ts_forecast.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/electricity\n

After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22880,\n    \"train_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2012-01-01 00:00:00\",\n        2162.0\n      ],\n      [\n        \"2012-01-01 01:00:00\",\n        2835.0\n      ],\n      [\n        \"2012-01-01 02:00:00\",\n        2764.0\n      ],\n      [\n        \"2012-01-01 03:00:00\",\n        2735.0\n      ],\n      [\n        \"2012-01-01 04:00:00\",\n        2721.0\n      ],\n      [\n        \"2012-01-01 05:00:00\",\n        2742.0\n      ],\n      [\n        \"2012-01-01 06:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 07:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 08:00:00\",\n        2680.0\n      ],\n      [\n        \"2012-01-01 09:00:00\",\n        2581.0\n      ]\n    ],\n    \"val_samples\": 3424,\n    \"val_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2014-08-11 08:00:00\",\n        3528.0\n      ],\n      [\n        \"2014-08-11 09:00:00\",\n        3800.0\n      ],\n      [\n        \"2014-08-11 10:00:00\",\n        3889.0\n      ],\n      [\n        \"2014-08-11 11:00:00\",\n        4340.0\n      ],\n      [\n        \"2014-08-11 12:00:00\",\n        4321.0\n      ],\n      [\n        \"2014-08-11 13:00:00\",\n        4293.0\n      ],\n      [\n        \"2014-08-11 14:00:00\",\n        4393.0\n      ],\n      [\n        \"2014-08-11 15:00:00\",\n        4384.0\n      ],\n      [\n        \"2014-08-11 16:00:00\",\n        4495.0\n      ],\n      [\n        \"2014-08-11 17:00:00\",\n        4374.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/electricity\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 22880.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 3424.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_forecast.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings. Refer to Section 4.1.3 in the Time Series Prediction Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_forecast.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/electricity \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=date \\\n-o Train.target_cols=OT \\\n-o Train.freq=1h \\\n-o Train.input_len=96 \\\n-o Train.predict_len=96\n

PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single instance testing (predict);
  • device: Training device, options include cpu, gpu, xpu, npu, mlu; check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Target variable columns, set the column name(s) of the time series dataset's target variable(s) based on your data. Multiple columns can be separated by commas;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • input_len: The length of historical time series input to the model; the input length should be considered comprehensively with the prediction length. Generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy.
  • predict_len: The length of the future sequence that the model is expected to predict; the prediction length should be considered comprehensively with the actual scenario. Generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy.
  • patience: The parameter for the early stopping mechanism, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; the larger the patience value, the longer the training time. For more hyperparameter introductions, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_forecast.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/electricity \\\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including mse and mae.

"},{"location":"en/practical_tutorials/ts_forecast.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series forecast:

It is recommended to follow the method of controlled variables when debugging parameters: 1. Initial Setup: Set the training epochs to 5, batch size to 16, and input length to 96.

  1. Experiments with DLinear Model and Launch three experiments with learning rates: 0.0001, 0.001, 0.01.

  2. Learning Rate Exploration: Experiment 2 yields the highest accuracy. Therefore, fix the learning rate at 0.001 and increase the training epochs to 30. Note: Due to the built-in early stopping mechanism for temporal tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. To adjust the patience epochs, modify the patience hyperparameter in the advanced configuration.

  3. Increasing Training Epochs and Input Length.

After increasing the training epochs, Experiment 4 achieves the highest accuracy. Next, increase the input length to 144 (using 144 hours of historical data to predict the next 96 hours), resulting in Experiment 5 with an accuracy of 0.188.

Learning Rate Exploration Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 1 5 0.0001 16 96 96 1 GPU 0.314 Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 3 5 0.01 16 96 96 1 GPU 0.320

Increasing Training Epochs Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 4 30 0.001 16 96 96 1 GPU 0.301

Increasing Input Length Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 4 30 0.001 16 96 96 1 GPU 0.301 Experiment 5 30 0.001 16 144 96 1 GPU 0.188"},{"location":"en/practical_tutorials/ts_forecast.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model and test using this power test data for prediction:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/test.csv\n
This will generate prediction results under ./output, with the predictions for test.csv saved in result.csv.

Similar to model training and evaluation, follow these steps: * Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml) * Specify the mode as model evaluation: -o Global.mode=evaluate * Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Configuration.

"},{"location":"en/practical_tutorials/ts_forecast.html#7integrationdeployment","title":"7.Integration/Deployment","text":"

If the general-purpose time series forecast pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series forecast pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_forecast\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series forecast Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series forecast pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PPaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/support_list/model_list_dcu.html","title":"PaddleX Model List (Hygon DCU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. The specific models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/model_list_dcu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Storage Size (M) Model Download Link ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_dcu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Storage Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model

Note: The above accuracy metrics are mIoU on the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html","title":"PaddleX Model List (Cambricon MLU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_mlu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_mlu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_mlu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_mlu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_mlu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_mlu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html","title":"PaddleX Model List (Huawei Ascend NPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_npu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link CLIP_vit_base_patch16_224 85.36 306.5 M Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 1.04 G Inference Model/Trained Model ConvNeXt_base_224 83.84 313.9 M Inference Model/Trained Model ConvNeXt_base_384 84.90 313.9 M Inference Model/Trained Model ConvNeXt_large_224 84.26 700.7 M Inference Model/Trained Model ConvNeXt_large_384 85.27 700.7 M Inference Model/Trained Model ConvNeXt_small 83.13 178.0 M Inference Model/Trained Model ConvNeXt_tiny 82.03 101.4 M Inference Model/Trained Model MobileNetV1_x0_5 63.5 4.8 M Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.8 M Inference Model/Trained Model MobileNetV1_x0_75 68.8 9.3 M Inference Model/Trained Model MobileNetV1_x1_0 71.0 15.2 M Inference Model/Trained Model MobileNetV2_x0_5 65.0 7.1 M Inference Model/Trained Model MobileNetV2_x0_25 53.2 5.5 M Inference Model/Trained Model MobileNetV2_x1_0 72.2 12.6 M Inference Model/Trained Model MobileNetV2_x1_5 74.1 25.0 M Inference Model/Trained Model MobileNetV2_x2_0 75.2 41.2 M Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model MobileNetV4_conv_large 83.4 125.2 M Inference Model/Trained Model MobileNetV4_conv_medium 79.9 37.6 M Inference Model/Trained Model MobileNetV4_conv_small 74.6 14.7 M Inference Model/Trained Model PP-HGNet_base 85.0 249.4 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-HGNet_tiny 79.83 52.4 M Inference Model/Trained Model PP-HGNetV2-B0 77.77 21.4 M Inference Model/Trained Model PP-HGNetV2-B1 79.18 22.6 M Inference Model/Trained Model PP-HGNetV2-B2 81.74 39.9 M Inference Model/Trained Model PP-HGNetV2-B3 82.98 57.9 M Inference Model/Trained Model PP-HGNetV2-B4 83.57 70.4 M Inference Model/Trained Model PP-HGNetV2-B5 84.75 140.8 M Inference Model/Trained Model PP-HGNetV2-B6 86.30 268.4 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model PP-LCNetV2_base 77.05 23.7 M Inference Model/Trained Model PP-LCNetV2_large 78.51 37.3 M Inference Model/Trained Model PP-LCNetV2_small 73.97 14.6 M Inference Model/Trained Model ResNet18_vd 72.3 41.5 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34_vd 76.0 77.3 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50_vd 79.1 90.8 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101_vd 80.2 158.4 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152_vd 80.6 214.3 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model ResNet200_vd 80.9 266.0 M Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 310.5 M Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 311.4 M Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 694.8 M Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 696.1 M Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 175.6 M Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_npu.html#_1","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link CLIP_vit_base_patch16_448_ML 89.15 325.6 M Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 39.6 M PP-HGNetV2-B4_ML 87.96 88.5 M Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 286.5 M Inference Model/Trained Model Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"en/support_list/model_list_npu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 245.4 M Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 246.2 M Inference Model/Trained Model CenterNet-DLA-34 37.6 75.4 M Inference Model/Trained Model CenterNet-ResNet50 38.9 319.7 M Inference Model/Trained Model DETR-R50 42.3 159.3 M Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 137.5 M Inference Model/Trained Model FasterRCNN-ResNet50 36.7 120.2 M Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet101 39.0 188.1 M Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 216.3 M Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 360.6 M Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 159.8 M Inference Model/Trained Model FCOS-ResNet50 39.6 124.2 M Inference Model/Trained Model PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-M 37.5 16.8 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PicoDet-XS 26.2 5.7M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model RT-DETR-H 56.3 435.8 M Inference Model/Trained Model RT-DETR-L 53.0 113.7 M Inference Model/Trained Model RT-DETR-R18 46.5 70.7 M Inference Model/Trained Model RT-DETR-R50 53.1 149.1 M Inference Model/Trained Model RT-DETR-X 54.8 232.9 M Inference Model/Trained Model YOLOv3-DarkNet53 39.1 219.7 M Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 83.8 M Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 163.0 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set mAP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_2","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE_plus_SOD-S 25.1 77.3 M Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 325.0 M Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 340.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_3","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_human 48.0 196.1 M Inference Model/Trained Model PP-YOLOE-S_human 42.5 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model Deeplabv3-R50 79.90 138.3 M Inference Model/Trained Model Deeplabv3-R101 80.85 205.9 M Inference Model/Trained Model OCRNet_HRNet-W48 82.15 249.8 M Inference Model/Trained Model PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for Cityscapes dataset mIoU.

"},{"location":"en/support_list/model_list_npu.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP Model Size (M) Model Download Link Mask-RT-DETR-H 50.6 449.9 M Inference Model/Trained Model Mask-RT-DETR-L 45.7 113.6 M Inference Model/Trained Model Mask-RT-DETR-M 42.7 66.6 M Inference Model/Trained Model Mask-RT-DETR-S 41.0 51.8 M Inference Model/Trained Model Mask-RT-DETR-X 47.5 237.5 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 254.8 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 254.7 M Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50 32.8 127.8 M Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 225.4 M Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 225.1 M Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 370.0 M Inference Model/Trained Model PP-YOLOE_seg-S 32.5 31.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set Mask AP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_4","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_rec_CLIP_vit_base 88.69 306.6 M Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 1.05 G Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"en/support_list/model_list_npu.html#_5","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_det 41.5 27.6 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_6","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_vehicle 63.9 196.1 M Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_7","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link STFPM 96.2 21.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"en/support_list/model_list_npu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_npu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_SVTRv2_rec 68.81 73.9 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_RepSVTR_rec 65.07 22.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/model_list_npu.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) Model Size (M) Model Download Link SLANet 76.31 6.9 M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PubtabNet English table recognition dataset.

"},{"location":"en/support_list/model_list_npu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 22.6 M Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 470.1 M Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 470.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_npu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name MSE MAE Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Inference Model/Trained Model PatchTST 0.385 0.397 2.0M Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model TiDE 0.405 0.412 31.7M Inference Model/Trained Model TimesNet 0.417 0.431 4.9M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall F1-Score Model Size (M) Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52K Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112K Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8M Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320K Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/model_list_npu.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name Acc (%) Model Size (M) Model Download Link TimesNet_cls 87.5 792K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary: Training, Evaluation datasets.

"},{"location":"en/support_list/model_list_xpu.html","title":"PaddleX Model List (Kunlun XPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_xpu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_xpu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_xpu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_xpu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_xpu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_xpu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_xpu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html","title":"PaddleX Model List\uff08CPU/GPU\uff09","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module includes various models. You can choose which models to use based on the benchmark data below. If you prioritize model accuracy, select models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/models_list.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_224 85.36 13.1957 285.493 306.5 M CLIP_vit_base_patch16_224.yaml Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 51.1284 1131.28 1.04 G CLIP_vit_large_patch14_224.yaml Inference Model/Trained Model ConvNeXt_base_224 83.84 12.8473 1513.87 313.9 M ConvNeXt_base_224.yaml Inference Model/Trained Model ConvNeXt_base_384 84.90 31.7607 3967.05 313.9 M ConvNeXt_base_384.yaml Inference Model/Trained Model ConvNeXt_large_224 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_224.yaml Inference Model/Trained Model ConvNeXt_large_384 85.27 66.4058 6598.92 700.7 M ConvNeXt_large_384.yaml Inference Model/Trained Model ConvNeXt_small 83.13 9.74075 1127.6 178.0 M ConvNeXt_small.yaml Inference Model/Trained Model ConvNeXt_tiny 82.03 5.48923 672.559 101.4 M ConvNeXt_tiny.yaml Inference Model/Trained Model FasterNet-L 83.5 23.4415 - 357.1 M FasterNet-L.yaml Inference Model/Trained Model FasterNet-M 83.0 21.8936 - 204.6 M FasterNet-M.yaml Inference Model/Trained Model FasterNet-S 81.3 13.0409 - 119.3 M FasterNet-S.yaml Inference Model/Trained Model FasterNet-T0 71.9 12.2432 - 15.1 M FasterNet-T0.yaml Inference Model/Trained Model FasterNet-T1 75.9 11.3562 - 29.2 M FasterNet-T1.yaml Inference Model/Trained Model FasterNet-T2 79.1 10.703 - 57.4 M FasterNet-T2.yaml Inference Model/Trained Model MobileNetV1_x0_5 63.5 1.86754 7.48297 4.8 M MobileNetV1_x0_5.yaml Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_25.yaml Inference Model/Trained Model MobileNetV1_x0_75 68.8 2.57903 10.6343 9.3 M MobileNetV1_x0_75.yaml Inference Model/Trained Model MobileNetV1_x1_0 71.0 2.78781 13.98 15.2 M MobileNetV1_x1_0.yaml Inference Model/Trained Model MobileNetV2_x0_5 65.0 4.94234 11.1629 7.1 M MobileNetV2_x0_5.yaml Inference Model/Trained Model MobileNetV2_x0_25 53.2 4.50856 9.40991 5.5 M MobileNetV2_x0_25.yaml Inference Model/Trained Model MobileNetV2_x1_0 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_0.yaml Inference Model/Trained Model MobileNetV2_x1_5 74.1 6.28385 22.5129 25.0 M MobileNetV2_x1_5.yaml Inference Model/Trained Model MobileNetV2_x2_0 75.2 6.12888 30.8612 41.2 M MobileNetV2_x2_0.yaml Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 6.31302 14.5588 9.6 M MobileNetV3_large_x0_5.yaml Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_35.yaml Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x0_75.yaml Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_0.yaml Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 8.73358 22.1296 26.5 M MobileNetV3_large_x1_25.yaml Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_5.yaml Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_35.yaml Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x0_75.yaml Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_0.yaml Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 6.9589 14.3995 13.0 M MobileNetV3_small_x1_25.yaml Inference Model/Trained Model MobileNetV4_conv_large 83.4 12.5485 51.6453 125.2 M MobileNetV4_conv_large.yaml Inference Model/Trained Model MobileNetV4_conv_medium 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_medium.yaml Inference Model/Trained Model MobileNetV4_conv_small 74.6 5.24172 11.0893 14.7 M MobileNetV4_conv_small.yaml Inference Model/Trained Model MobileNetV4_hybrid_large 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_large.yaml Inference Model/Trained Model MobileNetV4_hybrid_medium 80.5 19.7543 62.2624 42.9 M MobileNetV4_hybrid_medium.yaml Inference Model/Trained Model PP-HGNet_base 85.0 14.2969 327.114 249.4 M PP-HGNet_base.yaml Inference Model/Trained Model PP-HGNet_small 81.51 5.50661 119.041 86.5 M PP-HGNet_small.yaml Inference Model/Trained Model PP-HGNet_tiny 79.83 5.22006 69.396 52.4 M PP-HGNet_tiny.yaml Inference Model/Trained Model PP-HGNetV2-B0 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B0.yaml Inference Model/Trained Model PP-HGNetV2-B1 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B1.yaml Inference Model/Trained Model PP-HGNetV2-B2 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B2.yaml Inference Model/Trained Model PP-HGNetV2-B3 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B3.yaml Inference Model/Trained Model PP-HGNetV2-B4 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B4.yaml Inference Model/Trained Model PP-HGNetV2-B5 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B5.yaml Inference Model/Trained Model PP-HGNetV2-B6 86.30 21.226 255.279 268.4 M PP-HGNetV2-B6.yaml Inference Model/Trained Model PP-LCNet_x0_5 63.14 3.67722 6.66857 6.7 M PP-LCNet_x0_5.yaml Inference Model/Trained Model PP-LCNet_x0_25 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_25.yaml Inference Model/Trained Model PP-LCNet_x0_35 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_35.yaml Inference Model/Trained Model PP-LCNet_x0_75 68.18 3.91032 8.06953 8.4 M PP-LCNet_x0_75.yaml Inference Model/Trained Model PP-LCNet_x1_0 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_0.yaml Inference Model/Trained Model PP-LCNet_x1_5 73.71 3.97666 12.3457 16.0 M PP-LCNet_x1_5.yaml Inference Model/Trained Model PP-LCNet_x2_0 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_0.yaml Inference Model/Trained Model PP-LCNet_x2_5 76.60 4.06028 21.5063 32.1 M PP-LCNet_x2_5.yaml Inference Model/Trained Model PP-LCNetV2_base 77.05 5.23428 19.6005 23.7 M PP-LCNetV2_base.yaml Inference Model/Trained Model PP-LCNetV2_large 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_large.yaml Inference Model/Trained Model PP-LCNetV2_small 73.97 3.89762 13.0273 14.6 M PP-LCNetV2_small.yaml Inference Model/Trained Model ResNet18_vd 72.3 3.53048 31.3014 41.5 M ResNet18_vd.yaml Inference Model/Trained Model ResNet18 71.0 2.4868 27.4601 41.5 M ResNet18.yaml Inference Model/Trained Model ResNet34_vd 76.0 5.60675 56.0653 77.3 M ResNet34_vd.yaml Inference Model/Trained Model ResNet34 74.6 4.16902 51.925 77.3 M ResNet34.yaml Inference Model/Trained Model ResNet50_vd 79.1 10.1885 68.446 90.8 M ResNet50_vd.yaml Inference Model/Trained Model ResNet50 76.5 9.62383 64.8135 90.8 M ResNet50.yaml Inference Model/Trained Model ResNet101_vd 80.2 20.0563 124.85 158.4 M ResNet101_vd.yaml Inference Model/Trained Model ResNet101 77.6 19.2297 121.006 158.7 M ResNet101.yaml Inference Model/Trained Model ResNet152_vd 80.6 29.6439 181.678 214.3 M ResNet152_vd.yaml Inference Model/Trained Model ResNet152 78.3 30.0461 177.707 214.2 M ResNet152.yaml Inference Model/Trained Model ResNet200_vd 80.9 39.1628 235.185 266.0 M ResNet200_vd.yaml Inference Model/Trained Model StarNet-S1 73.6 9.895 23.0465 11.2 M StarNet-S1.yaml Inference Model/Trained Model StarNet-S2 74.8 7.91279 21.9571 14.3 M StarNet-S2.yaml Inference Model/Trained Model StarNet-S3 77.0 10.7531 30.7656 22.2 M StarNet-S3.yaml Inference Model/Trained Model StarNet-S4 79.0 15.2868 43.2497 28.9 M StarNet-S4.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 16.9848 383.83 310.5 M SwinTransformer_base_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 37.2855 1178.63 311.4 M SwinTransformer_base_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 74.1768 2105.22 696.1 M SwinTransformer_large_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 16.3982 285.56 175.6 M SwinTransformer_small_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 8.54846 156.306 100.1 M SwinTransformer_tiny_patch4_window7_224.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on the ImageNet-1k validation set.

"},{"location":"en/support_list/models_list.html#image-multi-label-classification-module","title":"Image Multi-Label Classification Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_448_ML 89.15 - - 325.6 M CLIP_vit_base_patch16_448_ML.yaml Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 - - 39.6 M PP-HGNetV2-B0_ML.yaml Inference Model/Trained Model PP-HGNetV2-B4_ML 87.96 - - 88.5 M PP-HGNetV2-B4_ML.yaml Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 - - 286.5 M PP-HGNetV2-B6_ML.yaml Inference Model/Trained Model PP-LCNet_x1_0_ML 77.96 - - 29.4 M PP-LCNet_x1_0_ML.yaml Inference Model/Trained Model ResNet50_ML 83.50 - - 108.9 M ResNet50_ML.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/support_list/models_list.html#pedestrian-attribute-module","title":"Pedestrian Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_pedestrian_attribute 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#vehicle-attribute-module","title":"Vehicle Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_vehicle_attribute 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on the VeRi dataset.

"},{"location":"en/support_list/models_list.html#image-feature-module","title":"Image Feature Module","text":"Model Name recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2_rec.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_base.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G PP-ShiTuV2_rec_CLIP_vit_large.yaml Inference Model/Trained Model

Note: The above accuracy metrics are recall@1 on AliProducts.

"},{"location":"en/support_list/models_list.html#document-orientation-classification-module","title":"Document Orientation Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_doc_ori 99.26 3.84845 9.23735 7.1 M PP-LCNet_x1_0_doc_ori.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#face-feature-module","title":"Face Feature Module","text":"Model Name Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link MobileFaceNet 128 96.28/96.71/99.58 4.1 MobileFaceNet.yaml Inference Model/Trained Model ResNet50_face 512 98.12/98.56/99.77 87.2 ResNet50_face.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively.

"},{"location":"en/support_list/models_list.html#main-body-detection-module","title":"Main Body Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_det 41.5 33.7426 537.003 27.6 M PP-ShiTuV2_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PaddleClas main body detection dataset.

"},{"location":"en/support_list/models_list.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 - - 245.4 M Cascade-FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 - - 246.2 M Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model CenterNet-DLA-34 37.6 - - 75.4 M CenterNet-DLA-34.yaml Inference Model/Trained Model CenterNet-ResNet50 38.9 - - 319.7 M CenterNet-ResNet50.yaml Inference Model/Trained Model DETR-R50 42.3 59.2132 5334.52 159.3 M DETR-R50.yaml Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 - - 137.5 M FasterRCNN-ResNet34-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 - - 148.1 M FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50 36.7 - - 120.2 M FasterRCNN-ResNet50.yaml Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 - - 216.3 M FasterRCNN-ResNet101-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet101 39.0 - - 188.1 M FasterRCNN-ResNet101.yaml Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 - - 360.6 M FasterRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 - - 159.8 M FasterRCNN-Swin-Tiny-FPN.yaml Inference Model/Trained Model FCOS-ResNet50 39.6 103.367 3424.91 124.2 M FCOS-ResNet50.yaml Inference Model/Trained Model PicoDet-L 42.6 16.6715 169.904 20.9 M PicoDet-L.yaml Inference Model/Trained Model PicoDet-M 37.5 16.2311 71.7257 16.8 M PicoDet-M.yaml Inference Model/Trained Model PicoDet-S 29.1 14.097 37.6563 4.4 M PicoDet-S.yaml Inference Model/Trained Model PicoDet-XS 26.2 13.8102 48.3139 5.7M PicoDet-XS.yaml Inference Model/Trained Model PP-YOLOE_plus-L 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus-L.yaml Inference Model/Trained Model PP-YOLOE_plus-M 49.8 19.843 449.261 83.2 M PP-YOLOE_plus-M.yaml Inference Model/Trained Model PP-YOLOE_plus-S 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-S.yaml Inference Model/Trained Model PP-YOLOE_plus-X 54.7 57.8995 1439.93 349.4 M PP-YOLOE_plus-X.yaml Inference Model/Trained Model RT-DETR-H 56.3 114.814 3933.39 435.8 M RT-DETR-H.yaml Inference Model/Trained Model RT-DETR-L 53.0 34.5252 1454.27 113.7 M RT-DETR-L.yaml Inference Model/Trained Model RT-DETR-R18 46.5 19.89 784.824 70.7 M RT-DETR-R18.yaml Inference Model/Trained Model RT-DETR-R50 53.1 41.9327 1625.95 149.1 M RT-DETR-R50.yaml Inference Model/Trained Model RT-DETR-X 54.8 61.8042 2246.64 232.9 M RT-DETR-X.yaml Inference Model/Trained Model YOLOv3-DarkNet53 39.1 40.1055 883.041 219.7 M YOLOv3-DarkNet53.yaml Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 18.6692 267.214 83.8 M YOLOv3-MobileNetV3.yaml Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 31.6276 856.047 163.0 M YOLOv3-ResNet50_vd_DCN.yaml Inference Model/Trained Model YOLOX-L 50.1 185.691 1250.58 192.5 M YOLOX-L.yaml Inference Model/Trained Model YOLOX-M 46.9 123.324 688.071 90.0 M YOLOX-M.yaml Inference Model/Trained Model YOLOX-N 26.1 79.1665 155.59 3.4 M YOLOX-N.yaml Inference Model/Trained Model YOLOX-S 40.4 184.828 474.446 32.0 M YOLOX-S.yaml Inference Model/Trained Model YOLOX-T 32.9 102.748 212.52 18.1 M YOLOX-T.yaml Inference Model/Trained Model YOLOX-X 51.8 227.361 2067.84 351.5 M YOLOX-X.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/models_list.html#small-object-detection-module","title":"Small Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE_plus_SOD-S 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-S.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-L.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 458.521 11172.7 340.5 M PP-YOLOE_plus_SOD-largesize-L.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the VisDrone-DET validation set.

"},{"location":"en/support_list/models_list.html#pedestrian-detection-module","title":"Pedestrian Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_human 48.0 32.7754 777.691 196.1 M PP-YOLOE-L_human.yaml Inference Model/Trained Model PP-YOLOE-S_human 42.5 15.0118 179.317 28.8 M PP-YOLOE-S_human.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman validation set.

"},{"location":"en/support_list/models_list.html#vehicle-detection-module","title":"Vehicle Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_vehicle 63.9 32.5619 775.633 196.1 M PP-YOLOE-L_vehicle.yaml Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 15.3787 178.441 28.8 M PP-YOLOE-S_vehicle.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set.

"},{"location":"en/support_list/models_list.html#face-detection-module","title":"Face Detection Module","text":"Model AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link BlazeFace 77.7/73.4/49.5 0.447 BlazeFace.yaml Inference Model/Trained Model BlazeFace-FPN-SSH 83.2/80.5/60.5 0.606 BlazeFace-FPN-SSH.yaml Inference Model/Trained Model PicoDet_LCNet_x2_5_face 93.7/90.7/68.1 28.9 PicoDet_LCNet_x2_5_face.yaml Inference Model/Trained Model PP-YOLOE_plus-S_face 93.9/91.8/79.8 26.5 PP-YOLOE_plus-S_face Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640.

"},{"location":"en/support_list/models_list.html#abnormality-detection-module","title":"Abnormality Detection Module","text":"Model Name Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link STFPM 96.2 - - 21.5 M STFPM.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the MVTec AD dataset using the average anomaly score.

"},{"location":"en/support_list/models_list.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Deeplabv3_Plus-R50 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R50.yaml Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 100.026 2460.71 162.5 M Deeplabv3_Plus-R101.yaml Inference Model/Trained Model Deeplabv3-R50 79.90 82.2631 1735.83 138.3 M Deeplabv3-R50.yaml Inference Model/Trained Model Deeplabv3-R101 80.85 121.492 2685.51 205.9 M Deeplabv3-R101.yaml Inference Model/Trained Model OCRNet_HRNet-W18 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W18.yaml Inference Model/Trained Model OCRNet_HRNet-W48 82.15 78.9976 2226.95 249.8 M OCRNet_HRNet-W48.yaml Inference Model/Trained Model PP-LiteSeg-T 73.10 7.6827 138.683 28.5 M PP-LiteSeg-T.yaml Inference Model/Trained Model PP-LiteSeg-B 75.25 10.9935 194.727 47.0 M PP-LiteSeg-B.yaml Inference Model/Trained Model SegFormer-B0 (slice) 76.73 11.1946 268.929 13.2 M SegFormer-B0.yaml Inference Model/Trained Model SegFormer-B1 (slice) 78.35 17.9998 403.393 48.5 M SegFormer-B1.yaml Inference Model/Trained Model SegFormer-B2 (slice) 81.60 48.0371 1248.52 96.9 M SegFormer-B2.yaml Inference Model/Trained Model SegFormer-B3 (slice) 82.47 64.341 1666.35 167.3 M SegFormer-B3.yaml Inference Model/Trained Model SegFormer-B4 (slice) 82.38 82.4336 1995.42 226.7 M SegFormer-B4.yaml Inference Model/Trained Model SegFormer-B5 (slice) 82.58 97.3717 2420.19 229.7 M SegFormer-B5.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the Cityscapes dataset using mIoU.

Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SeaFormer_base(slice) 40.92 24.4073 397.574 30.8 M SeaFormer_base.yaml Inference Model/Trained Model SeaFormer_large (slice) 43.66 27.8123 550.464 49.8 M SeaFormer_large.yaml Inference Model/Trained Model SeaFormer_small (slice) 38.73 19.2295 358.343 14.3 M SeaFormer_small.yaml Inference Model/Trained Model SeaFormer_tiny (slice) 34.58 13.9496 330.132 6.1 M SeaFormer_tiny.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the ADE20k dataset. \"slice\" indicates that the input image has been cropped.

"},{"location":"en/support_list/models_list.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Mask-RT-DETR-H 50.6 132.693 4896.17 449.9 M Mask-RT-DETR-H.yaml Inference Model/Trained Model Mask-RT-DETR-L 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-L.yaml Inference Model/Trained Model Mask-RT-DETR-M 42.7 36.8329 - 66.6 M Mask-RT-DETR-M.yaml Inference Model/Trained Model Mask-RT-DETR-S 41.0 33.5007 - 51.8 M Mask-RT-DETR-S.yaml Inference Model/Trained Model Mask-RT-DETR-X 47.5 75.755 3358.04 237.5 M Mask-RT-DETR-X.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 - - 254.8 M Cascade-MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 - - 254.7 M Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 - - 157.5 M MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 - - 157.5 M MaskRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50 32.8 - - 127.8 M MaskRCNN-ResNet50.yaml Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 - - 225.4 M MaskRCNN-ResNet101-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 - - 225.1 M MaskRCNN-ResNet101-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 - - 370.0 M MaskRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model PP-YOLOE_seg-S 32.5 - - 31.5 M PP-YOLOE_seg-S.yaml Inference Model/Trained Model

|SOLOv2| 35.5|-|-|179.1 M|SOLOv2.yaml

Note: The above accuracy metrics are evaluated on the COCO2017 validation set using Mask AP(0.5:0.95).

"},{"location":"en/support_list/models_list.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_det 77.79 10.6923 120.177 4.2 M PP-OCRv4_mobile_det.yaml Inference Model/Trained Model PP-OCRv4_server_det 82.69 83.3501 2434.01 100.1M PP-OCRv4_server_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection.

"},{"location":"en/support_list/models_list.html#seal-text-detection-module","title":"Seal Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7 M PP-OCRv4_mobile_seal_det.yaml Inference Model/Trained Model PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built seal dataset by PaddleX, containing 500 seal images.

"},{"location":"en/support_list/models_list.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_rec 78.20 7.95018 46.7868 10.6 M PP-OCRv4_mobile_rec.yaml Inference Model/Trained Model PP-OCRv4_server_rec 79.20 7.19439 140.179 71.2 M PP-OCRv4_server_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_SVTRv2_rec 68.81 8.36801 165.706 73.9 M ch_SVTRv2_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_RepSVTR_rec 65.07 10.5047 51.5647 22.1 M ch_RepSVTR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/models_list.html#formula-recognition-module","title":"Formula Recognition Module","text":"Model Name BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link LaTeX_OCR_rec 0.8821 0.0823 40.01 - - 89.7 M LaTeX_OCR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/support_list/models_list.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SLANet 59.52 522.536 1845.37 6.9 M SLANet.yaml Inference Model/Trained Model SLANet_plus 63.69 522.536 1845.37 6.9 M SLANet_plus.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#image-rectification-module","title":"Image Rectification Module","text":"Model Name MS-SSIM (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link UVDoc 54.40 - - 30.3 M UVDoc.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on a self-built image rectification dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#layout-detection-module","title":"Layout Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PicoDet_layout_1x 86.8 13.036 91.2634 7.4 M PicoDet_layout_1x.yaml Inference Model/Trained Model PicoDet-S_layout_3cls 87.1 13.521 45.7633 4.8 M PicoDet-S_layout_3cls.yaml Inference Model/Trained Model PicoDet-S_layout_17cls 70.3 13.5632 46.2059 4.8 M PicoDet-S_layout_17cls.yaml Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 15.7425 159.771 22.6 M PicoDet-L_layout_3cls.yaml Inference Model/Trained Model PicoDet-L_layout_17cls 79.9 17.1901 160.262 22.6 M PicoDet-L_layout_17cls.yaml Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 114.644 3832.62 470.1 M RT-DETR-H_layout_3cls.yaml Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 115.126 3827.25 470.2 M RT-DETR-H_layout_17cls.yaml Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is the PaddleX self-built Layout Detection Dataset, containing 10,000 images.

"},{"location":"en/support_list/models_list.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size YAML File Model Download Link DLinear 0.382 0.394 72 K DLinear.yaml Inference Model/Trained Model NLinear 0.386 0.392 40 K NLinear.yaml Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Nonstationary.yaml Inference Model/Trained Model PatchTST 0.385 0.397 2.0 M PatchTST.yaml Inference Model/Trained Model RLinear 0.384 0.392 40 K RLinear.yaml Inference Model/Trained Model TiDE 0.405 0.412 31.7 M TiDE.yaml Inference Model/Trained Model TimesNet 0.417 0.431 4.9 M TimesNet.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall f1_score Model Size YAML File Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52 K AutoEncoder_ad.yaml Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112 K DLinear_ad.yaml Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8 M Nonstationary_ad.yaml Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320 K PatchTST_ad.yaml Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3 M TimesNet_ad.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/models_list.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name acc (%) Model Size YAML File Model Download Link TimesNet_cls 87.5 792 K TimesNet_cls.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset.

>Note: All GPU inference times for the above models are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/support_list/pipelines_list.html","title":"PaddleX Pipelines (CPU/GPU)","text":""},{"location":"en/support_list/pipelines_list.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
Document Scene Information Extraction v3 Table Structure Recognition Online Experience Document Image Scene Information Extraction v3 (PP-ChatOCRv3-doc) is a PaddlePaddle-specific intelligent document and image analysis solution that integrates LLM and OCR technologies to solve common complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating the Wenxin large model, it combines vast data and knowledge, providing high accuracy and wide applicability. The open-source version supports local experience and deployment, and fine-tuning training for each module.
  • Construction of knowledge graphs
  • Detection of information related to specific events in online news and social media
  • Extraction and analysis of key information in academic literature (especially in scenarios requiring recognition of seals, distorted images, and more complex tables)
Layout Area Detection Text Detection Text Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
Multi-label Image Classification Multi-label Image Classification None Image multi-label classification is a technology that assigns an image to multiple related categories simultaneously. It is widely used in image tagging, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, such as both \"dog\" and \"outdoor\" labels in a single picture. By using deep learning models, image multi-label classification can automatically extract image features and perform accurate classification to provide more comprehensive information for users. This technology is significant in applications like intelligent search engines and automatic content generation.
  • Medical image diagnosis
  • Complex scene recognition
  • Multi-target monitoring
  • Product attribute recognition
  • Ecological environment monitoring
  • Security monitoring
  • Disaster warning
Small Object Detection Small Object Detection None Small object detection is a technology specifically for identifying small objects in images. It is widely used in surveillance, autonomous driving, and satellite image analysis. It can accurately find and classify small-sized objects like pedestrians, traffic signs, or small animals in complex scenes. By using deep learning algorithms and optimized convolutional neural networks, small object detection can effectively enhance the recognition ability of small objects, ensuring that important information is not missed in practical applications. This technology plays an important role in improving safety and automation levels.
  • Pedestrian detection in autonomous vehicles
  • Identification of small buildings in satellite images
  • Detection of small traffic signs in intelligent transportation systems
  • Identification of small intruding objects in security surveillance
  • Detection of small defects in industrial inspection
  • Monitoring of small animals in drone images
Image Anomaly Detection Image Anomaly Detection None Image anomaly detection is a technology that identifies images that deviate from or do not conform to normal patterns by analyzing their content. It is widely used in industrial quality inspection, medical image analysis, and security surveillance. By using machine learning and deep learning algorithms, image anomaly detection can automatically identify potential defects, anomalies, or abnormal behavior in images, helping us detect problems and take appropriate measures promptly. Image anomaly detection systems are designed to automatically detect and label abnormal situations in images to improve work efficiency and accuracy.
  • Industrial quality control
  • Medical image analysis
  • Anomaly detection in surveillance videos
  • Identification of violations in traffic monitoring
  • Obstacle detection in autonomous driving
  • Agricultural pest and disease monitoring
  • Pollutant identification in environmental monitoring
Layout Parsing Table Structure Recognition None Layout analysis is a technology for extracting structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has wide applications in document management, information extraction, and data digitization. By combining optical character recognition (OCR), image processing, and machine learning algorithms, layout analysis can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. This process typically includes three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data that enhances data processing efficiency and accuracy.
  • Financial and legal document analysis
  • Digitization of historical documents and archives
  • Automated form filling
  • Page structure analysis
Layout Area Detection Text Detection Text Recognition Formula Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification Formula Recognition Layout Area Detection None Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. By using computer vision and machine learning algorithms, formula recognition can convert complex mathematical formula information into an editable LaTeX format, facilitating further data processing and analysis by users.
  • Document digitization and retrieval
  • Formula search engine
  • Formula editor
  • Automated typesetting
Formula Recognition Seal Text Recognition Layout Area Detection None Seal text recognition is a technology that automatically extracts and recognizes seal content from documents or images. Recognizing seal text is part of document processing and has applications in many scenarios, such as contract comparison, inventory audit, and invoice reimbursement audit.
  • Contract and agreement validation
  • Check processing
  • Loan approval
  • Legal document management
Seal Text Detection Text Recognition"},{"location":"en/support_list/pipelines_list.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience Link Pipeline Introduction Applicable Scenarios Semi-supervised Learning for Large Models - Image Classification Semi-supervised Learning for Large Models - Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The general image classification pipeline is designed to solve image classification tasks for given images.
  • Commodity image classification
  • Artwork style classification
  • Crop disease and pest identification
  • Animal species recognition
  • Classification of land, water bodies, and buildings in satellite remote sensing images
Semi-supervised Learning for Large Models - Object Detection Semi-supervised Learning for Large Models - Object Detection Online Experience The semi-supervised learning for large models - object detection pipeline is a unique offering from PaddlePaddle. It utilizes a joint training approach with large and small models, leveraging a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below demonstrates the performance of this pipeline on the COCO dataset with 10% labeled data. After training with this pipeline, on COCO 10% labeled data + 90% unlabeled data, the large model (RT-DETR-H) achieves an 8.4% higher accuracy (47.7% -> 56.1%), setting a new state-of-the-art (SOTA) for this dataset. The small model (PicoDet-S) also achieves over 10% higher accuracy (18.3% -> 28.8%) compared to direct training.
  • Pedestrian, vehicle, and traffic sign detection in autonomous driving
  • Enemy facility and equipment detection in military reconnaissance
  • Seabed organism detection in deep-sea exploration
Semi-supervised Learning for Large Models - OCR Text Detection Online Experience The semi-supervised learning for large models - OCR pipeline is a unique OCR training pipeline from PaddlePaddle. It consists of a text detection model and a text recognition model working in series. The input image is first processed by the text detection model to obtain and rectify all text line bounding boxes, which are then fed into the text recognition model to generate OCR text results. In the text recognition part, a joint training approach with large and small models is adopted, utilizing a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below shows the effects of this pipeline in two OCR application scenarios, demonstrating significant improvements for both large and small models in different contexts.
  • Digitizing paper documents
  • Reading and verifying personal information on IDs, passports, and driver's licenses
  • Recognizing product information in retail
Large Model Semi-supervised Learning - Text Recognition General Scene Information Extraction v2 Text Detection Online Experience The General Scene Information Extraction Pipeline (PP-ChatOCRv2-common) is a unique intelligent analysis solution for complex documents from PaddlePaddle. It combines Large Language Models (LLMs) and OCR technology, leveraging the Wenxin Large Model to integrate massive data and knowledge, achieving high accuracy and wide applicability. The system flow of PP-ChatOCRv2-common is as follows: Input the prediction image, send it to the general OCR system, predict text through text detection and text recognition models, perform vector retrieval between the predicted text and user queries to obtain relevant text information, and finally pass these text information to the prompt generator to recombine them into prompts for the Wenxin Large Model to generate prediction results.
  • Key information extraction from various scenarios such as ID cards, bank cards, household registration books, train tickets, and paper invoices
Text Recognition"},{"location":"en/support_list/pipelines_list_dcu.html","title":"PaddleX Pipelines (DCU)","text":""},{"location":"en/support_list/pipelines_list_dcu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
"},{"location":"en/support_list/pipelines_list_dcu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_mlu.html","title":"PaddleX Pipelines (MLU)","text":""},{"location":"en/support_list/pipelines_list_mlu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis.
  • Stock prediction
  • Climate forecasting
  • Disease spread prediction
  • Energy demand forecasting
  • Traffic flow prediction
  • Product lifecycle prediction
  • Electric load forecasting
"},{"location":"en/support_list/pipelines_list_mlu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_npu.html","title":"PaddleX Pipelines (NPU)","text":""},{"location":"en/support_list/pipelines_list_npu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition General Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
"},{"location":"en/support_list/pipelines_list_npu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_xpu.html","title":"PaddleX Pipelines (XPU)","text":""},{"location":"en/support_list/pipelines_list_xpu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
"},{"location":"en/support_list/pipelines_list_xpu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"}]} \ No newline at end of file diff --git a/main/search/search_index.json b/main/search/search_index.json index 7f6bafe802..1fc8b0e998 100644 --- a/main/search/search_index.json +++ b/main/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en","zh"],"separator":"[\\s\\u200b\\-_,:!=\\[\\]()\"`/]+|\\.(?!\\d)|&[lg]t;|(?!\\b)(?=[A-Z][a-z])","pipeline":["stopWordFilter"]},"docs":[{"location":"index.html","title":"Home","text":""},{"location":"index.html#_1","title":"\ud83d\udd0d \u200b\u7b80\u4ecb","text":"

PaddleX 3.0 \u200b\u662f\u200b\u57fa\u4e8e\u200b\u98de\u6868\u200b\u6846\u67b6\u200b\u6784\u5efa\u200b\u7684\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200b\uff0c\u200b\u5b83\u200b\u96c6\u6210\u200b\u4e86\u200b\u4f17\u591a\u200b\u5f00\u7bb1\u200b\u5373\u7528\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u4ece\u200b\u8bad\u7ec3\u200b\u5230\u200b\u63a8\u7406\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u652f\u6301\u200b\u56fd\u5185\u5916\u200b\u591a\u6b3e\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\uff0c\u200b\u52a9\u529b\u200bAI \u200b\u5f00\u53d1\u8005\u200b\u8fdb\u884c\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200bOCR \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b"},{"location":"index.html#_2","title":"\ud83c\udf1f \u200b\u7279\u6027","text":"

\ud83c\udfa8 \u200b\u6a21\u578b\u200b\u4e30\u5bcc\u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1a\u200b\u5c06\u200b\u8986\u76d6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u3001OCR\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7b49\u200b\u591a\u4e2a\u200b\u5173\u952e\u200b\u9886\u57df\u200b\u7684\u200b200+ \u200b\u98de\u6868\u200b\u6a21\u578b\u200b\u6574\u5408\u200b\u4e3a\u200b19 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff0c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u3002\u200b\u540c\u65f6\u200b\u652f\u6301\u200b20+ \u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5f00\u53d1\u8005\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u4f7f\u7528\u200b\u3002

\ud83d\ude80 \u200b\u63d0\u9ad8\u6548\u7387\u200b\u964d\u4f4e\u200b\u95e8\u69db\u200b\uff1a\u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u548c\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u6253\u9020\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u7ed3\u5408\u200b\u3001\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u548c\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7684\u200b8 \u200b\u6761\u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u964d\u4f4e\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3002

\ud83c\udf10 \u200b\u591a\u79cd\u200b\u573a\u666f\u200b\u7075\u6d3b\u200b\u90e8\u7f72\u200b\uff1a\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3001\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u548c\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u7b49\u200b\u591a\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u786e\u4fdd\u200b\u4e0d\u540c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0b\u200b\u6a21\u578b\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u548c\u200b\u5feb\u901f\u200b\u54cd\u5e94\u200b\u3002

\ud83d\udd27 \u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u9ad8\u6548\u200b\u652f\u6301\u200b\uff1a\u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\uff0c\u200b\u786e\u4fdd\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u3002

"},{"location":"index.html#_3","title":"\ud83d\udce3 \u200b\u8fd1\u671f\u200b\u66f4\u65b0","text":"

\ud83d\udd25\ud83d\udd25 2024.9.30\uff0cPaddleX 3.0 Beta1 \u200b\u5f00\u6e90\u200b\u7248\u200b\u6b63\u5f0f\u200b\u53d1\u5e03\u200b\uff0c\u200b\u63d0\u4f9b\u200b 200+ \u200b\u6a21\u578b\u200b \u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1b\u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u5e76\u200b\u5f00\u6e90\u200b PP-ChatOCRv3 \u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u57fa\u7840\u200b\u80fd\u529b\u200b\uff1b\u200b\u652f\u6301\u200b 100+ \u200b\u6a21\u578b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff08\u200b\u6301\u7eed\u200b\u8fed\u4ee3\u200b\u4e2d\u200b\uff09\uff0c4\u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b8\u200b\u4e2a\u200b\u91cd\u70b9\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1b100+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6607\u200b\u817e\u200b 910B\uff0c39+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6606\u4ed1\u200b\u82af\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u3002\u200b\u4f4e\u6210\u672c\u200b\u5b8c\u6210\u200b\u4e00\u7ad9\u5f0f\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u52a0\u901f\u200b\u4ea7\u4e1a\u200b\u5e94\u7528\u200b\u3002\u200b\u65b0\u589e\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u5229\u5668\u200b\uff0c\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7b56\u7565\u200b\u663e\u8457\u200b\u589e\u5f3a\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u5b9e\u65f6\u200b\u9884\u6d4b\u200b\u300210\u200b\u6708\u200b24\u200b\u65e5\u200b\uff08\u200b\u5468\u56db\u200b\uff0919\uff1a00\u200b\u76f4\u64ad\u200b\u4e3a\u200b\u60a8\u200b\u6df1\u5ea6\u200b\u89e3\u6790\u200b PP-ChatOCRv3 \u200b\u5f00\u6e90\u200b\u7248\u672c\u200b\u4ee5\u53ca\u200b PaddleX 3.0 Beta1 \u200b\u5728\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u65b9\u9762\u200b\u7684\u200b\u5353\u8d8a\u200b\u4f18\u52bf\u200b\u3002 \u200b\u62a5\u540d\u200b\u94fe\u63a5\u200b

\u2757 \u200b\u66f4\u200b\u591a\u200b\u5b9d\u85cf\u200b\u8bfe\u7a0b\u200b

\ud83d\udd25 2024.6.27\uff0cPaddleX 3.0 Beta \u200b\u5f00\u6e90\u200b\u7248\u200b\u6b63\u5f0f\u200b\u53d1\u5e03\u200b\uff0c\u200b\u652f\u6301\u200b\u4ee5\u4f4e\u200b\u4ee3\u7801\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5728\u200b\u672c\u5730\u200b\u7aef\u200b\u4f7f\u7528\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8fdb\u884c\u200b\u4ea7\u7ebf\u200b\u548c\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u3002

\ud83d\udd25 2024.3.25\uff0cPaddleX 3.0 \u200b\u4e91\u7aef\u200b\u53d1\u5e03\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4ee5\u200b\u96f6\u200b\u4ee3\u7801\u200b\u7684\u200b\u65b9\u5f0f\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\u200b\u4f7f\u7528\u200b\u3002

\u200b\u66f4\u200b\u591a\u200b

"},{"location":"index.html#_4","title":"\ud83d\udd20 \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u8bf4\u660e","text":"

PaddleX \u200b\u81f4\u529b\u4e8e\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7ea7\u522b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3001\u200b\u63a8\u7406\u200b\u4e0e\u200b\u90e8\u7f72\u200b\u3002\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u6307\u200b\u4e00\u7cfb\u5217\u200b\u9884\u5b9a\u200b\u4e49\u597d\u200b\u7684\u200b\u3001\u200b\u9488\u5bf9\u200b\u7279\u5b9a\u200bAI\u200b\u4efb\u52a1\u200b\u7684\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5305\u542b\u200b\u80fd\u591f\u200b\u72ec\u7acb\u200b\u5b8c\u6210\u200b\u67d0\u7c7b\u200b\u4efb\u52a1\u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\uff08\u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff09\u200b\u7ec4\u5408\u200b\u3002

"},{"location":"index.html#_5","title":"\ud83d\udcca \u200b\u80fd\u529b\u200b\u652f\u6301","text":"

PaddleX\u200b\u7684\u200b\u5404\u4e2a\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u672c\u5730\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5728\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5404\u4e2a\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b/\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b/\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u5b8c\u6574\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6982\u89c8\u200b\u6216\u200b\u5404\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u5728\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e3a\u200b\u5f00\u53d1\u8005\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u57fa\u4e8e\u200b\u4e91\u7aef\u200b\u56fe\u5f62\u5316\u200b\u5f00\u53d1\u200b\u754c\u9762\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u5de5\u5177\u200b, \u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\u548c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u5f00\u542f\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b\u6559\u7a0b\u200b\u300a\u200b\u96f6\u200b\u95e8\u69db\u200b\u5f00\u53d1\u200b\u4ea7\u4e1a\u200b\u7ea7\u200bAI\u200b\u6a21\u578b\u200b\u300b

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5feb\u901f\u200b\u63a8\u7406\u200b \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b \u200b\u4e8c\u6b21\u5f00\u53d1\u200b \u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b \u200b\u901a\u7528\u200bOCR \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u94fe\u63a5\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u94fe\u63a5\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u94fe\u63a5\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u4eba\u8138\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7

Tip

\u200b\u4ee5\u4e0a\u200b\u529f\u80fd\u200b\u5747\u200b\u57fa\u4e8e\u200b GPU/CPU \u200b\u5b9e\u73b0\u200b\u3002PaddleX \u200b\u8fd8\u200b\u53ef\u200b\u5728\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u3001\u200b\u5bd2\u6b66\u7eaa\u200b\u548c\u200b\u6d77\u5149\u200b\u7b49\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u548c\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u3002\u200b\u4e0b\u8868\u200b\u8be6\u7ec6\u200b\u5217\u51fa\u200b\u4e86\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b\uff0c\u200b\u5177\u4f53\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8bf7\u53c2\u9605\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u6606\u4ed1\u200b\u82af\u200bXPU)/\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u6607\u200b\u817e\u200bNPU)/\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u5bd2\u6b66\u7eaa\u200bMLU)/\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u6d77\u5149\u200bDCU)\u3002\u200b\u6211\u4eec\u200b\u6b63\u5728\u200b\u9002\u914d\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u63a8\u52a8\u200b\u9ad8\u6027\u80fd\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u7684\u200b\u5b9e\u65bd\u200b\u3002

\ud83d\udd25\ud83d\udd25 \u200b\u56fd\u4ea7\u5316\u200b\u786c\u4ef6\u200b\u80fd\u529b\u200b\u652f\u6301\u200b

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u6607\u200b\u817e\u200b 910B \u200b\u6606\u4ed1\u200b\u82af\u200b R200/R300 \u200b\u5bd2\u6b66\u7eaa\u200b MLU370X8 \u200b\u6d77\u5149\u200b Z100 \u200b\u901a\u7528\u200bOCR \u2705 \u2705 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u2705 \u2705 \u2705 \u2705 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u2705 \u2705 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7"},{"location":"index.html#discussion","title":"\ud83d\udcac Discussion","text":"

\u200b\u6211\u4eec\u200b\u975e\u5e38\u200b\u6b22\u8fce\u200b\u5e76\u200b\u9f13\u52b1\u200b\u793e\u533a\u200b\u6210\u5458\u200b\u5728\u200b Discussions \u200b\u677f\u5757\u200b\u4e2d\u200b\u63d0\u51fa\u200b\u95ee\u9898\u200b\u3001\u200b\u5206\u4eab\u200b\u60f3\u6cd5\u200b\u548c\u200b\u53cd\u9988\u200b\u3002\u200b\u65e0\u8bba\u200b\u60a8\u200b\u662f\u200b\u60f3\u8981\u200b\u62a5\u544a\u200b\u4e00\u4e2a\u200b bug\u3001\u200b\u8ba8\u8bba\u200b\u4e00\u4e2a\u200b\u529f\u80fd\u200b\u8bf7\u6c42\u200b\u3001\u200b\u5bfb\u6c42\u200b\u5e2e\u52a9\u200b\u8fd8\u662f\u200b\u4ec5\u4ec5\u200b\u60f3\u8981\u200b\u4e86\u89e3\u200b\u9879\u76ee\u200b\u7684\u200b\u6700\u65b0\u200b\u52a8\u6001\u200b\uff0c\u200b\u8fd9\u91cc\u200b\u90fd\u200b\u662f\u200b\u4e00\u4e2a\u200b\u7edd\u4f73\u200b\u7684\u200b\u5e73\u53f0\u200b\u3002

"},{"location":"CHANGLOG.html","title":"\u7248\u672c\u200b\u66f4\u65b0\u200b\u4fe1\u606f","text":""},{"location":"CHANGLOG.html#_2","title":"\u6700\u65b0\u200b\u7248\u672c\u4fe1\u606f","text":""},{"location":"CHANGLOG.html#paddlex-v300beta19302024","title":"PaddleX v3.0.0beta1(9.30/2024)","text":"

PaddleX 3.0 Beta1 \u200b\u63d0\u4f9b\u200b 200+ \u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1b\u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u5e76\u200b\u5f00\u6e90\u200b PP-ChatOCRv3 \u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u57fa\u7840\u200b\u80fd\u529b\u200b\uff1b\u200b\u652f\u6301\u200b 100+ \u200b\u6a21\u578b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c7 \u200b\u7c7b\u200b\u91cd\u70b9\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1b70+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6607\u200b\u817e\u200b 910B\uff0c15+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6606\u4ed1\u200b\u82af\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u3002

  • \u200b\u6a21\u578b\u200b\u4e30\u5bcc\u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1a \u200b\u5c06\u200b\u8986\u76d6\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u3001OCR\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7b49\u200b\u591a\u4e2a\u200b\u5173\u952e\u200b\u9886\u57df\u200b\u7684\u200b 200+ \u200b\u98de\u6868\u200b\u6a21\u578b\u200b\u6574\u5408\u200b\u4e3a\u200b 13 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff0c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u3002\u200b\u540c\u65f6\u200b\u652f\u6301\u200b 20+ \u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5f00\u53d1\u8005\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u4f7f\u7528\u200b\u3002
  • \u200b\u63d0\u9ad8\u6548\u7387\u200b\u964d\u4f4e\u200b\u95e8\u69db\u200b\uff1a \u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u56fe\u5f62\u754c\u9762\u200b\u548c\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u6253\u9020\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u7ed3\u5408\u200b\u3001\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u548c\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7684\u200b8\u200b\u6761\u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u964d\u4f4e\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3002
  • \u200b\u591a\u79cd\u200b\u573a\u666f\u200b\u7075\u6d3b\u200b\u90e8\u7f72\u200b\uff1a \u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3001\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u548c\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u7b49\u200b\u591a\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u786e\u4fdd\u200b\u4e0d\u540c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0b\u200b\u6a21\u578b\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u548c\u200b\u5feb\u901f\u200b\u54cd\u5e94\u200b\u3002
  • \u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u9ad8\u6548\u200b\u652f\u6301\u200b\uff1a \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\uff0c\u200b\u786e\u4fdd\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u3002
"},{"location":"CHANGLOG.html#paddlex-v300beta6272024","title":"PaddleX v3.0.0beta(6.27/2024)","text":"

PaddleX 3.0beta \u200b\u96c6\u6210\u200b\u4e86\u200b\u98de\u6868\u200b\u751f\u6001\u200b\u7684\u200b\u4f18\u52bf\u200b\u80fd\u529b\u200b\uff0c\u200b\u8986\u76d6\u200b 7 \u200b\u5927\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200b 16 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u52a9\u529b\u200b\u5f00\u53d1\u8005\u200b\u5728\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002

  • \u200b\u57fa\u7840\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff08\u200b\u6a21\u578b\u200b\u4e30\u5bcc\u200b\uff0c\u200b\u573a\u666f\u200b\u5168\u9762\u200b\uff09\uff1a \u200b\u7cbe\u9009\u200b 68 \u200b\u4e2a\u200b\u4f18\u8d28\u200b\u98de\u6868\u200b\u6a21\u578b\u200b\uff0c\u200b\u6db5\u76d6\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u3001OCR\u3001\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7b49\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\u3002
  • \u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff08\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u6548\u7387\u200b\uff09\uff1a \u200b\u63d0\u4f9b\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u7ed3\u5408\u200b\u3001\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u548c\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7684\u200b\u9ad8\u6548\u200b\u89e3\u51b3\u65b9\u6848\u200b\u3002
  • \u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b\uff08\u200b\u4fbf\u6377\u200b\u5f00\u53d1\u200b\u4e0e\u200b\u90e8\u7f72\u200b\uff09\uff1a \u200b\u63d0\u4f9b\u200b\u96f6\u200b\u4ee3\u7801\u200b\u548c\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u4e24\u79cd\u200b\u5f00\u53d1\u65b9\u5f0f\u200b\u3002
  • \u200b\u96f6\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\uff1a\u200b\u7528\u6237\u200b\u901a\u8fc7\u200b\u56fe\u5f62\u754c\u9762\u200b\uff08GUI\uff09\u200b\u4ea4\u4e92\u5f0f\u200b\u63d0\u4ea4\u200b\u540e\u53f0\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\uff0c\u200b\u6253\u901a\u200b\u5728\u7ebf\u200b\u548c\u200b\u79bb\u7ebf\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5e76\u200b\u652f\u6301\u200b\u4ee5\u200b API \u200b\u5f62\u5f0f\u200b\u8c03\u7528\u200b\u5728\u7ebf\u200b\u670d\u52a1\u200b\u3002
  • \u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\uff1a\u200b\u901a\u8fc7\u200b\u7edf\u4e00\u200b\u7684\u200b API \u200b\u63a5\u53e3\u200b\u5b9e\u73b0\u200b 16 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u540c\u65f6\u200b\u652f\u6301\u200b\u7528\u6237\u200b\u81ea\u5b9a\u4e49\u200b\u6a21\u578b\u200b\u6d41\u7a0b\u200b\u4e32\u8054\u200b\u3002
  • \u200b\u591a\u200b\u786c\u4ef6\u200b\u672c\u5730\u200b\u652f\u6301\u200b\uff08\u200b\u517c\u5bb9\u6027\u200b\u5f3a\u200b\uff09\uff1a \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u7b49\u200b\u591a\u79cd\u200b\u786c\u4ef6\u200b\uff0c\u200b\u7eaf\u200b\u79bb\u7ebf\u200b\u4f7f\u7528\u200b\u3002
"},{"location":"CHANGLOG.html#paddlex-v21012102021","title":"PaddleX v2.1.0(12.10/2021)","text":"

\u200b\u65b0\u589e\u200b\u8d85\u200b\u8f7b\u91cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200bPPLCNet\uff0c\u200b\u5728\u200bIntel CPU\u200b\u4e0a\u200b\uff0c\u200b\u5355\u5f20\u200b\u56fe\u50cf\u200b\u9884\u6d4b\u200b\u901f\u5ea6\u200b\u7ea6\u200b5ms\uff0cImageNet-1K\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200bTop1\u200b\u8bc6\u522b\u200b\u51c6\u786e\u7387\u200b\u8fbe\u5230\u200b80.82%\uff0c\u200b\u8d85\u8d8a\u200bResNet152\u200b\u7684\u200b\u6a21\u578b\u200b\u6548\u679c\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u65b0\u589e\u200b\u8f7b\u91cf\u7ea7\u200b\u68c0\u6d4b\u200b\u7279\u8272\u200b\u6a21\u578b\u200bPP-PicoDet\uff0c\u200b\u7b2c\u4e00\u4e2a\u200b\u5728\u200b1M\u200b\u53c2\u200b\u6570\u91cf\u200b\u4e4b\u5185\u200bmAP(0.5:0.95)\u200b\u8d85\u8d8a\u200b30+(\u200b\u8f93\u5165\u200b416\u200b\u50cf\u7d20\u200b\u65f6\u200b)\uff0c\u200b\u7f51\u7edc\u200b\u9884\u6d4b\u200b\u5728\u200bARM CPU\u200b\u4e0b\u53ef\u8fbe\u200b150FPS \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u5347\u7ea7\u200bPaddleX Restful API\uff0c\u200b\u652f\u6301\u200b\u98de\u6868\u200b\u52a8\u6001\u56fe\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u65b0\u589e\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8d1f\u200b\u6837\u672c\u200b\u8bad\u7ec3\u200b\u7b56\u7565\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u65b0\u589e\u200bpython\u200b\u8f7b\u91cf\u7ea7\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b

"},{"location":"CHANGLOG.html#paddlex-v2009102021","title":"PaddleX v2.0.0(9.10/2021)","text":"
  • PaddleX API
  • \u200b\u65b0\u589e\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u3001\u200b\u4ee5\u53ca\u200b\u9884\u6d4b\u200b\u9519\u8bef\u200b\u539f\u56e0\u200b\u5206\u6790\u200b\uff0c\u200b\u8f85\u52a9\u200b\u5206\u6790\u6a21\u578b\u200b\u6548\u679c\u200b
  • \u200b\u65b0\u589e\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u8d1f\u200b\u6837\u672c\u200b\u4f18\u5316\u200b\uff0c\u200b\u6291\u5236\u200b\u80cc\u666f\u200b\u533a\u57df\u200b\u7684\u200b\u8bef\u68c0\u200b
  • \u200b\u5b8c\u5584\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u652f\u6301\u200b\u8fd4\u56de\u200b\u9884\u6d4b\u200b\u7c7b\u522b\u200b\u548c\u200b\u5f52\u4e00\u5316\u200b\u540e\u200b\u7684\u200b\u9884\u6d4b\u200b\u7f6e\u4fe1\u5ea6\u200b
  • \u200b\u5b8c\u5584\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u652f\u6301\u200b\u8fd4\u56de\u200b\u5f52\u4e00\u5316\u200b\u540e\u200b\u7684\u200b\u9884\u6d4b\u200b\u7f6e\u4fe1\u5ea6\u200b
  • \u200b\u9884\u6d4b\u200b\u90e8\u7f72\u200b
  • \u200b\u5b8c\u5907\u200bPaddleX python\u200b\u9884\u6d4b\u200b\u90e8\u7f72\u200b, PaddleX\u200b\u6a21\u578b\u200b\u4f7f\u7528\u200b2\u200b\u4e2a\u200bAPI\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u5b8c\u6210\u200b\u90e8\u7f72\u200b
  • PaddleX C++\u200b\u90e8\u7f72\u200b\u5168\u9762\u200b\u5347\u7ea7\u200b\uff0c\u200b\u652f\u6301\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u5957\u4ef6\u200bPaddleDetection\u3001PaddleClas\u3001PaddleSeg\u3001PaddleX\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u7edf\u4e00\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b
  • \u200b\u5168\u65b0\u200b\u53d1\u5e03\u200bManufacture SDK\uff0c\u200b\u63d0\u4f9b\u200b\u5de5\u4e1a\u200b\u7ea7\u200b\u591a\u7aef\u200b\u591a\u200b\u5e73\u53f0\u200b\u90e8\u7f72\u200b\u52a0\u901f\u200b\u7684\u200b\u9884\u200b\u7f16\u8bd1\u200b\u98de\u6868\u200b\u90e8\u7f72\u200b\u5f00\u53d1\u5305\u200b\uff08SDK\uff09\uff0c\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u200b\u4e1a\u52a1\u200b\u903b\u8f91\u200b\u6d41\u7a0b\u200b\u6587\u4ef6\u200b\u5373\u200b\u53ef\u4ee5\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u65b9\u5f0f\u200b\u5feb\u901f\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u90e8\u7f72\u200b
  • PaddleX GUI
  • \u200b\u5347\u7ea7\u200bPaddleX GUI\uff0c\u200b\u652f\u6301\u200b30\u200b\u7cfb\u5217\u200b\u663e\u5361\u200b
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b\u6a21\u578b\u200bPP-YOLO V2, COCO test\u200b\u6570\u636e\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u8fbe\u5230\u200b49.5%\u3001V100\u200b\u9884\u6d4b\u200b\u901f\u5ea6\u200b\u8fbe\u5230\u200b68.9 FPS
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b4.2MB\u200b\u7684\u200b\u8d85\u200b\u8f7b\u91cf\u7ea7\u200b\u6a21\u578b\u200bPP-YOLO tiny
  • \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b\u5b9e\u65f6\u200b\u5206\u5272\u200b\u6a21\u578b\u200bBiSeNetV2
  • \u200b\u65b0\u589e\u200b\u5bfc\u51fa\u200bAPI\u200b\u8bad\u7ec3\u200b\u811a\u672c\u200b\u529f\u80fd\u200b\uff0c\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200bPaddleX API\u200b\u8bad\u7ec3\u200b
  • \u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u6848\u4f8b\u200b
  • \u200b\u65b0\u589e\u200b\u4ee5\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u4e3a\u4e3b\u200b\u7684\u200b\u94a2\u7b4b\u200b\u8ba1\u6570\u200b\u3001\u200b\u7f3a\u9677\u200b\u68c0\u6d4b\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
  • \u200b\u65b0\u589e\u200b\u4ee5\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u4e3a\u4e3b\u200b\u7684\u200b\u673a\u68b0\u624b\u200b\u6293\u53d6\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
  • \u200b\u65b0\u589e\u200b\u4e32\u8054\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3001\u200b\u4f20\u7edf\u200b\u89c6\u89c9\u200b\u7b97\u6cd5\u200b\u7684\u200b\u5de5\u4e1a\u200b\u8868\u8ba1\u200b\u8bfb\u6570\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u90e8\u7f72\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
  • \u200b\u65b0\u589e\u200bWindows\u200b\u7cfb\u7edf\u200b\u4e0b\u200b\u4f7f\u7528\u200bC#\u200b\u8bed\u8a00\u200b\u90e8\u7f72\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
"},{"location":"CHANGLOG.html#paddlex-v200rc05192021","title":"PaddleX v2.0.0rc0(5.19/2021)","text":"
  • \u200b\u5168\u9762\u200b\u652f\u6301\u200b\u98de\u6868\u200b2.0\u200b\u52a8\u6001\u56fe\u200b\uff0c\u200b\u66f4\u200b\u6613\u7528\u200b\u7684\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200bPP-YOLOv2, COCO test\u200b\u6570\u636e\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u8fbe\u5230\u200b49.5%\u3001V100\u200b\u9884\u6d4b\u200b\u901f\u5ea6\u200b\u8fbe\u5230\u200b68.9 FPS
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b4.2MB\u200b\u7684\u200b\u8d85\u200b\u8f7b\u91cf\u7ea7\u200b\u6a21\u578b\u200bPP-YOLO tiny
  • \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b\u5b9e\u65f6\u200b\u5206\u5272\u200b\u6a21\u578b\u200bBiSeNetV2
  • C++\u200b\u90e8\u7f72\u200b\u6a21\u5757\u200b\u5168\u9762\u200b\u5347\u7ea7\u200b
    • PaddleInference\u200b\u90e8\u7f72\u200b\u9002\u914d\u200b2.0\u200b\u9884\u6d4b\u200b\u5e93\u200b\uff08\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\uff09
    • \u200b\u652f\u6301\u200b\u98de\u6868\u200bPaddleDetection\u3001PaddleSeg\u3001PaddleClas\u200b\u4ee5\u53ca\u200bPaddleX\u200b\u7684\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b
    • \u200b\u65b0\u589e\u200b\u57fa\u4e8e\u200bPaddleInference\u200b\u7684\u200bGPU\u200b\u591a\u5361\u200b\u9884\u6d4b\u200b\uff08\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\uff09
    • GPU\u200b\u90e8\u7f72\u200b\u65b0\u589e\u200b\u57fa\u4e8e\u200bONNX\u200b\u7684\u200b\u7684\u200bTensorRT\u200b\u9ad8\u6027\u80fd\u200b\u52a0\u901f\u200b\u5f15\u64ce\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b
    • GPU\u200b\u90e8\u7f72\u200b\u65b0\u589e\u200b\u57fa\u4e8e\u200bONNX\u200b\u7684\u200bTriton\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff08\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\uff09
"},{"location":"CHANGLOG.html#paddlex-v13012192020","title":"PaddleX v1.3.0(12.19/2020)","text":"
  • \u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b

    • \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200bResNet50_vd\u200b\u65b0\u589e\u200b10\u200b\u4e07\u200b\u5206\u7c7b\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200bFasterRCNN\u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u88c1\u526a\u200b\u652f\u6301\u200b
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u65b0\u589e\u200b\u591a\u901a\u9053\u200b\u56fe\u50cf\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b
  • \u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u66f4\u65b0\u200b

    • \u200b\u4fee\u590d\u200bOpenVINO\u200b\u90e8\u7f72\u200bC++\u200b\u4ee3\u7801\u200b\u4e2d\u200b\u90e8\u5206\u200bBug
    • \u200b\u6811\u8393\u200b\u6d3e\u200b\u90e8\u7f72\u200b\u65b0\u589e\u200bArm V8\u200b\u652f\u6301\u200b
  • \u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200b\u5de5\u4e1a\u200b\u8d28\u68c0\u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u57fa\u4e8e\u200bGPU\u200b\u548c\u200bCPU\u200b\u4e24\u79cd\u200b\u90e8\u7f72\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u8d28\u68c0\u200b\u65b9\u6848\u200b\uff0c\u200b\u53ca\u200b\u4e0e\u200b\u8d28\u68c0\u200b\u76f8\u5173\u200b\u7684\u200b\u4f18\u5316\u200b\u7b56\u7565\u200b
  • \u200b\u65b0\u589e\u200bRestFUL API\u200b\u6a21\u5757\u200b \u200b\u65b0\u589e\u200bRestFUL API\u200b\u6a21\u5757\u200b\uff0c\u200b\u5f00\u53d1\u8005\u200b\u53ef\u200b\u901a\u8fc7\u200b\u6b64\u200b\u6a21\u5757\u200b\u5feb\u901f\u200b\u5f00\u53d1\u200b\u57fa\u4e8e\u200bPaddleX\u200b\u7684\u200b\u8bad\u7ec3\u200b\u5e73\u53f0\u200b

    • \u200b\u589e\u52a0\u200b\u57fa\u4e8e\u200bRestFUL API\u200b\u7684\u200bHTML Demo
    • \u200b\u589e\u52a0\u200b\u57fa\u4e8e\u200bRestFUL API\u200b\u7684\u200bRemote\u200b\u7248\u200b\u53ef\u89c6\u5316\u200b\u5ba2\u6237\u7aef\u200b \u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200bOpenVINO\u200b\u7684\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b
"},{"location":"CHANGLOG.html#paddlex-v120992020","title":"PaddleX v1.2.0(9.9/2020)","text":"
  • \u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200bPPYOLO
    • FasterRCNN\u3001MaskRCNN\u3001YOLOv3\u3001DeepLabv3p\u200b\u7b49\u200b\u6a21\u578b\u200b\u65b0\u589e\u200b\u5185\u7f6e\u200bCOCO\u200b\u6570\u636e\u200b\u96c6\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200bFasterRCNN\u200b\u548c\u200bMaskRCNN\u200b\u65b0\u589e\u200bbackbone HRNet_W18
    • \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200bDeepLabv3p\u200b\u65b0\u589e\u200bbackbone MobileNetV3_large_ssld
  • \u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200bOpenVINO\u200b\u7684\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b
    • \u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u5728\u200b\u6811\u8393\u200b\u6d3e\u200b\u4e0a\u200b\u7684\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b
    • \u200b\u4f18\u5316\u200bPaddleLite Android\u200b\u90e8\u7f72\u200b\u7684\u200b\u6570\u636e\u200b\u9884\u5904\u7406\u200b\u548c\u200b\u540e\u5904\u7406\u200b\u4ee3\u7801\u200b\u6027\u80fd\u200b
    • \u200b\u4f18\u5316\u200bPaddle\u200b\u670d\u52a1\u7aef\u200bC++\u200b\u4ee3\u7801\u200b\u90e8\u7f72\u200b\u4ee3\u7801\u200b\uff0c\u200b\u589e\u52a0\u200buse_mkl\u200b\u7b49\u200b\u53c2\u6570\u200b\uff0c\u200b\u901a\u8fc7\u200bmkldnn\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u5728\u200bCPU\u200b\u4e0a\u200b\u7684\u200b\u9884\u6d4b\u200b\u6027\u80fd\u200b
  • \u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200bRGB\u200b\u56fe\u50cf\u200b\u9065\u611f\u200b\u5206\u5272\u200b\u6848\u4f8b\u200b
    • \u200b\u65b0\u589e\u200b\u591a\u901a\u9053\u200b\u9065\u611f\u200b\u5206\u5272\u200b\u6848\u4f8b\u200b
  • \u200b\u5176\u5b83\u200b
    • \u200b\u65b0\u589e\u200b\u6570\u636e\u200b\u96c6\u200b\u5207\u5206\u200b\u529f\u80fd\u200b\uff0c\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u5207\u5206\u200bImageNet\u3001PascalVOC\u3001MSCOCO\u200b\u548c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b
"},{"location":"CHANGLOG.html#paddlex-v1107132020","title":"PaddleX v1.1.0(7.13/2020)","text":"
  • \u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b
    • \u200b\u65b0\u589e\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200bHRNet\u3001FastSCNN
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200bFasterRCNN\u3001\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200bMaskRCNN\u200b\u65b0\u589e\u200bbackbone HRNet
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b/\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u65b0\u589e\u200bCOCO\u200b\u6570\u636e\u200b\u96c6\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b
    • \u200b\u96c6\u6210\u200bX2Paddle\uff0cPaddleX\u200b\u6240\u6709\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u548c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5bfc\u51fa\u200b\u4e3a\u200bONNX\u200b\u534f\u8bae\u200b
  • \u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u66f4\u65b0\u200b
    • \u200b\u6a21\u578b\u200b\u52a0\u5bc6\u200b\u589e\u52a0\u200b\u652f\u6301\u200bWindows\u200b\u5e73\u53f0\u200b
    • \u200b\u65b0\u589e\u200bJetson\u3001PaddleLite\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u9884\u6d4b\u200b\u65b9\u6848\u200b
    • C++\u200b\u90e8\u7f72\u200b\u4ee3\u7801\u200b\u65b0\u589e\u200bbatch\u200b\u6279\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5e76\u200b\u91c7\u7528\u200bOpenMP\u200b\u5bf9\u200b\u9884\u5904\u7406\u200b\u8fdb\u884c\u200b\u5e76\u884c\u200b\u52a0\u901f\u200b
  • \u200b\u65b0\u589e\u200b2\u200b\u4e2a\u200bPaddleX\u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b
    • \u200b\u4eba\u50cf\u200b\u5206\u5272\u200b\u6848\u4f8b\u200b
    • \u200b\u5de5\u4e1a\u200b\u8868\u8ba1\u200b\u8bfb\u6570\u200b\u6848\u4f8b\u200b
  • \u200b\u65b0\u589e\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u529f\u80fd\u200b\uff0cLabelMe\u3001\u200b\u7cbe\u7075\u200b\u6807\u6ce8\u200b\u52a9\u624b\u200b\u548c\u200bEasyData\u200b\u5e73\u53f0\u200b\u6807\u6ce8\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u4e3a\u200bPaddleX\u200b\u652f\u6301\u200b\u52a0\u8f7d\u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b
  • PaddleX\u200b\u6587\u6863\u200b\u66f4\u65b0\u200b\uff0c\u200b\u4f18\u5316\u200b\u6587\u6863\u200b\u7ed3\u6784\u200b
"},{"location":"CHANGLOG.html#paddlex-v1005212020","title":"PaddleX v1.0.0(5.21/2020)","text":"
  • \u200b\u5168\u200b\u6d41\u7a0b\u200b\u6253\u901a\u200b
  • \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\uff1a\u200b\u652f\u6301\u200bEasyData\u200b\u667a\u80fd\u200b\u6570\u636e\u200b\u670d\u52a1\u5e73\u53f0\u200b\u6570\u636e\u200b\u534f\u8bae\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5e73\u53f0\u200b\u4fbf\u6377\u200b\u5b8c\u6210\u200b\u667a\u80fd\u200b\u6807\u6ce8\u200b,\u200b\u4f4e\u8d28\u200b\u6570\u636e\u200b\u6e05\u6d17\u200b\u5de5\u4f5c\u200b, \u200b\u540c\u65f6\u200b\u517c\u5bb9\u200b\u4e3b\u6d41\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u534f\u8bae\u200b, \u200b\u52a9\u529b\u200b\u5f00\u53d1\u8005\u200b\u66f4\u200b\u5feb\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u5de5\u4f5c\u200b\u3002
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a\u200b\u96c6\u6210\u200bPaddleClas, PaddleDetection, PaddleSeg\u200b\u89c6\u89c9\u200b\u5f00\u53d1\u200b\u5957\u4ef6\u200b\uff0c\u200b\u4e30\u5bcc\u200b\u7684\u200b\u9ad8\u8d28\u91cf\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\uff0c\u200b\u66f4\u200b\u5feb\u200b\u5b9e\u73b0\u200b\u5de5\u4e1a\u200b\u7ea7\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u3002
  • \u200b\u6a21\u578b\u200b\u8c03\u4f18\u200b\uff1a\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u53ef\u200b\u89e3\u91ca\u6027\u200b\u6a21\u5757\u200b\u3001VisualDL\u200b\u53ef\u89c6\u5316\u200b\u5206\u6790\u200b\u7ec4\u4ef6\u200b, \u200b\u63d0\u4f9b\u200b\u4e30\u5bcc\u200b\u7684\u200b\u4fe1\u606f\u200b\u66f4\u597d\u200b\u5730\u200b\u7406\u89e3\u200b\u6a21\u578b\u200b\uff0c\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u3002
  • \u200b\u591a\u7aef\u200b\u5b89\u5168\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5185\u7f6e\u200bPaddleSlim\u200b\u6a21\u578b\u200b\u538b\u7f29\u5de5\u5177\u200b\u548c\u200b\u6a21\u578b\u200b\u52a0\u5bc6\u200b\u90e8\u7f72\u200b\u6a21\u5757\u200b\uff0c\u200b\u7ed3\u5408\u200bPaddle Inference\u200b\u6216\u200bPaddle Lite\u200b\u4fbf\u6377\u200b\u5b8c\u6210\u200b\u9ad8\u6027\u80fd\u200b\u7684\u200b\u591a\u7aef\u200b\u5b89\u5168\u200b\u90e8\u7f72\u200b\u3002

  • \u200b\u878d\u5408\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b

  • \u200b\u7cbe\u9009\u200b\u98de\u6868\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u7684\u200b\u6210\u719f\u200b\u6a21\u578b\u200b\u7ed3\u6784\u200b\uff0c\u200b\u5f00\u653e\u200b\u6848\u4f8b\u200b\u5b9e\u8df5\u200b\u6559\u7a0b\u200b\uff0c\u200b\u52a0\u901f\u200b\u5f00\u53d1\u8005\u200b\u4ea7\u4e1a\u200b\u843d\u5730\u200b\u3002

  • \u200b\u6613\u7528\u200b\u6613\u200b\u96c6\u6210\u200b

  • \u200b\u7edf\u4e00\u200b\u6613\u7528\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200bAPI\uff0c5\u200b\u6b65\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c10\u200b\u884c\u200b\u4ee3\u7801\u200b\u5b9e\u73b0\u200bPython/C++\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3002
  • \u200b\u63d0\u4f9b\u200b\u4ee5\u200bPaddleX\u200b\u4e3a\u200b\u6838\u5fc3\u200b\u96c6\u6210\u200b\u7684\u200b\u8de8\u5e73\u53f0\u200b\u53ef\u89c6\u5316\u200b\u5de5\u5177\u200bPaddleX-GUI\uff0c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u98de\u6868\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u5168\u200b\u6d41\u7a0b\u200b\u3002
"},{"location":"FAQ.html","title":"FAQ","text":""},{"location":"FAQ.html#qpaddlex","title":"Q\uff1aPaddleX\u200b\u662f\u200b\u4ec0\u4e48\u200b\uff1f","text":"

A\uff1aPaddleX \u200b\u662f\u200b\u7531\u200b\u98de\u6868\u200b\u56e2\u961f\u200b\u63a8\u51fa\u200b\u7684\u200b\u4e00\u6b3e\u200b\u7cbe\u9009\u200b\u6a21\u578b\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200b\uff0c\u200b\u65e8\u5728\u200b\u4e3a\u200b\u5f00\u53d1\u8005\u200b\u63d0\u4f9b\u200b\u4e00\u4e2a\u200b\u66f4\u52a0\u200b\u4fbf\u6377\u200b\u548c\u200b\u9ad8\u6548\u200b\u7684\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\u3002\u200b\u8fd9\u200b\u6b3e\u200b\u5de5\u5177\u200b\u4e0d\u4ec5\u200b\u652f\u6301\u200b\u56fd\u5185\u5916\u200b\u591a\u6b3e\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u63a8\u7406\u200b\uff0c\u200b\u8fd8\u200b\u80fd\u591f\u200b\u517c\u5bb9\u200b\u591a\u79cd\u4e0d\u540c\u200b\u7684\u200b\u7cfb\u7edf\u914d\u7f6e\u200b\uff0c\u200b\u4ece\u800c\u200b\u6ee1\u8db3\u7528\u6237\u200b\u5728\u200b\u4e0d\u540c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u9700\u6c42\u200b\u3002PaddleX \u200b\u7684\u200b\u5e94\u7528\u200b\u8303\u56f4\u200b\u975e\u5e38\u200b\u5e7f\u6cdb\u200b\uff0c\u200b\u8986\u76d6\u200b\u4e86\u200b\u5de5\u4e1a\u200b\u3001\u200b\u80fd\u6e90\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u3001\u200b\u6559\u80b2\u200b\u7b49\u200b\u591a\u4e2a\u200b\u884c\u4e1a\u200b\u9886\u57df\u200b\uff0c\u200b\u80fd\u591f\u200b\u4e3a\u200b\u8fd9\u4e9b\u200b\u884c\u4e1a\u200b\u63d0\u4f9b\u200b\u4e13\u4e1a\u200b\u7684\u200b\u652f\u6301\u200b\u548c\u200b\u89e3\u51b3\u65b9\u6848\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b PaddleX \uff0c\u200b\u5f00\u53d1\u8005\u200b\u53ef\u4ee5\u200b\u66f4\u200b\u5bb9\u6613\u200b\u5730\u200b\u5c06\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6280\u672f\u200b\u5e94\u7528\u200b\u4e8e\u200b\u5b9e\u9645\u200b\u7684\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u4e2d\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u6280\u672f\u200b\u7684\u200b\u843d\u5730\u200b\u548c\u200b\u8f6c\u5316\u200b\uff0c\u200b\u4fc3\u8fdb\u200b\u5404\u200b\u884c\u4e1a\u200b\u7684\u200b\u6570\u5b57\u5316\u200b\u8f6c\u578b\u200b\u548c\u200b\u667a\u80fd\u5316\u200b\u5347\u7ea7\u200b\u3002

"},{"location":"FAQ.html#q","title":"Q\uff1a\u200b\u4ec0\u4e48\u200b\u662f\u200b\u4ea7\u7ebf\u200b\uff1f\u200b\u4ec0\u4e48\u200b\u662f\u200b\u6a21\u5757\u200b\uff1f\u200b\u4e8c\u8005\u200b\u6709\u4f55\u200b\u5173\u7cfb\u200b\uff1f","text":"

A\uff1a\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\uff0c\u200b\u6a21\u5757\u200b\u88ab\u200b\u5b9a\u4e49\u200b\u4e3a\u200b\u5b9e\u73b0\u200b\u57fa\u672c\u529f\u80fd\u200b\u7684\u200b\u6700\u5c0f\u200b\u5355\u4f4d\u200b\uff0c\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u627f\u62c5\u200b\u7740\u200b\u7279\u5b9a\u200b\u7684\u200b\u4efb\u52a1\u200b\uff0c\u200b\u4f8b\u5982\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u57fa\u672c\u529f\u80fd\u200b\u3002\u200b\u5728\u200b\u8fd9\u4e2a\u200b\u6846\u67b6\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u7ebf\u200b\u5219\u200b\u662f\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u5757\u200b\u5171\u540c\u200b\u4f5c\u7528\u200b\u6240\u200b\u5b9e\u73b0\u200b\u7684\u200b\u5b9e\u9645\u200b\u529f\u80fd\u200b\uff0c\u200b\u8fd9\u79cd\u200b\u529f\u80fd\u200b\u7684\u200b\u6574\u5408\u200b\u901a\u5e38\u200b\u4f1a\u200b\u5f62\u6210\u200b\u66f4\u200b\u590d\u6742\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff08OCR\uff09\u200b\u7b49\u200b\u6280\u672f\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u6a21\u5757\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u4e4b\u95f4\u200b\u7684\u200b\u5173\u7cfb\u200b\u53ef\u4ee5\u200b\u7406\u89e3\u200b\u4e3a\u200b\u57fa\u7840\u200b\u4e0e\u200b\u5e94\u7528\u200b\u4e4b\u95f4\u200b\u7684\u200b\u5173\u7cfb\u200b\uff0c\u200b\u6a21\u5757\u200b\u4f5c\u4e3a\u200b\u6700\u5c0f\u200b\u5355\u4f4d\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6784\u5efa\u200b\u7684\u200b\u57fa\u7840\u200b\uff0c\u200b\u800c\u4ea7\u7ebf\u200b\u5219\u200b\u662f\u200b\u8fd9\u4e9b\u200b\u57fa\u7840\u200b\u6a21\u5757\u200b\u7ecf\u8fc7\u200b\u5408\u7406\u200b\u7ec4\u5408\u200b\u4e0e\u200b\u914d\u7f6e\u200b\u540e\u200b\u6240\u200b\u5c55\u73b0\u200b\u51fa\u6765\u200b\u7684\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u6548\u679c\u200b\u3002\u200b\u8fd9\u79cd\u200b\u8bbe\u8ba1\u200b\u65b9\u5f0f\u200b\u4f7f\u5f97\u200b\u7528\u6237\u200b\u80fd\u591f\u200b\u7075\u6d3b\u200b\u5730\u200b\u9009\u62e9\u200b\u548c\u200b\u7ec4\u5408\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5757\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u5b9e\u73b0\u200b\u4ed6\u4eec\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u529f\u80fd\u200b\uff0c\u200b\u4ece\u800c\u200b\u6781\u5927\u200b\u5730\u200b\u63d0\u5347\u200b\u4e86\u200b\u5f00\u53d1\u200b\u7684\u200b\u7075\u6d3b\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u5b98\u65b9\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3001\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u7b49\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b\u3002

"},{"location":"FAQ.html#qwheel","title":"Q\uff1a\u200b\u600e\u6837\u200b\u9009\u62e9\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u548c\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff1f","text":"

A\uff1a\u200b\u82e5\u200b\u60a8\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3b\u8981\u200b\u96c6\u4e2d\u200b\u4e8e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\uff0c\u200b\u90a3\u4e48\u200b\u6211\u4eec\u200b\u5f3a\u70c8\u63a8\u8350\u200b\u60a8\u200b\u9009\u62e9\u200b\u4e00\u79cd\u200b\u66f4\u52a0\u200b\u4fbf\u6377\u200b\u548c\u200b\u8f7b\u91cf\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5373\u200b Wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002\u200b\u8fd9\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u65e8\u5728\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u4e00\u4e2a\u200b\u5feb\u901f\u200b\u3001\u200b\u7b80\u5355\u200b\u7684\u200b\u5b89\u88c5\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u7279\u522b\u200b\u9002\u5408\u200b\u4e8e\u200b\u9700\u8981\u200b\u8fc5\u901f\u200b\u90e8\u7f72\u200b\u548c\u200b\u96c6\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u573a\u666f\u200b\u3002\u200b\u4f7f\u7528\u200b Wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u53ef\u4ee5\u200b\u663e\u8457\u200b\u51cf\u5c11\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u590d\u6742\u6027\u200b\uff0c\u200b\u907f\u514d\u200b\u4e0d\u5fc5\u8981\u200b\u7684\u200b\u914d\u7f6e\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ece\u800c\u200b\u8ba9\u200b\u5f00\u53d1\u8005\u200b\u80fd\u591f\u200b\u5c06\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u65f6\u95f4\u200b\u548c\u200b\u7cbe\u529b\u200b\u96c6\u4e2d\u200b\u5728\u200b\u6a21\u578b\u200b\u7684\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u548c\u200b\u4f18\u5316\u200b\u4e0a\u200b\u3002\u200b\u65e0\u8bba\u200b\u60a8\u200b\u662f\u200b\u65b0\u624b\u200b\u8fd8\u662f\u200b\u6709\u200b\u7ecf\u9a8c\u200b\u7684\u200b\u5f00\u53d1\u8005\u200b\uff0c\u200b\u8fd9\u79cd\u200b\u8f7b\u91cf\u5316\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u90fd\u200b\u5c06\u200b\u4e3a\u200b\u60a8\u200b\u7684\u200b\u5de5\u4f5c\u200b\u6d41\u7a0b\u200b\u5e26\u6765\u200b\u6781\u5927\u200b\u7684\u200b\u4fbf\u5229\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\u65f6\u200b\uff0c\u200b\u9009\u62e9\u200b Wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u65e0\u7591\u200b\u4f1a\u200b\u8ba9\u200b\u60a8\u200b\u7684\u200b\u6574\u4e2a\u200b\u5f00\u53d1\u200b\u8fc7\u7a0b\u200b\u66f4\u52a0\u200b\u9ad8\u6548\u200b\u6d41\u7545\u200b\u3002

"},{"location":"FAQ.html#qpaddlex_1","title":"Q\uff1aPaddleX\u200b\u548c\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u533a\u522b\u200b\u662f\u200b\u4ec0\u4e48\u200b\uff1f","text":"

A\uff1a\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u662f\u200bPaddleX \u200b\u7684\u200b\u4e91\u7aef\u200b\u8f7d\u4f53\u200b\uff0c\u200b\u5e95\u5c42\u200b\u4ee3\u7801\u200b\u4e0e\u200bPaddleX\u200b\u4fdd\u6301\u4e00\u81f4\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u8ba4\u4e3a\u200b\u662f\u200b\u4e91\u7aef\u200bPaddleX\u3002\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8bbe\u8ba1\u200b\u7406\u5ff5\u200b\u662f\u200b\u8ba9\u200b\u7528\u6237\u200b\u80fd\u591f\u200b\u5728\u200b\u65e0\u9700\u200b\u6df1\u5165\u200b\u4e86\u89e3\u200b\u7f16\u7a0b\u200b\u548c\u200b\u7b97\u6cd5\u200b\u77e5\u8bc6\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5feb\u901f\u200b\u6784\u5efa\u200b\u548c\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\uff0c\u200b\u5728\u200b\u6b64\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f88\u591a\u200b\u7279\u8272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5982\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u5c11\u91cf\u200b\u6837\u672c\u200b\u8bad\u7ec3\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u4f7f\u7528\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65b9\u6848\u200b\u89e3\u51b3\u200b\u590d\u6742\u200b\u65f6\u5e8f\u200b\u95ee\u9898\u200b\u7b49\u200b\u3002PaddleX \u200b\u662f\u200b\u4e00\u79cd\u200b\u672c\u5730\u200b\u5f00\u53d1\u5de5\u5177\u200b\uff0c\u200b\u5b83\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u529f\u80fd\u200b\uff0c\u200b\u652f\u6301\u200b\u8fdb\u884c\u200b\u66f4\u200b\u6df1\u5165\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u3002\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u5f00\u53d1\u8005\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6839\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u9700\u6c42\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u7684\u200b\u8c03\u6574\u200b\u548c\u200b\u6269\u5c55\u200b\uff0c\u200b\u521b\u5efa\u200b\u51fa\u200b\u66f4\u200b\u7b26\u5408\u200b\u7279\u5b9a\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u89e3\u51b3\u65b9\u6848\u200b\u3002\u200b\u4e14\u200bPaddleX\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u63a5\u53e3\u200b\uff0c\u200b\u652f\u6301\u200b\u7528\u6237\u200b\u81ea\u7531\u200b\u5730\u200b\u7ec4\u5408\u200b\u6a21\u578b\u200b\u4f7f\u7528\u200b\u3002

"},{"location":"FAQ.html#qpaddlex_2","title":"Q\uff1a\u200b\u5f53\u200b\u6211\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u9047\u5230\u200b\u95ee\u9898\u200b\uff0c\u200b\u5e94\u8be5\u200b\u600e\u6837\u200b\u53cd\u9988\u200b\u5462\u200b\uff1f","text":"

A\uff1a\u200b\u6b22\u8fce\u200b\u6765\u200b\u8ba8\u8bba\u533a\u200b\u4e0e\u200b\u6d77\u91cf\u200b\u5f00\u53d1\u8005\u200b\u4e00\u8d77\u200b\u4ea4\u6d41\u200b\uff01\u200b\u82e5\u200b\u60a8\u200b\u53d1\u73b0\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u9519\u8bef\u200b\u6216\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u4e5f\u200b\u6b22\u8fce\u200b\u5411\u200b\u6211\u4eec\u200b\u63d0\u51fa\u200bissue\uff0c\u200b\u503c\u73ed\u200b\u540c\u5b66\u200b\u5c06\u200b\u5c3d\u5feb\u200b\u4e3a\u200b\u60a8\u200b\u89e3\u7b54\u200b\u95ee\u9898\u200b\u3002

"},{"location":"quick_start.html","title":"\u5feb\u901f\u200b\u5f00\u59cb","text":""},{"location":"quick_start.html#_1","title":"\ud83d\udee0\ufe0f \u200b\u5b89\u88c5","text":"

\u2757\u200b\u5b89\u88c5\u200b PaddleX \u200b\u524d\u200b\u8bf7\u200b\u5148\u200b\u786e\u4fdd\u60a8\u200b\u6709\u200b\u57fa\u7840\u200b\u7684\u200b Python \u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\uff08\u200b\u6ce8\u200b\uff1a\u200b\u5f53\u524d\u200b\u652f\u6301\u200bPython 3.8 \uff5e Python 3.10\u200b\u4e0b\u200b\u8fd0\u884c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200bPython\u200b\u7248\u672c\u200b\u9002\u914d\u200b\u4e2d\u200b\uff09\u3002

  • \u200b\u5b89\u88c5\u200b PaddlePaddle

    # cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

    \u2757 \u200b\u66f4\u591a\u200b\u98de\u6868\u200b Wheel \u200b\u7248\u672c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u3002

  • \u200b\u5b89\u88c5\u200bPaddleX

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n

\u2757 \u200b\u66f4\u200b\u591a\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"quick_start.html#_2","title":"\ud83d\udcbb \u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u7edf\u4e00\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a

paddlex --pipeline [\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b] --input [\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b] --device [\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b]\n

\u200b\u53ea\u200b\u9700\u200b\u6307\u5b9a\u200b\u4e09\u4e2a\u200b\u53c2\u6570\u200b\uff1a

  • pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b
  • input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u6587\u4ef6\u200b\uff08\u200b\u5982\u200b\u56fe\u7247\u200b\uff09\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200b URL
  • device: \u200b\u4f7f\u7528\u200b\u7684\u200b GPU \u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b 0 \u200b\u5757\u200b GPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200b CPU\uff08cpu\uff09

\u200b\u4ee5\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0\n
\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

{\n'input_path': '/root/.paddlex/predict_input/general_ocr_002.png',\n'dt_polys': [array([[161,  27],\n       [353,  22],\n       [354,  69],\n       [162,  74]], dtype=int16), array([[426,  26],\n       [657,  21],\n       [657,  58],\n       [426,  62]], dtype=int16), array([[702,  18],\n       [822,  13],\n       [824,  57],\n       [704,  62]], dtype=int16), array([[341, 106],\n       [405, 106],\n       [405, 128],\n       [341, 128]], dtype=int16)\n       ...],\n'dt_scores': [0.758478200014338, 0.7021546472698513, 0.8536622648391111, 0.8619181462164781, 0.8321051217096188, 0.8868756173427551, 0.7982964727675609, 0.8289939036796322, 0.8289428877522524, 0.8587063317632897, 0.7786755892491615, 0.8502032769081344, 0.8703346500042997, 0.834490931790065, 0.908291103353393, 0.7614978661708064, 0.8325774055997542, 0.7843421347676149, 0.8680889482955594, 0.8788859304537682, 0.8963341277518075, 0.9364654810069546, 0.8092413027028257, 0.8503743089091863, 0.7920740420391101, 0.7592224394793805, 0.7920547400069311, 0.6641757962457888, 0.8650289477605955, 0.8079483304467047, 0.8532207681055275, 0.8913377034754717],\n'rec_text': ['\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', 'CLASS', '\u200b\u5e8f\u53f7\u200b SERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200b', '\u200b\u65e5\u671f\u200b DATE', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHW', '035', 'MU2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', \u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE10MINUTESBEFOREDEPARTURETIME'],\n'rec_score': [0.9985831379890442, 0.999696917533874512, 0.9985735416412354, 0.9842517971992493, 0.9383274912834167, 0.9943678975105286, 0.9419361352920532, 0.9221674799919128, 0.9555020928382874, 0.9870321154594421, 0.9664073586463928, 0.9988052248954773, 0.9979352355003357, 0.9985110759735107, 0.9943482875823975, 0.9991195797920227, 0.9936401844024658, 0.9974591135978699, 0.9743705987930298, 0.9980487823486328, 0.9874696135520935, 0.9900962710380554, 0.9952947497367859, 0.9950481653213501, 0.989926815032959, 0.9915552139282227, 0.9938777685165405, 0.997239887714386, 0.9963340759277344, 0.9936134815216064, 0.97223961353302]}\n

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4f7f\u7528\u200b\u547d\u4ee4\u200b

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b paddlex --pipeline image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b paddlex --pipeline instance_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png --device gpu:0 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b paddlex --pipeline semantic_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png --device gpu:0 \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b paddlex --pipeline small_object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/small_object_detection.jpg --device gpu:0 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b paddlex --pipeline anomaly_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_grid.png --device gpu:0 \u200b\u901a\u7528\u200bOCR paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b paddlex --pipeline table_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg --device gpu:0 \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b paddlex --pipeline layout_parsing --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/demo_paper.png --device gpu:0 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b paddlex --pipeline formula_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/demo_image/general_formula_recognition.png --device gpu:0 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b paddlex --pipeline seal_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/seal_text_det.png --device gpu:0 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b paddlex --pipeline ts_fc --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv --device gpu:0 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b paddlex --pipeline ts_ad --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv --device gpu:0 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b paddlex --pipeline ts_cls --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv --device gpu:0"},{"location":"quick_start.html#python","title":"\ud83d\udcdd Python \u200b\u811a\u672c\u200b\u4f7f\u7528","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u7edf\u4e00\u200b\u7684\u200b Python \u200b\u811a\u672c\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=[\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b])\noutput = pipeline.predict([\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u540d\u79f0\u200b])\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n
\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

  • create_pipeline() \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b
  • \u200b\u4f20\u5165\u200b\u56fe\u7247\u200b\u5e76\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b
  • \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b

\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u7684\u200b Python \u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5c06\u200b create_pipeline() \u200b\u65b9\u6cd5\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u200b\u8c03\u6574\u200b\u4e3a\u200b\u76f8\u5e94\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u540d\u79f0\u200b\u3002\u200b\u4e0b\u9762\u200b\u5217\u51fa\u200b\u4e86\u200b\u6bcf\u4e2a\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u7684\u200b\u53c2\u6570\u200b\u540d\u79f0\u200b\u53ca\u200b\u8be6\u7ec6\u200b\u7684\u200b\u4f7f\u7528\u200b\u89e3\u91ca\u200b\uff1a

\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u5bf9\u5e94\u200b\u53c2\u6570\u200b \u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 PP-ChatOCRv3-doc \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b image_classification \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b object_detection \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b instance_segmentation \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b semantic_segmentation \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b multi_label_image_classification \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b small_object_detection \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b anomaly_detection \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200bOCR OCR \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b table_recognition \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b layout_parsing \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b formula_recognition \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b seal_recognition \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b ts_fc \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b ts_ad \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b ts_cls \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e"},{"location":"data_annotations/cv_modules/image_classification.html","title":"PaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_classification.html#1-labelme","title":"1. Labelme \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/image_classification.html#11-labelme","title":"1.1 Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_classification.html#12-labelme","title":"1.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/image_classification.html#13-labelme","title":"1.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/image_classification.html#131","title":"1.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b pets\u3002
  • \u200b\u5728\u200b pets \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
  • \u200b\u5728\u200b pets \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b flags.txt\uff0c\u200b\u5e76\u200b\u5728\u200b flags.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u4ee5\u732b\u200b\u72d7\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b flags.txt \u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/image_classification.html#132-labelme","title":"1.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON \u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_classification.html#133","title":"1.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b Flags \u200b\u754c\u9762\u200b\u9009\u62e9\u200b\u7c7b\u522b\u200b\u3002

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

  • \u200b\u5b8c\u6210\u200b\u5168\u90e8\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200bconvert_to_imagenet.py\u200b\u811a\u672c\u200b\u5c06\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ImageNet-1k \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u751f\u6210\u200b train.txt\uff0cval.txt \u200b\u548c\u200blabel.txt\u3002

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path\u200b\u4e3a\u200b\u6807\u6ce8\u200b\u7684\u200b labelme \u200b\u683c\u5f0f\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

  • \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/image_classification.html#2","title":"2. \u200b\u6570\u636e\u683c\u5f0f","text":"
  • PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b ClsDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200btrain.txt\u3001val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 label.txt  # \u200b\u6807\u6ce8\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u7c7b\u522b\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a45 wallflower\n\u251c\u2500\u2500 train.txt  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200bid\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/image_06765.jpg 0\n\u2514\u2500\u2500 val.txt    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200bid\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/image_06767.jpg 10\n
* \u200b\u5982\u679c\u200b\u60a8\u200b\u5df2\u6709\u200b\u6570\u636e\u200b\u96c6\u4e14\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u4e3a\u200b\u5982\u4e0b\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f46\u662f\u200b\u6ca1\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u811a\u672c\u200b\u5c06\u200b\u5df2\u6709\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u751f\u6210\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002

dataset_dir          # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images           # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n   \u251c\u2500\u2500 train         # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n      \u251c\u2500\u2500 class0     # \u200b\u7c7b\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u5426\u5219\u200b\u751f\u6210\u200b\u7684\u200b\u7c7b\u522b\u200b\u6620\u5c04\u200b\u6587\u4ef6\u200blabel.txt\u200b\u65e0\u200b\u610f\u4e49\u200b\n         \u251c\u2500\u2500 xxx.jpg # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n         \u251c\u2500\u2500 xxx.jpg # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n         ...\n      \u251c\u2500\u2500 class1     # \u200b\u7c7b\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u5426\u5219\u200b\u751f\u6210\u200b\u7684\u200b\u7c7b\u522b\u200b\u6620\u5c04\u200b\u6587\u4ef6\u200blabel.txt\u200b\u65e0\u200b\u610f\u4e49\u200b\n      ...\n   \u251c\u2500\u2500 val           # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n
* \u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b\u662f\u200b PaddleX 2.x\u200b\u7248\u672c\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5728\u200b\u7ecf\u8fc7\u8bad\u7ec3\u200b\u96c6\u200b/\u200b\u9a8c\u8bc1\u200b\u96c6\u200b/\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u5207\u5206\u200b\u540e\u200b\uff0c\u200b\u624b\u52a8\u200b\u5c06\u200b train_list.txt\u3001val_list.txt\u3001test_list.txt\u200b\u4fee\u6539\u200b\u4e3a\u200btrain.txt\u3001val.txt\u3001test.txt\uff0c\u200b\u5e76\u4e14\u200b\u6309\u7167\u200b\u89c4\u5219\u200b\u4fee\u6539\u200b label.txt \u200b\u5373\u53ef\u200b\u3002

\u200b\u539f\u7248\u200blabel.txt\uff1a

classname1\nclassname2\nclassname3\n...\n
\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200blabel.txt\uff1a

0 classname1\n1 classname2\n2 classname3\n...\n
"},{"location":"data_annotations/cv_modules/image_feature.html","title":"PaddleX\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u8be5\u200b\u90e8\u5206\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_feature.html#1-labelme","title":"1. Labelme \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/image_feature.html#11-labelme","title":"1.1 Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_feature.html#12-labelme","title":"1.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/image_feature.html#13-labelme","title":"1.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/image_feature.html#131","title":"1.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b pets\u3002
  • \u200b\u5728\u200b pets \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
  • \u200b\u5728\u200b pets \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b flags.txt\uff0c\u200b\u5e76\u200b\u5728\u200b flags.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u4ee5\u732b\u200b\u72d7\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b flags.txt \u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/image_feature.html#132-labelme","title":"1.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON \u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_feature.html#133","title":"1.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b Flags \u200b\u754c\u9762\u200b\u9009\u62e9\u200b\u7c7b\u522b\u200b\u3002

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

  • \u200b\u5b8c\u6210\u200b\u5168\u90e8\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200bconvert_to_imagenet.py\u200b\u811a\u672c\u200b\u5c06\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ImageNet-1k \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u751f\u6210\u200b train.txt\uff0cval.txt \u200b\u548c\u200blabel.txt\u3002

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path\u200b\u4e3a\u200b\u6807\u6ce8\u200b\u7684\u200b labelme \u200b\u683c\u5f0f\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

  • \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/image_feature.html#134","title":"1.3.4 \u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u5728\u200b\u83b7\u5f97\u200b LabelMe \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bShiTuRecDataset\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableMel\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u5e76\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\u3002

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u89e3\u538b\u200b LabelMe \u200b\u683c\u5f0f\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n#\u200b\u5c06\u200b LabelMe \u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\npython main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"data_annotations/cv_modules/image_feature.html#3","title":"3. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b ShiTuRecDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200btrain.txt\u3001query.txt\u3001 gallery.txt \u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 gallery.txt   # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u5f85\u200b\u68c0\u7d22\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/WOMEN/Blouses_Shirts/id_00000001/02_2_side.jpg 3997\n\u2514\u2500\u2500 query.txt     # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u6570\u636e\u5e93\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/WOMEN/Blouses_Shirts/id_00000001/02_1_front.jpg 3997\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html","title":"PaddleX\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002\u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":"

\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u662f\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u6db5\u76d6\u200b\u4e94\u79cd\u200b\u4e0d\u540c\u200b\u7684\u200b\u6c34\u679c\u200b\uff0c\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u4e0d\u540c\u200b\u89d2\u5ea6\u200b\u7684\u200b\u62cd\u6444\u200b\u7167\u7247\u200b\u3002\u200b\u56fe\u7247\u200b\u793a\u4f8b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#2-labelme","title":"2. Labelme\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/instance_segmentation.html#21-labelme","title":"2.1 Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#22-labelme","title":"2.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/instance_segmentation.html#23-labelme","title":"2.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/instance_segmentation.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b fruit\u3002
  • \u200b\u5728\u200b fruit \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200b images \u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
  • \u200b\u5728\u200b fruit \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b label.txt\uff0c\u200b\u5e76\u200b\u5728\u200b label.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u4ee5\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b label.txt \u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/instance_segmentation.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5e26\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

cd path/to/fruit\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* labels \u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200bJSON\u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b Edit \u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9009\u5219\u200b Create Polygons\u3002 * \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u521b\u5efa\u200b\u591a\u8fb9\u5f62\u200b\u63cf\u7ed8\u200b\u5206\u5272\u200b\u533a\u57df\u200b\u8fb9\u754c\u200b\u3002

* \u200b\u518d\u6b21\u200b\u70b9\u51fb\u200b\u9009\u62e9\u200b\u5206\u5272\u200b\u533a\u57df\u200b\u7c7b\u522b\u200b\u3002

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

  • \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

* \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b\u3002

  • \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6807\u51c6\u200b labelme \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b\u3002 \u2003\u2003\u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200b train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt \u200b\u4e24\u4e2a\u200b\u6587\u672c\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b annotations \u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b\u5168\u90e8\u200b json \u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u6309\u200b\u4e00\u5b9a\u200b\u6bd4\u4f8b\u200b\u5206\u522b\u200b\u5199\u5165\u200b train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u5168\u90e8\u200b\u5199\u5165\u200b\u5230\u200b train_anno_list.txt \u200b\u540c\u65f6\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u7a7a\u200b\u7684\u200b val_anno_list.txt \u200b\u6587\u4ef6\u200b\uff0c\u200b\u5f85\u200b\u4e0a\u4f20\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4f7f\u7528\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u529f\u80fd\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt \u200b\u7684\u200b\u5177\u4f53\u200b\u586b\u5199\u200b\u683c\u5f0f\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

  • \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

  • \u200b\u5c06\u200b fruit \u200b\u76ee\u5f55\u200b\u6253\u5305\u200b\u538b\u7f29\u200b\u4e3a\u200b .tar \u200b\u6216\u200b .zip \u200b\u683c\u5f0f\u200b\u538b\u7f29\u5305\u200b\u5373\u53ef\u200b\u5f97\u5230\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6807\u51c6\u200b labelme \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b\u3002
"},{"location":"data_annotations/cv_modules/instance_segmentation.html#3","title":"3. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b COCOInstSegDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir                  # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 annotations              # \u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n\u2502   \u251c\u2500\u2500 instance_train.json  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2502   \u2514\u2500\u2500 instance_val.json    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2514\u2500\u2500 images                   # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b COCO \u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

\u200b\u5f53\u200b\u5927\u5bb6\u200b\u4f7f\u7528\u200b\u7684\u200b\u662f\u200b PaddleX 2.x \u200b\u7248\u672c\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u65f6\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u5bf9\u5e94\u200b\u7684\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u90e8\u5206\u200b\uff0c\u200b\u5c06\u200b VOC \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u3002\uff08\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6ce8\u660e\u200b\uff09

\u200b\u6ce8\u200b\uff1a

  • \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u8981\u6c42\u200b\u91c7\u7528\u200b COCO \u200b\u6570\u636e\u683c\u5f0f\u200b\u6807\u6ce8\u200b\u51fa\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6bcf\u5f20\u200b\u56fe\u50cf\u200b\u5404\u4e2a\u200b\u76ee\u6807\u200b\u533a\u57df\u200b\u7684\u200b\u50cf\u7d20\u200b\u8fb9\u754c\u200b\u548c\u200b\u7c7b\u522b\u200b\uff0c\u200b\u91c7\u7528\u200b [x1,y1,x2,y2,...,xn,yn] \u200b\u8868\u793a\u200b\u7269\u4f53\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u8fb9\u754c\u200b\uff08segmentation\uff09\u3002\u200b\u5176\u4e2d\u200b\uff0c(xn,yn) \u200b\u8868\u793a\u200b\u591a\u8fb9\u5f62\u200b\u5404\u4e2a\u200b\u89d2\u70b9\u200b\u5750\u6807\u200b\u3002\u200b\u6807\u6ce8\u200b\u4fe1\u606f\u200b\u5b58\u653e\u200b\u5230\u200b annotations \u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b json \u200b\u6587\u4ef6\u200b\u4e2d\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u96c6\u200b instance_train.json \u200b\u548c\u200b\u9a8c\u8bc1\u200b\u96c6\u200b instance_val.json \u200b\u5206\u5f00\u200b\u5b58\u653e\u200b\u3002
  • \u200b\u5982\u679c\u200b\u4f60\u200b\u6709\u200b\u4e00\u6279\u200b\u672a\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b LabelMe \u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u4f7f\u7528\u200b LabelMe \u200b\u6807\u6ce8\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0cPaddleX\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002
  • \u200b\u4e3a\u200b\u786e\u4fdd\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u987a\u5229\u5b8c\u6210\u200b\uff0c\u200b\u8bf7\u200b\u4e25\u683c\u200b\u9075\u5faa\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\uff1a LabelMe \u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002
"},{"location":"data_annotations/cv_modules/ml_classification.html","title":"PaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u8fd9\u90e8\u5206\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u548c\u200bPaddleLabel\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/ml_classification.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":"

\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u662f\u200b\u4eba\u5de5\u200b\u91c7\u96c6\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u6570\u636e\u200b\u79cd\u7c7b\u200b\u6db5\u76d6\u200b\u4e86\u200b\u5b89\u5168\u5e3d\u200b\u548c\u200b\u4eba\u200b\u7684\u200b\u5934\u90e8\u200b\u4e24\u79cd\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u4e0d\u540c\u200b\u89d2\u5ea6\u200b\u7684\u200b\u62cd\u6444\u200b\u7167\u7247\u200b\u3002 \u200b\u56fe\u7247\u200b\u793a\u4f8b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/ml_classification.html#2-labelme","title":"2. Labelme\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/ml_classification.html#21-labelme","title":"2.1 Labelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/ml_classification.html#22-labelme","title":"2.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/ml_classification.html#23-labelme","title":"2.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/ml_classification.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b hemlet\u3002
  • \u200b\u5728\u200b hemlet \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b hemlet \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b label.txt\uff0c\u200b\u5e76\u200b\u5728\u200b label.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200blabel.txt\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

"},{"location":"data_annotations/cv_modules/ml_classification.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b:

cd path/to/hemlet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON\u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/ml_classification.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b Labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b\"\u200b\u7f16\u8f91\u200b\"\u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b

* \u200b\u9009\u62e9\u200b\u521b\u5efa\u200b\u77e9\u5f62\u6846\u200b

* \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u62d6\u52a8\u200b\u5341\u5b57\u200b\u6846\u9009\u200b\u76ee\u6807\u200b\u533a\u57df\u200b

* \u200b\u518d\u6b21\u200b\u70b9\u51fb\u200b\u9009\u62e9\u200b\u76ee\u6807\u200b\u6846\u200b\u7c7b\u522b\u200b

* \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b Labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

* \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b:

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bLabelme\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u4e24\u4e2a\u200b\u6587\u672c\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b\u5168\u90e8\u200bjson\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u6309\u200b\u4e00\u5b9a\u200b\u6bd4\u4f8b\u200b\u5206\u522b\u200b\u5199\u5165\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u5168\u90e8\u200b\u5199\u5165\u200b\u5230\u200btrain_anno_list.txt\u200b\u540c\u65f6\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u7a7a\u200b\u7684\u200bval_anno_list.txt\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u529f\u80fd\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002train_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u7684\u200b\u5177\u4f53\u200b\u586b\u5199\u200b\u683c\u5f0f\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/ml_classification.html#234","title":"2.3.4 \u200b\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bcoco\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u548c\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"data_annotations/cv_modules/ml_classification.html#3-paddlelabel","title":"3. PaddleLabel \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/ml_classification.html#31-paddlelabel","title":"3.1 PaddleLabel\u200b\u7684\u200b\u5b89\u88c5\u200b\u548c\u200b\u542f\u52a8","text":"
  • \u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u5e72\u51c0\u200b\u7684\u200bconda\u200b\u73af\u5883\u200b\uff1a
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • \u200b\u540c\u6837\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200bpip\u200b\u4e00\u952e\u200b\u5b89\u88c5\u200b
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • \u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4f7f\u7528\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u4e4b\u4e00\u200b\u542f\u52a8\u200b \uff1a
    paddlelabel  # \u200b\u542f\u52a8\u200bpaddlelabel\npdlabel # \u200b\u7f29\u5199\u200b\uff0c\u200b\u548c\u200bpaddlelabel\u200b\u5b8c\u5168\u76f8\u540c\u200b\n
    PaddleLabel \u200b\u542f\u52a8\u200b\u540e\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u5728\u200b\u6d4f\u89c8\u5668\u200b\u4e2d\u200b\u6253\u5f00\u200b\u7f51\u9875\u200b\uff0c\u200b\u63a5\u4e0b\u6765\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b\u6d41\u7a0b\u200b\u4e86\u200b\u3002
"},{"location":"data_annotations/cv_modules/ml_classification.html#32-paddlelabel","title":"3.2 PaddleLabel\u200b\u7684\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":"
  • \u200b\u6253\u5f00\u200b\u81ea\u200b\u52a8\u5f39\u200b\u51fa\u200b\u7684\u200b\u7f51\u9875\u200b\uff0c\u200b\u70b9\u51fb\u200b\u6837\u4f8b\u200b\u9879\u76ee\u200b\uff0c\u200b\u70b9\u51fb\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b

* \u200b\u586b\u5199\u200b\u9879\u76ee\u540d\u79f0\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6ce8\u610f\u200b\u8def\u5f84\u200b\u662f\u200b\u672c\u5730\u200b\u673a\u5668\u200b\u4e0a\u200b\u7684\u200b \u200b\u7edd\u5bf9\u8def\u5f84\u200b\u3002\u200b\u5b8c\u6210\u200b\u540e\u200b\u70b9\u51fb\u200b\u521b\u5efa\u200b\u3002

* \u200b\u9996\u5148\u200b\u5b9a\u4e49\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ee5\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u63d0\u4f9b\u200b10\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u7c7b\u522b\u200b\u6709\u200b\u552f\u4e00\u200b\u5bf9\u5e94\u200b\u7684\u200bid\uff0c\u200b\u70b9\u51fb\u200b\u6dfb\u52a0\u200b\u7c7b\u522b\u200b\uff0c\u200b\u521b\u5efa\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u7c7b\u522b\u200b\u540d\u200b * \u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b * \u200b\u9996\u5148\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u6807\u7b7e\u200b * \u200b\u70b9\u51fb\u200b\u5de6\u4fa7\u200b\u7684\u200b\u77e9\u5f62\u200b\u9009\u62e9\u200b\u6309\u94ae\u200b * \u200b\u5728\u200b\u56fe\u7247\u200b\u4e2d\u200b\u6846\u9009\u200b\u9700\u8981\u200b\u533a\u57df\u200b\uff0c\u200b\u6ce8\u610f\u200b\u6309\u200b\u8bed\u4e49\u200b\u8fdb\u884c\u200b\u5206\u533a\u200b\uff0c\u200b\u5982\u200b\u51fa\u73b0\u200b\u591a\u680f\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u5206\u522b\u200b\u6807\u6ce8\u200b\u591a\u4e2a\u200b\u6846\u200b * \u200b\u5b8c\u6210\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u53f3\u4e0b\u89d2\u200b\u4f1a\u200b\u51fa\u73b0\u200b\u6807\u6ce8\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u68c0\u67e5\u200b\u6807\u6ce8\u200b\u662f\u5426\u200b\u6b63\u786e\u200b * \u200b\u5168\u90e8\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\u70b9\u51fb\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b

* \u200b\u5bfc\u51fa\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b * \u200b\u5728\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b\u4e2d\u200b\u6309\u200b\u9700\u6c42\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7136\u540e\u200b\u70b9\u51fb\u200b\u5bfc\u51fa\u200b\u6570\u636e\u200b\u96c6\u200b

* \u200b\u586b\u5199\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u548c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u4f9d\u7136\u200b\u662f\u200b\u4e00\u4e2a\u200b\u7edd\u5bf9\u8def\u5f84\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\u8bf7\u200b\u9009\u62e9\u200bcoco

* \u200b\u5bfc\u51fa\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e0b\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u83b7\u5f97\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5e76\u200b\u5c06\u200b\u4e09\u4e2a\u200bjson\u200b\u6587\u4ef6\u200b\u4ee5\u53ca\u200bimage\u200b\u76ee\u5f55\u200b\u8fdb\u884c\u200b\u91cd\u547d\u540d\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6e90\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b \u200b\u91cd\u547d\u540d\u200b\u540e\u200b\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b train.json instance_train.json val.json instance_train.json test.json instance_test.json image images
  • \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200bannotations\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bjson\u200b\u6587\u4ef6\u200b\u5168\u90e8\u200b\u79fb\u52a8\u200b\u5230\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5f97\u5230\u200b\u6700\u540e\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u76ee\u5f55\u200b\u5982\u4e0b\u200b\uff1a

* \u200b\u5c06\u200bhemlet\u200b\u76ee\u5f55\u200b\u6253\u5305\u200b\u538b\u7f29\u200b\u4e3a\u200b.tar\u200b\u6216\u200b.zip\u200b\u683c\u5f0f\u200b\u538b\u7f29\u5305\u200b\u5373\u53ef\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/cv_modules/ml_classification.html#4","title":"4. \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u5728\u200b\u83b7\u5f97\u200bCOCO\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bMLClsDataset\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableMe\u200b\u6216\u200bPaddleLabel\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u5e76\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\uff1a

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u89e3\u538b\u200bCOCO\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n#\u200b\u5c06\u200bCOCO\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200bMLClsDataset\u200b\u6570\u636e\u200b\u96c6\u200b\npython main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n
"},{"location":"data_annotations/cv_modules/ml_classification.html#5","title":"5. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b MLClsDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200btrain.txt\u3001val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 label.txt  # \u200b\u6807\u6ce8\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u7c7b\u522b\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a45 wallflower\n\u251c\u2500\u2500 train.txt  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/0041_2456602544.jpg   0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n\u2514\u2500\u2500 val.txt    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/0045_845243484.jpg    0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html","title":"PaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b","text":"

\u200b\u8fd9\u90e8\u5206\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u548c\u200bPaddleLabel\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":""},{"location":"data_annotations/cv_modules/object_detection.html#2-labelme","title":"2. Labelme \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/object_detection.html#21-labelme","title":"2.1 Labelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html#22-labelme","title":"2.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/object_detection.html#23-labelme","title":"2.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/object_detection.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b hemlet\u3002
  • \u200b\u5728\u200b hemlet \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b hemlet \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b label.txt\uff0c\u200b\u5e76\u200b\u5728\u200b label.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200blabel.txt\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

"},{"location":"data_annotations/cv_modules/object_detection.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b:

cd path/to/hemlet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON\u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b Labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b\"\u200b\u7f16\u8f91\u200b\"\u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b

* \u200b\u9009\u62e9\u200b\u521b\u5efa\u200b\u77e9\u5f62\u6846\u200b

* \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u62d6\u52a8\u200b\u5341\u5b57\u200b\u6846\u9009\u200b\u76ee\u6807\u200b\u533a\u57df\u200b

* \u200b\u518d\u6b21\u200b\u70b9\u51fb\u200b\u9009\u62e9\u200b\u76ee\u6807\u200b\u6846\u200b\u7c7b\u522b\u200b

* \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b Labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

* \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b:

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bLabelme\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u4e24\u4e2a\u200b\u6587\u672c\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b\u5168\u90e8\u200bjson\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u6309\u200b\u4e00\u5b9a\u200b\u6bd4\u4f8b\u200b\u5206\u522b\u200b\u5199\u5165\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u5168\u90e8\u200b\u5199\u5165\u200b\u5230\u200btrain_anno_list.txt\u200b\u540c\u65f6\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u7a7a\u200b\u7684\u200bval_anno_list.txt\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u529f\u80fd\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002train_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u7684\u200b\u5177\u4f53\u200b\u586b\u5199\u200b\u683c\u5f0f\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/object_detection.html#234","title":"2.3.4 \u200b\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bcoco\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u548c\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"data_annotations/cv_modules/object_detection.html#3-paddlelabel","title":"3. PaddleLabel \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/object_detection.html#31-paddlelabel","title":"3.1 PaddleLabel\u200b\u7684\u200b\u5b89\u88c5\u200b\u548c\u200b\u542f\u52a8","text":"
  • \u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u5e72\u51c0\u200b\u7684\u200bconda\u200b\u73af\u5883\u200b\uff1a
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • \u200b\u540c\u6837\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200bpip\u200b\u4e00\u952e\u200b\u5b89\u88c5\u200b
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • \u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4f7f\u7528\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u4e4b\u4e00\u200b\u542f\u52a8\u200b \uff1a
    paddlelabel  # \u200b\u542f\u52a8\u200bpaddlelabel\npdlabel # \u200b\u7f29\u5199\u200b\uff0c\u200b\u548c\u200bpaddlelabel\u200b\u5b8c\u5168\u76f8\u540c\u200b\n
    PaddleLabel \u200b\u542f\u52a8\u200b\u540e\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u5728\u200b\u6d4f\u89c8\u5668\u200b\u4e2d\u200b\u6253\u5f00\u200b\u7f51\u9875\u200b\uff0c\u200b\u63a5\u4e0b\u6765\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b\u6d41\u7a0b\u200b\u4e86\u200b\u3002
"},{"location":"data_annotations/cv_modules/object_detection.html#32-paddlelabel","title":"3.2 PaddleLabel\u200b\u7684\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":"
  • \u200b\u6253\u5f00\u200b\u81ea\u200b\u52a8\u5f39\u200b\u51fa\u200b\u7684\u200b\u7f51\u9875\u200b\uff0c\u200b\u70b9\u51fb\u200b\u6837\u4f8b\u200b\u9879\u76ee\u200b\uff0c\u200b\u70b9\u51fb\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b

* \u200b\u586b\u5199\u200b\u9879\u76ee\u540d\u79f0\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6ce8\u610f\u200b\u8def\u5f84\u200b\u662f\u200b\u672c\u5730\u200b\u673a\u5668\u200b\u4e0a\u200b\u7684\u200b \u200b\u7edd\u5bf9\u8def\u5f84\u200b\u3002\u200b\u5b8c\u6210\u200b\u540e\u200b\u70b9\u51fb\u200b\u521b\u5efa\u200b\u3002

* \u200b\u9996\u5148\u200b\u5b9a\u4e49\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ee5\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u63d0\u4f9b\u200b10\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u7c7b\u522b\u200b\u6709\u200b\u552f\u4e00\u200b\u5bf9\u5e94\u200b\u7684\u200bid\uff0c\u200b\u70b9\u51fb\u200b\u6dfb\u52a0\u200b\u7c7b\u522b\u200b\uff0c\u200b\u521b\u5efa\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u7c7b\u522b\u200b\u540d\u200b * \u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b * \u200b\u9996\u5148\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u6807\u7b7e\u200b * \u200b\u70b9\u51fb\u200b\u5de6\u4fa7\u200b\u7684\u200b\u77e9\u5f62\u200b\u9009\u62e9\u200b\u6309\u94ae\u200b * \u200b\u5728\u200b\u56fe\u7247\u200b\u4e2d\u200b\u6846\u9009\u200b\u9700\u8981\u200b\u533a\u57df\u200b\uff0c\u200b\u6ce8\u610f\u200b\u6309\u200b\u8bed\u4e49\u200b\u8fdb\u884c\u200b\u5206\u533a\u200b\uff0c\u200b\u5982\u200b\u51fa\u73b0\u200b\u591a\u680f\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u5206\u522b\u200b\u6807\u6ce8\u200b\u591a\u4e2a\u200b\u6846\u200b * \u200b\u5b8c\u6210\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u53f3\u4e0b\u89d2\u200b\u4f1a\u200b\u51fa\u73b0\u200b\u6807\u6ce8\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u68c0\u67e5\u200b\u6807\u6ce8\u200b\u662f\u5426\u200b\u6b63\u786e\u200b * \u200b\u5168\u90e8\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\u70b9\u51fb\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b

* \u200b\u5bfc\u51fa\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b * \u200b\u5728\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b\u4e2d\u200b\u6309\u200b\u9700\u6c42\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7136\u540e\u200b\u70b9\u51fb\u200b\u5bfc\u51fa\u200b\u6570\u636e\u200b\u96c6\u200b

* \u200b\u586b\u5199\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u548c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u4f9d\u7136\u200b\u662f\u200b\u4e00\u4e2a\u200b\u7edd\u5bf9\u8def\u5f84\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\u8bf7\u200b\u9009\u62e9\u200bcoco

* \u200b\u5bfc\u51fa\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e0b\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u83b7\u5f97\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5e76\u200b\u5c06\u200b\u4e09\u4e2a\u200bjson\u200b\u6587\u4ef6\u200b\u4ee5\u53ca\u200bimage\u200b\u76ee\u5f55\u200b\u8fdb\u884c\u200b\u91cd\u547d\u540d\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6e90\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b \u200b\u91cd\u547d\u540d\u200b\u540e\u200b\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b train.json instance_train.json val.json instance_train.json test.json instance_test.json image images
  • \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200bannotations\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bjson\u200b\u6587\u4ef6\u200b\u5168\u90e8\u200b\u79fb\u52a8\u200b\u5230\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5f97\u5230\u200b\u6700\u540e\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u76ee\u5f55\u200b\u5982\u4e0b\u200b\uff1a

* \u200b\u5c06\u200bhemlet\u200b\u76ee\u5f55\u200b\u6253\u5305\u200b\u538b\u7f29\u200b\u4e3a\u200b.tar\u200b\u6216\u200b.zip\u200b\u683c\u5f0f\u200b\u538b\u7f29\u5305\u200b\u5373\u53ef\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/cv_modules/object_detection.html#4","title":"4. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b COCODetDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir                  # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 annotations              # \u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n\u2502   \u251c\u2500\u2500 instance_train.json  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2502   \u2514\u2500\u2500 instance_val.json    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2514\u2500\u2500 images                   # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n

\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b COCO \u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b \u3002

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html","title":"PaddleX\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002\u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":"

\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u662f\u200b\u4eba\u5de5\u200b\u91c7\u96c6\u200b\u7684\u200b\u8857\u666f\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u6570\u636e\u200b\u79cd\u7c7b\u200b\u6db5\u76d6\u200b\u4e86\u200b\u8f66\u8f86\u200b\u548c\u200b\u9053\u8def\u200b\u4e24\u79cd\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u4e0d\u540c\u200b\u89d2\u5ea6\u200b\u7684\u200b\u62cd\u6444\u200b\u7167\u7247\u200b\u3002\u200b\u56fe\u7247\u200b\u793a\u4f8b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#2-labelme","title":"2. Labelme\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/semantic_segmentation.html#21-labelme","title":"2.1 Labelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#22-labelme","title":"2.2 Labelme\u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#23-labelme","title":"2.3 Labelme\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/semantic_segmentation.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b seg_dataset
  • \u200b\u5728\u200b seg_dataset \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u200b\u4fee\u6539\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u4fdd\u6301\u200b\u540e\u7eed\u200b\u547d\u4ee4\u200b\u7684\u200b\u56fe\u7247\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u6b63\u786e\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200bLabelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

# Windows\ncd C:\\path\\to\\seg_dataset\n# Mac/Linux\ncd path/to/seg_dataset\n
labelme images --nodata --autosave --output annotations\n
* nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200bJSON\u200b\u6587\u4ef6\u200b * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b\"\u200b\u7f16\u8f91\u200b\"\u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b

* \u200b\u9009\u62e9\u200b\u521b\u5efa\u200b\u591a\u8fb9\u5f62\u200b

* \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u7ed8\u5236\u200b\u76ee\u6807\u200b\u8f6e\u5ed3\u200b

  • \u200b\u51fa\u73b0\u200b\u5982\u4e0b\u200b\u5de6\u56fe\u200b\u6240\u793a\u200b\u8f6e\u5ed3\u7ebf\u200b\u95ed\u5408\u200b\u65f6\u200b\uff0c\u200b\u5f39\u200b\u51fa\u200b\u7c7b\u522b\u200b\u9009\u62e9\u200b\u6846\u200b\uff0c\u200b\u53ef\u200b\u8f93\u5165\u200b\u6216\u200b\u9009\u62e9\u200b\u76ee\u6807\u200b\u7c7b\u522b\u200b

\u200b\u901a\u5e38\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u524d\u666f\u200b\u76ee\u6807\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u6807\u6ce8\u200b\u7c7b\u522b\u200b\u5373\u53ef\u200b\uff0c\u200b\u5176\u4ed6\u200b\u50cf\u7d20\u200b\u9ed8\u8ba4\u200b\u4f5c\u4e3a\u200b\u80cc\u666f\u200b\u3002\u200b\u5982\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u6807\u6ce8\u200b\u80cc\u666f\u200b\u533a\u57df\u200b\uff0c\u200b\u7c7b\u522b\u200b\u5fc5\u987b\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b background\uff0c\u200b\u5426\u5219\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u6570\u636e\u200b\u96c6\u4f1a\u200b\u51fa\u73b0\u200b\u9519\u8bef\u200b\u3002 \u200b\u5bf9\u4e8e\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u566a\u58f0\u200b\u90e8\u5206\u200b\u6216\u200b\u4e0d\u200b\u53c2\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u90e8\u5206\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b ignore \u200b\u7c7b\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u65f6\u4f1a\u200b\u81ea\u52a8\u200b\u8df3\u8fc7\u200b\u5bf9\u5e94\u200b\u90e8\u5206\u200b\u3002 \u200b\u9488\u5bf9\u200b\u5e26\u6709\u200b\u7a7a\u6d1e\u200b\u7684\u200b\u76ee\u6807\u200b\uff0c\u200b\u5728\u200b\u6807\u6ce8\u200b\u5b8c\u200b\u76ee\u6807\u200b\u5916\u200b\u8f6e\u5ed3\u200b\u540e\u200b\uff0c\u200b\u518d\u200b\u6cbf\u200b\u7a7a\u6d1e\u200b\u8fb9\u7f18\u200b\u753b\u200b\u591a\u8fb9\u5f62\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u7a7a\u6d1e\u200b\u6307\u5b9a\u200b\u4e3a\u200b\u7279\u5b9a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5982\u679c\u200b\u7a7a\u6d1e\u200b\u662f\u200b\u80cc\u666f\u200b\u5219\u200b\u6307\u5b9a\u200b\u4e3a\u200b background\uff0c\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200boutput \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200bautosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b \"Next Image\" \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b

  • \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b

  • \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200blabelme\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b \u2003\u2003a. \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b seg_datset \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u6267\u884c\u200b\u76ee\u5f55\u200b\u6574\u7406\u200b\u811a\u672c\u200b\u3002\u200b\u6267\u884c\u200b\u811a\u672c\u200b\u540e\u200b\u7684\u200b train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt \u200b\u4e2d\u200b\u5177\u4f53\u5185\u5bb9\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

python format_seg_labelme_dataset.py\n
b. \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#234","title":"2.3.4 \u200b\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u4f7f\u7528\u200bLabelMe\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bSeg \u200b\u6570\u636e\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableMe\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u548c\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\u3002

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n\npython main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#_1","title":"\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200bSegDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir         # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 annotations     # \u200b\u5b58\u653e\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u6ce8\u610f\u200b\u4e0e\u200b\u6807\u8bc6\u200b\u6587\u4ef6\u200b\u7684\u200b\u5185\u5bb9\u200b\u76f8\u5bf9\u200b\u5e94\u200b\n\u251c\u2500\u2500 images          # \u200b\u5b58\u653e\u200b\u539f\u59cb\u200b\u56fe\u50cf\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u6ce8\u610f\u200b\u4e0e\u200b\u6807\u8bc6\u200b\u6587\u4ef6\u200b\u7684\u200b\u5185\u5bb9\u200b\u76f8\u5bf9\u200b\u5e94\u200b\n\u251c\u2500\u2500 train.txt       # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u662f\u200b\u539f\u59cb\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/P0005.jpg annotations/P0005.png\n\u2514\u2500\u2500 val.txt         # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u662f\u200b\u539f\u59cb\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/N0139.jpg annotations/N0139.png\n
\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u662f\u200b\u5355\u901a\u9053\u200b\u7070\u5ea6\u200b\u56fe\u200b\u6216\u8005\u200b\u5355\u901a\u9053\u200b\u4f2a\u200b\u5f69\u8272\u200b\u56fe\u200b\uff0c\u200b\u5efa\u8bae\u200b\u4f7f\u7528\u200bPNG\u200b\u683c\u5f0f\u200b\u4fdd\u5b58\u200b\u3002\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u79cd\u200b\u50cf\u7d20\u200b\u503c\u200b\u4ee3\u8868\u200b\u4e00\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u7c7b\u522b\u200b\u5fc5\u987b\u200b\u4ece\u200b0\u200b\u5f00\u59cb\u200b\u4f9d\u6b21\u200b\u9012\u589e\u200b\uff0c\u200b\u4f8b\u5982\u200b0\u30011\u30012\u30013\u200b\u8868\u793a\u200b4\u200b\u79cd\u7c7b\u200b\u522b\u200b\u3002\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u7684\u200b\u50cf\u7d20\u200b\u5b58\u50a8\u200b\u662f\u200b8bit\uff0c\u200b\u6240\u4ee5\u200b\u6807\u6ce8\u200b\u7c7b\u522b\u200b\u6700\u200b\u591a\u200b\u652f\u6301\u200b256\u200b\u7c7b\u200b\u3002

\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/ocr_modules/table_recognition.html","title":"PaddleX\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":""},{"location":"data_annotations/ocr_modules/table_recognition.html#1","title":"1. \u200b\u6570\u636e\u200b\u6807\u6ce8","text":"

\u200b\u8fdb\u884c\u200b\u8868\u683c\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u65f6\u200b\uff0c\u200b\u4f7f\u7528\u200bPPOCRLabelv2\u200b\u5de5\u5177\u200b\u3002\u200b\u8be6\u7ec6\u200b\u6b65\u9aa4\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u3010\u200b\u89c6\u9891\u200b\u6f14\u793a\u200b\u3011

\u200b\u8868\u683c\u200b\u6807\u6ce8\u200b\u9488\u5bf9\u200b\u8868\u683c\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u63d0\u53d6\u200b\uff0c\u200b\u5c06\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u8868\u683c\u200b\u8f6c\u6362\u200b\u4e3a\u200bExcel\u200b\u683c\u5f0f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u6807\u6ce8\u200b\u65f6\u200b\u9700\u8981\u200b\u914d\u5408\u200b\u5916\u90e8\u200b\u8f6f\u4ef6\u200b\u6253\u5f00\u200bExcel\u200b\u540c\u65f6\u200b\u5b8c\u6210\u200b\u3002\u200b\u5728\u200bPPOCRLabel\u200b\u8f6f\u4ef6\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u8868\u683c\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u6807\u6ce8\u200b\uff08\u200b\u6587\u5b57\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\uff09\u3001\u200b\u5728\u200bExcel\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u4fe1\u606f\u200b\u6807\u6ce8\u200b\uff0c\u200b\u63a8\u8350\u200b\u7684\u200b\u6b65\u9aa4\u200b\u4e3a\u200b\uff1a

  1. \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\uff1a\u200b\u6253\u5f00\u200b\u8868\u683c\u200b\u56fe\u7247\u200b\u540e\u200b\uff0c\u200b\u70b9\u51fb\u200b\u8f6f\u4ef6\u200b\u53f3\u4e0a\u89d2\u200b\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u200b\u6309\u94ae\u200b\uff0c\u200b\u8f6f\u4ef6\u200b\u8c03\u7528\u200bPP-Structure\u200b\u4e2d\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u81ea\u52a8\u200b\u4e3a\u200b\u8868\u683c\u200b\u6253\u200b\u6807\u7b7e\u200b\uff0c\u200b\u540c\u65f6\u200b\u5f39\u200b\u51fa\u200bExcel
  2. \u200b\u66f4\u6539\u200b\u6807\u6ce8\u200b\u7ed3\u679c\u200b\uff1a\u200b\u4ee5\u200b\u8868\u683c\u200b\u4e2d\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u589e\u52a0\u200b\u6807\u6ce8\u200b\u6846\u200b\uff08\u200b\u5373\u200b\u4e00\u4e2a\u200b\u5355\u5143\u683c\u200b\u5185\u200b\u7684\u200b\u6587\u5b57\u200b\u90fd\u200b\u6807\u8bb0\u200b\u4e3a\u200b\u4e00\u4e2a\u200b\u6846\u200b\uff09\u3002\u200b\u6807\u6ce8\u200b\u6846\u4e0a\u200b\u9f20\u6807\u200b\u53f3\u952e\u200b\u540e\u200b\u70b9\u51fb\u200b\u200b\u5355\u5143\u683c\u200b\u91cd\u200b\u8bc6\u522b\u200b\u200b\u53ef\u200b\u5229\u7528\u200b\u6a21\u578b\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u5355\u5143\u683c\u200b\u5185\u200b\u7684\u200b\u6587\u5b57\u200b\u3002
  3. \u200b\u8c03\u6574\u200b\u5355\u5143\u683c\u200b\u987a\u5e8f\u200b\uff1a\u200b\u70b9\u51fb\u200b\u8f6f\u4ef6\u200b\u200b\u89c6\u56fe\u200b-\u200b\u663e\u793a\u200b\u6846\u200b\u7f16\u53f7\u200b\u200b\u6253\u5f00\u200b\u6807\u6ce8\u200b\u6846\u200b\u5e8f\u53f7\u200b\uff0c\u200b\u5728\u200b\u8f6f\u4ef6\u200b\u754c\u9762\u200b\u53f3\u4fa7\u200b\u62d6\u52a8\u200b\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u200b\u4e00\u680f\u200b\u4e0b\u200b\u7684\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\uff0c\u200b\u4f7f\u5f97\u200b\u6807\u6ce8\u200b\u6846\u200b\u7f16\u53f7\u200b\u6309\u7167\u200b\u4ece\u5de6\u5230\u53f3\u200b\uff0c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\u7684\u200b\u987a\u5e8f\u6392\u5217\u200b\uff0c\u200b\u6309\u884c\u200b\u4f9d\u6b21\u200b\u6807\u6ce8\u200b\u3002
  4. \u200b\u6807\u6ce8\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\uff1a\u200b\u5728\u200b\u5916\u90e8\u200bExcel\u200b\u8f6f\u4ef6\u200b\u4e2d\u200b\uff0c\u200b\u5c06\u200b\u5b58\u5728\u200b\u6587\u5b57\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u6807\u8bb0\u200b\u4e3a\u200b\u4efb\u610f\u200b\u6807\u8bc6\u7b26\u200b\uff08\u200b\u5982\u200b1\uff09\uff0c\u200b\u4fdd\u8bc1\u200bExcel\u200b\u4e2d\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u5408\u5e76\u200b\u60c5\u51b5\u200b\u4e0e\u200b\u539f\u56fe\u200b\u76f8\u540c\u200b\u5373\u53ef\u200b\uff08\u200b\u5373\u200b\u4e0d\u200b\u9700\u8981\u200bExcel\u200b\u4e2d\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u6587\u5b57\u200b\u4e0e\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u5b8c\u5168\u76f8\u540c\u200b\uff09
  5. \u200b\u5bfc\u51fa\u200bJSON\u200b\u683c\u5f0f\u200b\uff1a\u200b\u5173\u95ed\u200b\u6240\u6709\u200b\u8868\u683c\u200b\u56fe\u50cf\u200b\u5bf9\u5e94\u200b\u7684\u200bExcel\uff0c\u200b\u70b9\u51fb\u200b\u200b\u6587\u4ef6\u200b-\u200b\u5bfc\u51fa\u200b\u8868\u683c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u751f\u6210\u200bgt.txt\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002
"},{"location":"data_annotations/ocr_modules/table_recognition.html#2","title":"2. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u548c\u200btrain.txt val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 train.txt  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a{\"filename\": \"images/border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"<tr>\", \"<td\", \" colspan=\\\"3\\\"\", \">\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\"]}, \"cells\": [{\"tokens\": [\"\u3001\", \"\u200b\u81ea\u200b\", \"\u200b\u6211\u200b\"], \"bbox\": [[[5, 2], [231, 2], [231, 35], [5, 35]]]}, {\"tokens\": [\"9\"], \"bbox\": [[[168, 68], [231, 68], [231, 98], [168, 98]]]}]}, \"gt\": \"<html><body><table><tr><td colspan=\\\"3\\\">\u3001\u200b\u81ea\u6211\u200b</td></tr><tr><td>Aghas</td><td>\u200b\u5931\u5434\u200b</td><td>\u200b\u6708\u200b\uff0c</td></tr><tr><td>lonwyCau</td><td></td><td>9</td></tr></table></body></html>\"}\n\u2514\u2500\u2500 val.txt    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a{\"filename\": \"images/no_border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"<tr>\", \"<td\", \" colspan=\\\"2\\\"\", \">\", \"</td>\", \"<td\", \" rowspan=\\\"2\\\"\", \">\", \"</td>\", \"<td\", \" rowspan=\\\"2\\\"\", \">\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\"]}, \"cells\": [{\"tokens\": [\"a\", \"d\", \"e\", \"s\"], \"bbox\": [[[0, 4], [284, 4], [284, 34], [0, 34]]]}, {\"tokens\": [\"$\", \"7\", \"5\", \"1\", \"8\", \".\", \"8\", \"3\"], \"bbox\": [[[442, 67], [616, 67], [616, 100], [442, 100]]]}]}, \"gt\": \"<html><body><table><tr><td colspan=\\\"2\\\">ades</td><td rowspan=\\\"2\\\">\u200b\u7814\u7a76\u200b\u4e2d\u5fc3\u200b\u4e3b\u4efb\u200b\u6ed5\u5efa\u200b</td><td rowspan=\\\"2\\\">\u200b\u54c1\u200b\u3001\u200b\u5bb6\u5c45\u7528\u54c1\u200b\u4f4d\u5c45\u200b\u5546\u200b</td></tr><tr><td>naut</td><td>\u200b\u5219\u200b\u662f\u200b\u521b\u529e\u200b\u601d\u200b</td></tr><tr><td>\u200b\u5404\u65b9\u200b\u610f\u89c1\u5efa\u8bae\u200b\uff0c\u200b\u786e\u4fdd\u200b</td><td>9.66</td><td>\u200b\u9053\u200b\u5f00\u4e1a\u200b\uff0c\u200b\u8d1f\u8d23\u200b</td><td>$7518.83</td></tr></table></body></html>\"}\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b PubTabNet \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u6bcf\u884c\u200b\u5185\u5bb9\u200b\u90fd\u200b\u662f\u200b\u4e00\u4e2a\u200bpython\u200b\u5b57\u5178\u200b\u3002

\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html","title":"PaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":""},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":""},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#2-ppocrlabel","title":"2. PPOCRLabel\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#21-ppocrlabel","title":"2.1 PPOCRLabel\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

PPOCRLabel \u200b\u662f\u200b\u4e00\u6b3e\u200b\u9002\u7528\u200b\u4e8e\u200bOCR\u200b\u9886\u57df\u200b\u7684\u200b\u534a\u81ea\u52a8\u5316\u200b\u56fe\u5f62\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\uff0c\u200b\u5185\u7f6e\u200bPP-OCR\u200b\u6a21\u578b\u200b\u5bf9\u200b\u6570\u636e\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u548c\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u3002\u200b\u4f7f\u7528\u200bPython3\u200b\u548c\u200bPyQT5\u200b\u7f16\u5199\u200b\uff0c\u200b\u652f\u6301\u200b\u77e9\u5f62\u6846\u200b\u6807\u6ce8\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u6ce8\u200b\u3001\u200b\u4e0d\u89c4\u5219\u200b\u6587\u672c\u200b\u6807\u6ce8\u200b\u3001\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u6807\u6ce8\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5728\u200bOCR\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b txt \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#22-ppocrlabel","title":"2.2 \u200b\u5b89\u88c5\u200b\u4e0e\u200b\u8fd0\u884c\u200bPPOCRLabel","text":"

PPOCRLabel\u200b\u53ef\u200b\u901a\u8fc7\u200bwhl\u200b\u5305\u4e0e\u200bPython\u200b\u811a\u672c\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\u542f\u52a8\u200b\uff0cwhl\u200b\u5305\u200b\u5f62\u5f0f\u200b\u542f\u52a8\u200b\u66f4\u52a0\u200b\u65b9\u4fbf\u200b\uff0c\u200b\u8fd9\u91cc\u200b\u53ea\u200b\u63d0\u4f9b\u200bwhl\u200b\u5305\u200b\u8bf4\u660e\u200b\uff1a

  • windows \u200b\u5b89\u88c5\u200b\uff1a
    pip install PPOCRLabel  # \u200b\u5b89\u88c5\u200b\n\n# \u200b\u9009\u62e9\u200b\u6807\u7b7e\u200b\u6a21\u5f0f\u200b\u6765\u200b\u542f\u52a8\u200b\nPPOCRLabel --lang ch  # \u200b\u542f\u52a8\u200b\u3010\u200b\u666e\u901a\u200b\u6a21\u5f0f\u200b\u3011\uff0c\u200b\u7528\u4e8e\u200b\u6253\u200b\u3010\u200b\u68c0\u6d4b\u200b+\u200b\u8bc6\u522b\u200b\u3011\u200b\u573a\u666f\u200b\u7684\u200b\u6807\u7b7e\u200b\n

[!NOTE] \u200b\u901a\u8fc7\u200bwhl\u200b\u5305\u200b\u5b89\u88c5\u200bPPOCRLabel\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4e0b\u8f7d\u200b paddleocr whl\u200b\u5305\u200b\uff0c\u200b\u5176\u4e2d\u200bshapely\u200b\u4f9d\u8d56\u200b\u53ef\u80fd\u200b\u4f1a\u200b\u51fa\u73b0\u200b [winRrror 126] \u200b\u627e\u200b\u4e0d\u5230\u200b\u6307\u5b9a\u200b\u6a21\u5757\u200b\u7684\u200b\u95ee\u9898\u200b\u3002 \u200b\u7684\u200b\u9519\u8bef\u200b\uff0c\u200b\u5efa\u8bae\u200b\u4e0b\u8f7d\u200bshapely\u200b\u5b89\u88c5\u5305\u200b\u5b8c\u6210\u200b\u5b89\u88c5\u200b\u3002

  • MacOS
    pip3 install PPOCRLabel\npip3 install opencv-contrib-python-headless==4.2.0.32 # \u200b\u5982\u679c\u200b\u4e0b\u8f7d\u200b\u8fc7\u6162\u200b\u8bf7\u200b\u6dfb\u52a0\u200b\"-i https://mirror.baidu.com/pypi/simple\"\n\n# \u200b\u9009\u62e9\u200b\u6807\u7b7e\u200b\u6a21\u5f0f\u200b\u6765\u200b\u542f\u52a8\u200b\nPPOCRLabel --lang ch  # \u200b\u542f\u52a8\u200b\u3010\u200b\u666e\u901a\u200b\u6a21\u5f0f\u200b\u3011\uff0c\u200b\u7528\u4e8e\u200b\u6253\u200b\u3010\u200b\u68c0\u6d4b\u200b+\u200b\u8bc6\u522b\u200b\u3011\u200b\u573a\u666f\u200b\u7684\u200b\u6807\u7b7e\u200b\n
"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#23","title":"2.3 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7684\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":"
  1. \u200b\u5b89\u88c5\u200b\u4e0e\u200b\u8fd0\u884c\u200b\uff1a\u200b\u4f7f\u7528\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u5b89\u88c5\u200b\u4e0e\u200b\u8fd0\u884c\u200b\u7a0b\u5e8f\u200b\u3002
  2. \u200b\u6253\u5f00\u200b\u6587\u4ef6\u5939\u200b\uff1a\u200b\u5728\u200b\u83dc\u5355\u680f\u200b\u70b9\u51fb\u200b \u201c\u200b\u6587\u4ef6\u200b\u201d - \"\u200b\u6253\u5f00\u200b\u76ee\u5f55\u200b\" \u200b\u9009\u62e9\u200b\u5f85\u200b\u6807\u8bb0\u200b\u56fe\u7247\u200b\u7684\u200b\u6587\u4ef6\u5939\u200b.

3. \u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201d\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u201c\uff0c\u200b\u4f7f\u7528\u200bPP-OCR\u200b\u8d85\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5bf9\u200b\u56fe\u7247\u200b\u6587\u4ef6\u540d\u200b\u524d\u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u4e3a\u200b \u201cX\u201d \u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u3002

4. \u200b\u624b\u52a8\u200b\u6807\u6ce8\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201c\u200b\u77e9\u5f62\u200b\u6807\u6ce8\u200b\u201d\uff08\u200b\u63a8\u8350\u200b\u76f4\u63a5\u200b\u5728\u200b\u82f1\u6587\u200b\u6a21\u5f0f\u200b\u4e0b\u200b\u70b9\u51fb\u200b\u952e\u76d8\u200b\u4e2d\u200b\u7684\u200b \u201cW\u201d)\uff0c\u200b\u7528\u6237\u200b\u53ef\u200b\u5bf9\u200b\u5f53\u524d\u200b\u56fe\u7247\u200b\u4e2d\u200b\u6a21\u578b\u200b\u672a\u200b\u68c0\u51fa\u200b\u7684\u200b\u90e8\u5206\u200b\u8fdb\u884c\u200b\u624b\u52a8\u200b\u7ed8\u5236\u200b\u6807\u8bb0\u200b\u6846\u200b\u3002\u200b\u70b9\u51fb\u200b\u952e\u76d8\u200bQ\uff0c\u200b\u5219\u200b\u4f7f\u7528\u200b\u56db\u70b9\u200b\u6807\u6ce8\u200b\u6a21\u5f0f\u200b\uff08\u200b\u6216\u200b\u70b9\u51fb\u200b\u201c\u200b\u7f16\u8f91\u200b\u201d - \u201c\u200b\u56db\u70b9\u200b\u6807\u6ce8\u200b\u201d\uff09\uff0c\u200b\u7528\u6237\u200b\u4f9d\u6b21\u200b\u70b9\u51fb\u200b4\u200b\u4e2a\u70b9\u200b\u540e\u200b\uff0c\u200b\u53cc\u51fb\u200b\u5de6\u952e\u200b\u8868\u793a\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u3002 5. \u200b\u6807\u8bb0\u200b\u6846\u200b\u7ed8\u5236\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u7528\u6237\u200b\u70b9\u51fb\u200b \u201c\u200b\u786e\u8ba4\u200b\u201d\uff0c\u200b\u68c0\u6d4b\u200b\u6846\u4f1a\u200b\u5148\u200b\u88ab\u200b\u9884\u200b\u5206\u914d\u200b\u4e00\u4e2a\u200b \u201c\u200b\u5f85\u200b\u8bc6\u522b\u200b\u201d \u200b\u6807\u7b7e\u200b\u3002 6. \u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\uff1a\u200b\u5c06\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6240\u6709\u200b\u68c0\u6d4b\u200b\u753b\u200b\u7ed8\u5236\u200b/\u200b\u8c03\u6574\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u70b9\u51fb\u200b \u201c\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u201d\uff0cPP-OCR\u200b\u6a21\u578b\u200b\u4f1a\u200b\u5bf9\u200b\u5f53\u524d\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6240\u6709\u200b\u68c0\u6d4b\u200b\u6846\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b[3]\u3002

7. \u200b\u5185\u5bb9\u200b\u66f4\u6539\u200b\uff1a\u200b\u5355\u51fb\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5bf9\u200b\u4e0d\u200b\u51c6\u786e\u200b\u7684\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u624b\u52a8\u200b\u66f4\u6539\u200b\u3002 8. \u200b\u786e\u8ba4\u200b\u6807\u8bb0\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201c\u200b\u786e\u8ba4\u200b\u201d\uff0c\u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u5207\u6362\u200b\u4e3a\u200b \u201c\u221a\u201d\uff0c\u200b\u8df3\u8f6c\u200b\u81f3\u4e0b\u200b\u4e00\u5f20\u200b\u3002 9. \u200b\u5220\u9664\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201c\u200b\u5220\u9664\u200b\u56fe\u50cf\u200b\u201d\uff0c\u200b\u56fe\u7247\u200b\u5c06\u4f1a\u200b\u88ab\u200b\u5220\u9664\u200b\u81f3\u200b\u56de\u6536\u7ad9\u200b\u3002 10. \u200b\u5bfc\u51fa\u200b\u7ed3\u679c\u200b\uff1a\u200b\u7528\u6237\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u83dc\u5355\u200b\u4e2d\u200b\u201c\u200b\u6587\u4ef6\u200b-\u200b\u5bfc\u51fa\u200b\u6807\u8bb0\u200b\u7ed3\u679c\u200b\u201d\u200b\u624b\u52a8\u200b\u5bfc\u51fa\u200b\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u70b9\u51fb\u200b\u201c\u200b\u6587\u4ef6\u200b - \u200b\u81ea\u52a8\u200b\u5bfc\u51fa\u200b\u6807\u8bb0\u200b\u7ed3\u679c\u200b\u201d\u200b\u5f00\u542f\u200b\u81ea\u52a8\u200b\u5bfc\u51fa\u200b\u3002\u200b\u624b\u52a8\u200b\u786e\u8ba4\u200b\u8fc7\u200b\u7684\u200b\u6807\u8bb0\u200b\u5c06\u4f1a\u200b\u88ab\u200b\u5b58\u653e\u200b\u5728\u200b\u6240\u200b\u6253\u5f00\u200b\u56fe\u7247\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\u7684\u200bLabel.txt\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u83dc\u5355\u680f\u200b\u70b9\u51fb\u200b \u201c\u200b\u6587\u4ef6\u200b\u201d - \"\u200b\u5bfc\u51fa\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\"\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u5c06\u200b\u6b64\u7c7b\u200b\u56fe\u7247\u200b\u7684\u200b\u8bc6\u522b\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u4fdd\u5b58\u200b\u5728\u200bcrop_img\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\uff0c\u200b\u8bc6\u522b\u200b\u6807\u7b7e\u200b\u4fdd\u5b58\u200b\u5728\u200brec_gt.txt\u200b\u4e2d\u200b\u3002

\u200b\u6ce8\u610f\u4e8b\u9879\u200b:

  • PPOCRLabel\u200b\u4ee5\u200b\u6587\u4ef6\u5939\u200b\u4e3a\u200b\u57fa\u672c\u200b\u6807\u8bb0\u200b\u5355\u4f4d\u200b\uff0c\u200b\u6253\u5f00\u200b\u5f85\u200b\u6807\u8bb0\u200b\u7684\u200b\u56fe\u7247\u200b\u6587\u4ef6\u5939\u200b\u540e\u200b\uff0c\u200b\u4e0d\u4f1a\u200b\u5728\u200b\u7a97\u53e3\u200b\u680f\u4e2d\u200b\u663e\u793a\u200b\u56fe\u7247\u200b\uff0c\u200b\u800c\u662f\u200b\u5728\u200b\u70b9\u51fb\u200b \"\u200b\u9009\u62e9\u200b\u6587\u4ef6\u5939\u200b\" \u200b\u4e4b\u540e\u200b\u76f4\u63a5\u200b\u5c06\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\u7684\u200b\u56fe\u7247\u200b\u5bfc\u5165\u5230\u200b\u7a0b\u5e8f\u200b\u4e2d\u200b\u3002
  • \u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u8868\u793a\u200b\u672c\u5f20\u200b\u56fe\u7247\u200b\u7528\u6237\u200b\u662f\u5426\u200b\u624b\u52a8\u200b\u4fdd\u5b58\u200b\u8fc7\u200b\uff0c\u200b\u672a\u200b\u624b\u52a8\u200b\u4fdd\u5b58\u200b\u8fc7\u200b\u5373\u200b\u4e3a\u200b \u201cX\u201d\uff0c\u200b\u624b\u52a8\u200b\u4fdd\u5b58\u200b\u8fc7\u200b\u4e3a\u200b \u201c\u221a\u201d\u3002\u200b\u70b9\u51fb\u200b \u201c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u201d\u200b\u6309\u94ae\u200b\u540e\u200b\uff0cPPOCRLabel\u200b\u4e0d\u4f1a\u200b\u5bf9\u200b\u72b6\u6001\u200b\u4e3a\u200b \u201c\u221a\u201d \u200b\u7684\u200b\u56fe\u7247\u200b\u91cd\u65b0\u200b\u6807\u6ce8\u200b\u3002
  • \u200b\u70b9\u51fb\u200b\u201c\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u201d\u200b\u540e\u200b\uff0c\u200b\u6a21\u578b\u200b\u4f1a\u200b\u5bf9\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u8986\u76d6\u200b\u3002\u200b\u56e0\u6b64\u200b\u5982\u679c\u200b\u5728\u6b64\u4e4b\u524d\u200b\u624b\u52a8\u200b\u66f4\u6539\u200b\u8fc7\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u6709\u200b\u53ef\u80fd\u200b\u5728\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u540e\u200b\u4ea7\u751f\u200b\u53d8\u52a8\u200b\u3002
  • PPOCRLabel\u200b\u4ea7\u751f\u200b\u7684\u200b\u6587\u4ef6\u200b\u653e\u7f6e\u200b\u4e8e\u200b\u6807\u8bb0\u200b\u56fe\u7247\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\uff0c\u200b\u5305\u62ec\u200b\u4ee5\u4e0b\u200b\u51e0\u79cd\u200b\uff0c\u200b\u8bf7\u52ff\u200b\u624b\u52a8\u200b\u66f4\u6539\u200b\u5176\u4e2d\u200b\u5185\u5bb9\u200b\uff0c\u200b\u5426\u5219\u200b\u4f1a\u200b\u5f15\u8d77\u200b\u7a0b\u5e8f\u200b\u51fa\u73b0\u5f02\u5e38\u200b\u3002
\u200b\u6587\u4ef6\u540d\u200b \u200b\u8bf4\u660e\u200b Label.txt \u200b\u68c0\u6d4b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u53ef\u200b\u76f4\u63a5\u200b\u7528\u4e8e\u200bPPOCR\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u7528\u6237\u200b\u6bcf\u200b\u786e\u8ba4\u200b5\u200b\u5f20\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u540e\u200b\uff0c\u200b\u7a0b\u5e8f\u200b\u4f1a\u200b\u8fdb\u884c\u200b\u81ea\u52a8\u200b\u5199\u5165\u200b\u3002\u200b\u5f53\u200b\u7528\u6237\u200b\u5173\u95ed\u200b\u5e94\u7528\u7a0b\u5e8f\u200b\u6216\u200b\u5207\u6362\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u540e\u200b\u540c\u6837\u200b\u4f1a\u200b\u8fdb\u884c\u200b\u5199\u5165\u200b\u3002 fileState.txt \u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u6807\u8bb0\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u5f53\u524d\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\u5df2\u7ecf\u200b\u88ab\u200b\u7528\u6237\u200b\u624b\u52a8\u200b\u786e\u8ba4\u200b\u8fc7\u200b\u7684\u200b\u56fe\u7247\u200b\u540d\u79f0\u200b\u3002 Cache.cach \u200b\u7f13\u5b58\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u7684\u200b\u7ed3\u679c\u200b\u3002 rec_gt.txt \u200b\u8bc6\u522b\u200b\u6807\u7b7e\u200b\u3002\u200b\u53ef\u200b\u76f4\u63a5\u200b\u7528\u4e8e\u200bPPOCR\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u9700\u200b\u7528\u6237\u200b\u624b\u52a8\u200b\u70b9\u51fb\u200b\u83dc\u5355\u680f\u200b\u201c\u200b\u6587\u4ef6\u200b\u201d - \"\u200b\u5bfc\u51fa\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\"\u200b\u540e\u200b\u4ea7\u751f\u200b\u3002 crop_img \u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u3002\u200b\u6309\u7167\u200b\u68c0\u6d4b\u200b\u6846\u200b\u5207\u5272\u200b\u540e\u200b\u7684\u200b\u56fe\u7247\u200b\u3002\u200b\u4e0e\u200brec_gt.txt\u200b\u540c\u65f6\u200b\u4ea7\u751f\u200b\u3002

\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u6570\u636e\u200b\u5212\u5206\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u6b65\u9aa4\u200b\u64cd\u4f5c\u200b\uff1a

cd ./PPOCRLabel # \u200b\u5c06\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200bPPOCRLabel\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\npython gen_ocr_train_val_test.py --trainValTestRatio 7:3:0 --datasetRootPath ../train_data\n
* trainValTestRatio \u200b\u662f\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u3001\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u91cf\u200b\u5212\u5206\u200b\u6bd4\u4f8b\u200b\uff0c\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8bbe\u5b9a\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u662f\u200b6:2:2 * datasetRootPath \u200b\u662f\u200bPPOCRLabel\u200b\u6807\u6ce8\u200b\u7684\u200b\u5b8c\u6574\u200b\u6570\u636e\u200b\u96c6\u200b\u5b58\u653e\u200b\u8def\u5f84\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u8def\u5f84\u200b\u662f\u200b PaddleOCR/train_data \u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u524d\u200b\u5e94\u6709\u200b\u5982\u4e0b\u200b\u7ed3\u6784\u200b\uff1a

|-train_data\n  |-crop_img\n    |- word_001_crop_0.png\n    |- word_002_crop_0.jpg\n    |- word_003_crop_0.jpg\n    | ...\n  | Label.txt\n  | rec_gt.txt\n  |- word_001.png\n  |- word_002.jpg\n  |- word_003.jpg\n  | ...\n
\u200b\u66f4\u200b\u591a\u200b\u5de5\u5177\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u8bf7\u200b\u53c2\u8003\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b

"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#3","title":"3. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX\u200b\u9488\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200bTextDetDataset\uff0c\u200b\u6574\u7406\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u4e3a\u200b\u5982\u4e0b\u200b\u6587\u4ef6\u7ec4\u7ec7\u200b\u5f62\u5f0f\u200b\u548c\u200b\u547d\u540d\u200b\uff1a

dataset_dir     # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images      # \u200b\u5b58\u653e\u200b\u56fe\u50cf\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u548c\u200btrain.txt val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 train.txt   # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/img_0.jpg \\t [{\"transcription\": \"MASA\", \"points\": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]\n\u2514\u2500\u2500 val.txt     # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/img_61.jpg \\t [{\"transcription\": \"TEXT\", \"points\": [[31, 10], [310, 140], [420, 220], [310, 170]]}, {...}]\n
\u200b\u5c06\u200b\u56fe\u50cf\u200b\u653e\u7f6e\u200b\u5728\u200bimages\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u751f\u200b\u7684\u200bLabel.txt\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u91cd\u65b0\u547d\u540d\u200b\u4e3a\u200btrain.txt\uff0c\u200b\u540c\u65f6\u200b\u6807\u6ce8\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u56fe\u50cf\u200b\u65f6\u200b\u4ea7\u751f\u200b\u7684\u200bLabel.txt\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u91cd\u65b0\u547d\u540d\u200b\u4e3a\u200bval.txt\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5747\u200b\u653e\u7f6e\u200b\u5728\u200bdataset_dir\uff08\u200b\u540d\u79f0\u200b\u53ef\u53d8\u200b\uff09\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u3002\u200b\u6ce8\u610f\u200btrain.txt/val.txt\u200b\u4e2d\u200b\u7684\u200b\u56fe\u50cf\u200b\u7684\u200b\u8def\u5f84\u200b\u5e94\u662f\u200bimages/xxx\u3002

\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u6bcf\u884c\u200b\u5185\u5bb9\u200b\u662f\u200b\u4e00\u5f20\u200b\u56fe\u50cf\u200b\u7684\u200b\u8def\u5f84\u200b\u548c\u200b\u4e00\u4e2a\u200b\u7ec4\u6210\u200b\u5143\u7d20\u200b\u662f\u200b\u5b57\u5178\u200b\u7684\u200b\u5217\u8868\u200b\uff0c\u200b\u8def\u5f84\u200b\u548c\u200b\u5217\u8868\u200b\u5fc5\u987b\u200b\u4f7f\u7528\u200b\u5236\u8868\u7b26\u200b\u2019\\t\u2018\u200b\u8fdb\u884c\u200b\u5206\u9694\u200b\uff0c\u200b\u4e0d\u53ef\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u8fdb\u884c\u200b\u5206\u9694\u200b\u3002

\u200b\u5bf9\u4e8e\u200b\u7ec4\u6210\u200b\u5143\u7d20\u200b\u662f\u200b\u5b57\u5178\u200b\u7684\u200b\u5217\u8868\u200b\uff0c\u200b\u5b57\u5178\u200b\u4e2d\u200b points \u200b\u8868\u793a\u200b\u6587\u672c\u6846\u200b\u7684\u200b\u56db\u4e2a\u200b\u9876\u70b9\u200b\u7684\u200b\u5750\u6807\u200b\uff08x, y\uff09\uff0c\u200b\u4ece\u200b\u5de6\u4e0a\u89d2\u200b\u7684\u200b\u9876\u70b9\u200b\u5f00\u59cb\u200b\u6309\u200b\u987a\u65f6\u9488\u200b\u6392\u5e8f\u200b\uff1b\u200b\u5b57\u5178\u200b\u4e2d\u200btranscription\u200b\u8868\u793a\u200b\u8be5\u200b\u6587\u672c\u6846\u200b\u7684\u200b\u6587\u5b57\u200b\uff0c\u200b\u82e5\u200btranscription \u200b\u7684\u200b\u200b\u5185\u5bb9\u200b\u4e3a\u200b\u201c###\u201d\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u8be5\u200b\u6587\u672c\u6846\u200b\u65e0\u6548\u200b\uff0c\u200b\u4e0d\u200b\u53c2\u4e0e\u200b\u8bad\u7ec3\u200b\u3002\u200b\u5177\u4f53\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u4e86\u200bPPOCRLabel\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5728\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u540e\u200b\u5c06\u200b\u6587\u5b57\u200b\u68c0\u6d4b\u200b\uff08det\uff09\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u7684\u200bdet_gt_train.txt\u200b\u6539\u540d\u200b\u4e3a\u200btrain.txt\u3001det_gt_test.txt\u200b\u6539\u540d\u200b\u4e3a\u200bval.txt\u200b\u5373\u53ef\u200b\u3002

"},{"location":"data_annotations/time_series_modules/time_series_anomaly_detection.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e0\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u4efb\u52a1\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4e0d\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u3002\u200b\u6536\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u6837\u672c\u200b\u5c3d\u53ef\u80fd\u200b\u4fdd\u8bc1\u200b\u90fd\u200b\u662f\u200b\u6b63\u5e38\u200b\u6570\u636e\u200b\uff0c\u200b\u5373\u200b\u6ca1\u6709\u200b\u5f02\u5e38\u200b\uff08\u200b\u7528\u200b0\u200b\u8868\u793a\u200b\u65e0\u200b\u5f02\u5e38\u200b\uff09\uff0c\u200b\u8bad\u7ec3\u200b\u96c6\u4e2d\u200b\u8868\u793a\u200b\u5f02\u5e38\u200b\u7684\u200b\u6807\u7b7e\u200b\u5217\u5747\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0\uff0c\u200b\u6216\u8005\u200b\u4e0d\u200b\u8bbe\u7f6e\u200b\u6807\u7b7e\u200b\u5217\u200b\u4e5f\u200b\u662f\u200b\u53ef\u4ee5\u200b\u7684\u200b\u3002\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u4e3a\u4e86\u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u9700\u8981\u200b\u8fdb\u884c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u67d0\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u200b\u5f02\u5e38\u200b\u7684\u200b\u70b9\u200b\uff0c\u200b\u5c06\u200b\u8be5\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 1 \u200b\u5373\u53ef\u200b\uff0c\u200b\u5176\u4ed6\u200b\u6b63\u5e38\u200b\u7684\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u4e3a\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b0\u3002

"},{"location":"data_annotations/time_series_modules/time_series_classification.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u6807\u6ce8\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u57fa\u4e8e\u200b\u6536\u96c6\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u660e\u786e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u7684\u200b\u5206\u7c7b\u200b\u76ee\u6807\u200b\uff0c\u200b\u5e76\u200b\u5b9a\u4e49\u200b\u76f8\u5e94\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u5728\u200bcsv\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u8bbe\u7f6e\u200b\u8868\u793a\u200b\u6837\u672c\u200b\u7684\u200bgroud_id\u200b\u5217\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b group_id\u200b\u5c31\u200b\u8868\u793a\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u6837\u672c\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u80a1\u7968\u4ef7\u683c\u200b\u9884\u6d4b\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u53ef\u80fd\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\uff080\uff09\u3001\u201c\u200b\u6301\u5e73\u200b\u201d\uff081\uff09\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\uff082\uff09\u3002\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0 \uff1b\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b2\u3002\u200b\u5982\u4e0b\u200b\u56fe\u200b\uff0c\u200b\u7eff\u8272\u200b\u6846\u662f\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b(groud_id=0)\uff0c\u200b\u7c7b\u522b\u200b(label)\u200b\u662f\u200b1\uff0c\u200b\u7ea2\u8272\u200b\u6846\u662f\u200b\u53e6\u200b\u4e00\u4e2a\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6837\u672c\u200b(groud_id=1)\uff0c\u200b\u7c7b\u522b\u200b(label)\u200b\u662f\u200b0\uff0c\u200b\u5982\u679c\u200b\u6709\u200bn\u200b\u4e2a\u200b\u6837\u672c\u200b\u53ef\u4ee5\u200b\u8bbe\u7f6e\u200bgroud_id=0,...n-1\uff1b\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u957f\u5ea6\u200b(time=0,...,9)\u200b\u90fd\u200b\u662f\u200b10\uff0c\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b\uff08dim_0, dim_1\uff09\u200b\u662f\u200b2\u3002

"},{"location":"data_annotations/time_series_modules/time_series_forecasting.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u6570\u636e\u200b\u662f\u200b\u65e0\u9700\u200b\u6807\u6ce8\u200b\u7684\u200b\uff0c\u200b\u53ea\u8981\u200b\u6536\u96c6\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u5c06\u200b\u6240\u6709\u200b\u6570\u636e\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u7684\u200b\u987a\u5e8f\u6392\u5217\u200b\u5728\u200bcsv\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u5373\u53ef\u200b\u3002\u200b\u8bad\u7ec3\u200b\u65f6\u4f1a\u200b\u5c06\u200b\u6570\u636e\u200b\u81ea\u52a8\u200b\u5207\u200b\u5206\u4e3a\u200b\u591a\u4e2a\u200b\u65f6\u95f4\u200b\u7247\u6bb5\u200b\uff0c\u200b\u7ec4\u5408\u200b\u8bad\u7ec3\u6837\u672c\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff0c\u200b\u5386\u53f2\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u548c\u200b\u672a\u6765\u200b\u7684\u200b\u5e8f\u5217\u200b\u5206\u522b\u200b\u8868\u793a\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u548c\u200b\u5176\u200b\u5bf9\u5e94\u200b\u7684\u200b\u9884\u6d4b\u200b\u76ee\u6807\u200b\u3002\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002

"},{"location":"installation/installation.html","title":"PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u2757\u200b\u5b89\u88c5\u200b PaddleX \u200b\u524d\u200b\u8bf7\u200b\u5148\u200b\u786e\u4fdd\u60a8\u200b\u6709\u200b\u57fa\u7840\u200b\u7684\u200b Python \u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\uff08\u200b\u6ce8\u200b\uff1a\u200b\u5f53\u524d\u200b\u652f\u6301\u200bPython 3.8 \uff5e Python 3.10\u200b\u4e0b\u200b\u8fd0\u884c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200bPython\u200b\u7248\u672c\u200b\u9002\u914d\u200b\u4e2d\u200b\uff09\u3002

"},{"location":"installation/installation.html#1","title":"1. \u200b\u5feb\u901f\u200b\u5b89\u88c5","text":"

\u200b\u6b22\u8fce\u60a8\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200bPaddleX\uff0c\u200b\u5728\u200b\u6211\u4eec\u200b\u6b63\u5f0f\u200b\u5f00\u59cb\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u9996\u5148\u200b\u660e\u786e\u200b\u60a8\u200b\u7684\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u9700\u6c42\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002 PaddleX\u200b\u4e3a\u200b\u60a8\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff1aWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u548c\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\uff0c\u200b\u4e0b\u9762\u200b\u5206\u522b\u200b\u5bf9\u200b\u5176\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u8fdb\u884c\u200b\u4ecb\u7ecd\u200b\uff1a

"},{"location":"installation/installation.html#11-wheel","title":"1.1 Wheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b \uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u66f4\u200b\u4fbf\u6377\u200b\u3001\u200b\u66f4\u200b\u8f7b\u91cf\u200b\u7684\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200b\u8f7b\u91cf\u7ea7\u200b\u7684\u200bWheel\u200b\u5305\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u5373\u53ef\u200b\u57fa\u4e8e\u200bPaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u6240\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u5e76\u200b\u80fd\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u8fdb\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

\u200b\u53c2\u8003\u200b\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bWheel\u200b\u5305\u200b\uff1a

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u4fdd\u8bc1\u200b PaddlePaddle \u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff0c\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u65b9\u53ef\u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u6b65\u200b\u3002

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n
"},{"location":"installation/installation.html#12","title":"1.2 \u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u4e8c\u6b21\u5f00\u53d1\u200b \uff08\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u3001\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3001\u200b\u81ea\u5b9a\u4e49\u200b\u6a21\u578b\u200b\u7ed3\u6784\u200b\u3001\u200b\u81ea\u5b9a\u4e49\u200b\u63a8\u7406\u200b\u4ee3\u7801\u200b\u7b49\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u529f\u80fd\u200b\u66f4\u52a0\u200b\u5f3a\u5927\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5b89\u88c5\u200b\u60a8\u200b\u9700\u8981\u200b\u7684\u200bPaddleX\u200b\u63d2\u4ef6\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u4e0d\u4ec5\u200b\u540c\u6837\u200b\u80fd\u591f\u200b\u5bf9\u200b\u63d2\u4ef6\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\uff0c\u200b\u8fd8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u5176\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u66f4\u200b\u9ad8\u7ea7\u200b\u7684\u200b\u64cd\u4f5c\u200b\u3002

PaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5982\u4e0b\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u6839\u636e\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff1a

\ud83d\udc49 \u200b\u63d2\u4ef6\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09 \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u6a21\u5757\u200b \u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b PaddleSeg \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b PaddleDetection \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCR \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCRPaddleDetection \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b PaddleOCRPaddleDetectionPaddleClas \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u901a\u7528\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b PaddleSeg

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u7684\u200b\u63d2\u4ef6\u200b\u4e3a\u200bPaddleXXX\uff0c\u200b\u5728\u200b\u53c2\u8003\u200b\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b\uff1a

git clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\npip install -e .\npaddlex --install PaddleXXX  # \u200b\u4f8b\u5982\u200bPaddleOCR\n

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u91c7\u7528\u200b\u8fd9\u79cd\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u540e\u200b\uff0c\u200b\u662f\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel \u200b\u5305\u200b\u3002

\u200b\u5982\u679c\u200b\u4e0a\u8ff0\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u53ef\u4ee5\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8df3\u8fc7\u200b\u63a5\u4e0b\u6765\u200b\u7684\u200b\u6b65\u9aa4\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bLinux\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b2. Linux\u200b\u5b89\u88c5\u200bPaddleX\u200b\u8be6\u7ec6\u200b\u6559\u7a0b\u200b\u3002\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\u3002

"},{"location":"installation/installation.html#2-linuxpaddex","title":"2. Linux\u200b\u5b89\u88c5\u200bPaddeX\u200b\u8be6\u7ec6\u200b\u6559\u7a0b","text":"

\u200b\u4f7f\u7528\u200bLinux\u200b\u5b89\u88c5\u200bPaddleX\u200b\u65f6\u200b\uff0c\u200b\u6211\u4eec\u200b\u5f3a\u70c8\u63a8\u8350\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5b98\u65b9\u200bDocker\u200b\u955c\u50cf\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u7136\u200b\u4e5f\u200b\u53ef\u200b\u4f7f\u7528\u200b\u5176\u4ed6\u200b\u81ea\u5b9a\u4e49\u200b\u65b9\u5f0f\u200b\u5b89\u88c5\u200b\u3002

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b Docker \u200b\u955c\u50cf\u200b\u5b89\u88c5\u200b\u65f6\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5df2\u7ecf\u200b\u5185\u7f6e\u200b\u4e86\u200b PaddlePaddle\u3001PaddleX\uff08\u200b\u5305\u62ec\u200bwheel\u200b\u5305\u200b\u548c\u200b\u6240\u6709\u200b\u63d2\u4ef6\u200b\uff09\uff0c\u200b\u5e76\u200b\u914d\u7f6e\u200b\u597d\u200b\u4e86\u200b\u76f8\u5e94\u200b\u7684\u200bCUDA\u200b\u73af\u5883\u200b\uff0c\u200b\u60a8\u200b\u83b7\u53d6\u200b Docker \u200b\u955c\u50cf\u200b\u5e76\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b\u5373\u53ef\u200b\u5f00\u59cb\u200b\u4f7f\u7528\u200b\u3002

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5b9a\u4e49\u200b\u65b9\u5f0f\u200b\u5b89\u88c5\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u5148\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b PaddlePaddle \u200b\u6846\u67b6\u200b\uff0c\u200b\u968f\u540e\u200b\u83b7\u53d6\u200b PaddleX \u200b\u6e90\u7801\u200b\uff0c\u200b\u6700\u540e\u200b\u9009\u62e9\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b PaddleX \u200b\u4ec5\u200b\u652f\u6301\u200b 11.8 \u200b\u548c\u200b 12.3 \u200b\u7248\u672c\u200b\u7684\u200b CUDA\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u200b\u5df2\u200b\u5b89\u88c5\u200b\u7684\u200b Nvidia \u200b\u9a71\u52a8\u200b\u652f\u6301\u200b\u7684\u200b\u4e0a\u8ff0\u200b CUDA \u200b\u7248\u672c\u200b\u3002

"},{"location":"installation/installation.html#21-dockerpaddlex","title":"2.1 \u200b\u57fa\u4e8e\u200bDocker\u200b\u83b7\u53d6\u200bPaddleX","text":"

\u200b\u53c2\u8003\u200b\u4e0b\u8ff0\u200b\u547d\u4ee4\u200b\uff0c\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5b98\u65b9\u200b Docker \u200b\u955c\u50cf\u200b\uff0c\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u540d\u4e3a\u200b paddlex \u200b\u7684\u200b\u5bb9\u5668\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f53\u524d\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u6620\u5c04\u200b\u5230\u200b\u5bb9\u5668\u200b\u5185\u200b\u7684\u200b /paddle \u200b\u76ee\u5f55\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b >= 19.03\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a

# \u200b\u5bf9\u4e8e\u200b CPU \u200b\u7528\u6237\u200b\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b GPU \u200b\u7528\u6237\u200b\n# \u200b\u5bf9\u4e8e\u200b CUDA11.8 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b CUDA12.3 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 19.03 \u200b\u4f46\u200b >= 17.06\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a
\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
# \u200b\u5bf9\u4e8e\u200b CPU \u200b\u7528\u6237\u200b\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b GPU \u200b\u7528\u6237\u200b\n# \u200b\u5bf9\u4e8e\u200b CUDA11.8 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b CUDA12.3 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 17.06\uff0c\u200b\u8bf7\u200b\u5347\u7ea7\u200b Docker \u200b\u7248\u672c\u200b\u3002

  • \u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u66f4\u200b\u6df1\u5165\u200b\u4e86\u89e3\u200b Docker \u200b\u7684\u200b\u539f\u7406\u200b\u6216\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b Docker\u200b\u5b98\u65b9\u7f51\u7ad9\u200b \u200b\u6216\u200b Docker\u200b\u5b98\u65b9\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"installation/installation.html#22-paddlex","title":"2.2 \u200b\u81ea\u5b9a\u4e49\u200b\u65b9\u5f0f\u200b\u5b89\u88c5\u200bPaddleX","text":"

\u200b\u5728\u200b\u5b89\u88c5\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u53c2\u8003\u200b\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u98de\u6868\u200b\u7684\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"installation/installation.html#221-paddlex","title":"2.2.1 \u200b\u83b7\u53d6\u200b PaddleX \u200b\u6e90\u7801","text":"

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u8bf7\u200b\u4f7f\u7528\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u4ece\u200b GitHub \u200b\u83b7\u53d6\u200b PaddleX \u200b\u6700\u65b0\u200b\u6e90\u7801\u200b\uff1a

git clone https://github.com/PaddlePaddle/PaddleX.git\n
\u200b\u5982\u679c\u200b\u8bbf\u95ee\u200b GitHub \u200b\u7f51\u901f\u200b\u8f83\u6162\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4ece\u200b Gitee \u200b\u4e0b\u8f7d\u200b\uff0c\u200b\u547d\u4ee4\u200b\u5982\u4e0b\u200b\uff1a

git clone https://gitee.com/paddlepaddle/PaddleX.git\n
"},{"location":"installation/installation.html#222-paddlex","title":"2.2.2 \u200b\u5b89\u88c5\u200bPaddleX","text":"

\u200b\u83b7\u53d6\u200b PaddleX \u200b\u6700\u65b0\u200b\u6e90\u7801\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u6216\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

  • \u200b\u82e5\u200b\u60a8\u200b\u9009\u62e9\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

cd PaddleX\n\n# \u200b\u5b89\u88c5\u200b PaddleX whl\n# -e\uff1a\u200b\u4ee5\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel\npip install -e .\n
* \u200b\u82e5\u200b\u60a8\u200b\u9009\u62e9\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u5e76\u4e14\u200b\u60a8\u200b\u9700\u8981\u200b\u7684\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\u4e3a\u200b PaddleXXX\uff08\u200b\u53ef\u4ee5\u200b\u6709\u200b\u591a\u4e2a\u200b\uff09\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

cd PaddleX\n\n# \u200b\u5b89\u88c5\u200b PaddleX whl\n# -e\uff1a\u200b\u4ee5\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel\npip install -e .\n\n# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleXXX\n
\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200bPaddleOCR\u3001PaddleClas\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u5b89\u88c5\u200b\u63d2\u4ef6\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleOCR\u3001PaddleClas \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleOCR PaddleClas\n
\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u586b\u5199\u200b\u5177\u4f53\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\npaddlex --install\n
\u200b\u63d2\u4ef6\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u514b\u9686\u200b\u6e90\u4e3a\u200b github.com\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u652f\u6301\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b--platform \u200b\u6307\u5b9a\u200b\u514b\u9686\u200b\u6e90\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200bPaddleX\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install --platform gitee.com\n
\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u5c06\u4f1a\u200b\u6709\u200b\u5982\u4e0b\u200b\u63d0\u793a\u200b\uff1a

All packages are installed.\n
\u200b\u66f4\u200b\u591a\u200b\u786c\u4ef6\u200b\u73af\u5883\u200b\u7684\u200bPaddleX\u200b\u5b89\u88c5\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b

"},{"location":"installation/paddlepaddle_install.html","title":"\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b PaddlePaddle \u200b\u65f6\u200b\uff0c\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b Docker \u200b\u5b89\u88c5\u200b\u548c\u200b\u901a\u8fc7\u200b pip \u200b\u5b89\u88c5\u200b\u3002

"},{"location":"installation/paddlepaddle_install.html#docker","title":"\u57fa\u4e8e\u200b Docker \u200b\u5b89\u88c5\u200b\u98de\u6868","text":"

\u200b\u82e5\u200b\u60a8\u200b\u901a\u8fc7\u200b Docker \u200b\u5b89\u88c5\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u4e0b\u8ff0\u200b\u547d\u4ee4\u200b\uff0c\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b Docker \u200b\u955c\u50cf\u200b\uff0c\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u540d\u4e3a\u200b paddlex \u200b\u7684\u200b\u5bb9\u5668\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f53\u524d\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u6620\u5c04\u200b\u5230\u200b\u5bb9\u5668\u200b\u5185\u200b\u7684\u200b /paddle \u200b\u76ee\u5f55\u200b\uff1a

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b >= 19.03\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a

# \u200b\u5bf9\u4e8e\u200b cpu \u200b\u7528\u6237\u200b:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b gpu \u200b\u7528\u6237\u200b:\n# CUDA11.8 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA12.3 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 19.03 \u200b\u4f46\u200b >= 17.06\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a
\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
# \u200b\u5bf9\u4e8e\u200b cpu \u200b\u7528\u6237\u200b:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b gpu \u200b\u7528\u6237\u200b:\n# CUDA11.8 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA12.3 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 17.06\uff0c\u200b\u8bf7\u200b\u5347\u7ea7\u200b Docker \u200b\u7248\u672c\u200b\u3002

  • \u200b\u6ce8\u200b\uff1a\u200b\u66f4\u591a\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b docker \u200b\u955c\u50cf\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u3002

"},{"location":"installation/paddlepaddle_install.html#pip","title":"\u57fa\u4e8e\u200b pip \u200b\u5b89\u88c5\u200b\u98de\u6868","text":"

\u200b\u82e5\u200b\u60a8\u200b\u901a\u8fc7\u200b pip \u200b\u5b89\u88c5\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u4e0b\u8ff0\u200b\u547d\u4ee4\u200b\uff0c\u200b\u7528\u200b pip \u200b\u5728\u200b\u5f53\u524d\u200b\u73af\u5883\u200b\u4e2d\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b PaddlePaddle\uff1a

# cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u66f4\u591a\u200b\u98de\u6868\u200b Wheel \u200b\u7248\u672c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u3002

\u200b\u5173\u4e8e\u200b\u5176\u4ed6\u200b\u786c\u4ef6\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u53ef\u4ee5\u200b\u9a8c\u8bc1\u200b PaddlePaddle \u200b\u662f\u5426\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff1a

python -c \"import paddle; print(paddle.__version__)\"\n
\u200b\u5982\u679c\u200b\u5df2\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff0c\u200b\u5c06\u200b\u8f93\u51fa\u200b\u4ee5\u4e0b\u5185\u5bb9\u200b\uff1a

3.0.0-beta2\n

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u5982\u679c\u200b\u5728\u200b\u5b89\u88c5\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u51fa\u73b0\u200b\u4efb\u4f55\u200b\u95ee\u9898\u200b\uff0c\u200b\u6b22\u8fce\u200b\u5728\u200bPaddle\u200b\u4ed3\u5e93\u200b\u4e2d\u63d0\u200bIssue\u3002

"},{"location":"module_usage/instructions/benchmark.html","title":"\u6a21\u578b\u200b\u63a8\u7406\u200b Benchmark","text":"

PaddleX \u200b\u652f\u6301\u200b\u7edf\u8ba1\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff0c\u200b\u9700\u200b\u901a\u8fc7\u200b\u73af\u5883\u53d8\u91cf\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

  • PADDLE_PDX_INFER_BENCHMARK\uff1a\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b True \u200b\u65f6\u5219\u200b\u5f00\u542f\u200b Benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_WARMUP\uff1a\u200b\u8bbe\u7f6e\u200b warm up\uff0c\u200b\u5728\u200b\u5f00\u59cb\u200b\u6d4b\u8bd5\u200b\u524d\u200b\uff0c\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u5faa\u73af\u200b\u8fed\u4ee3\u200b n \u200b\u6b21\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 0\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_DATA_SIZE\uff1a \u200b\u8bbe\u7f6e\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u7684\u200b\u5c3a\u5bf8\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 224\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_ITER\uff1a\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b Benchmark \u200b\u6d4b\u8bd5\u200b\u7684\u200b\u5faa\u73af\u200b\u6b21\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u4e3a\u200b None \u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_OUTPUT\uff1a\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u4fdd\u5b58\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b ./benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b None\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4fdd\u5b58\u200b Benchmark \u200b\u6307\u6807\u200b\uff1b

\u200b\u4f7f\u7528\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

PADDLE_PDX_INFER_BENCHMARK=True \\\nPADDLE_PDX_INFER_BENCHMARK_WARMUP=5 \\\nPADDLE_PDX_INFER_BENCHMARK_DATA_SIZE=320 \\\nPADDLE_PDX_INFER_BENCHMARK_ITER=10 \\\nPADDLE_PDX_INFER_BENCHMARK_OUTPUT=./benchmark \\\npython main.py \\\n    -c ./paddlex/configs/object_detection/PicoDet-XS.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=None \\\n    -o Predict.batch_size=2 \\\n    -o Predict.input=None\n

\u200b\u5728\u200b\u5f00\u542f\u200b Benchmark \u200b\u540e\u200b\uff0c\u200b\u5c06\u200b\u81ea\u52a8\u200b\u6253\u5370\u200b benchmark \u200b\u6307\u6807\u200b\uff1a

+----------------+-----------------+-----------------+------------------------+\n|   Component    | Total Time (ms) | Number of Calls | Avg Time Per Call (ms) |\n+----------------+-----------------+-----------------+------------------------+\n|    ReadCmp     |   100.20136833  |        10       |      10.02013683       |\n|     Resize     |   17.05980301   |        20       |       0.85299015       |\n|   Normalize    |   45.44949532   |        20       |       2.27247477       |\n|   ToCHWImage   |    0.03671646   |        20       |       0.00183582       |\n|    Copy2GPU    |   12.28785515   |        10       |       1.22878551       |\n|     Infer      |   76.59482956   |        10       |       7.65948296       |\n|    Copy2CPU    |    0.39863586   |        10       |       0.03986359       |\n| DetPostProcess |    0.43916702   |        20       |       0.02195835       |\n+----------------+-----------------+-----------------+------------------------+\n+-------------+-----------------+---------------------+----------------------------+\n|    Stage    | Total Time (ms) | Number of Instances | Avg Time Per Instance (ms) |\n+-------------+-----------------+---------------------+----------------------------+\n|  PreProcess |   162.74738312  |          20         |         8.13736916         |\n|  Inference  |   89.28132057   |          20         |         4.46406603         |\n| PostProcess |    0.43916702   |          20         |         0.02195835         |\n|   End2End   |    0.27992606   |          20         |         0.01399630         |\n|    WarmUp   |    5.37562728   |          5          |         1.07512546         |\n+-------------+-----------------+---------------------+----------------------------+\n

\u200b\u5728\u200b Benchmark \u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u7edf\u8ba1\u200b\u8be5\u200b\u6a21\u578b\u200b\u5168\u90e8\u200b\u7ec4\u4ef6\u200b\uff08Component\uff09\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001\u200b\u8c03\u7528\u200b\u6b21\u6570\u200b\uff08Number of Calls\uff09\u3001\u200b\u8c03\u7528\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Call\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u4ee5\u53ca\u200b\u6309\u200b\u9884\u70ed\u200b\uff08WarmUp\uff09\u3001\u200b\u9884\u5904\u7406\u200b\uff08PreProcess\uff09\u3001\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\uff08Inference\uff09\u3001\u200b\u540e\u5904\u7406\u200b\uff08PostProcess\uff09\u200b\u548c\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\uff08End2End\uff09\u200b\u8fdb\u884c\u200b\u5212\u5206\u200b\u7684\u200b\u8017\u65f6\u200b\u7edf\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u6bcf\u4e2a\u200b\u9636\u6bb5\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001**\u200b\u6837\u672c\u6570\u200b\uff08Number of Instances\uff09\u200b\u548c\u200b**\u200b\u5355\u200b\u6837\u672c\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Instance\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u540c\u65f6\u200b\uff0c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5230\u200b\u5230\u200b\u672c\u5730\u200b\uff1a ./benchmark/detail.csv \u200b\u548c\u200b ./benchmark/summary.csv\uff1a

Component,Total Time (ms),Number of Calls,Avg Time Per Call (ms)\nReadCmp,100.20136833190918,10,10.020136833190918\nResize,17.059803009033203,20,0.8529901504516602\nNormalize,45.44949531555176,20,2.272474765777588\nToCHWImage,0.036716461181640625,20,0.0018358230590820312\nCopy2GPU,12.28785514831543,10,1.228785514831543\nInfer,76.59482955932617,10,7.659482955932617\nCopy2CPU,0.3986358642578125,10,0.03986358642578125\nDetPostProcess,0.4391670227050781,20,0.021958351135253906\n
Stage,Total Time (ms),Number of Instances,Avg Time Per Instance (ms)\nPreProcess,162.74738311767578,20,8.137369155883789\nInference,89.28132057189941,20,4.464066028594971\nPostProcess,0.4391670227050781,20,0.021958351135253906\nEnd2End,0.279926061630249,20,0.013996303081512451\nWarmUp,5.375627279281616,5,1.0751254558563232\n
"},{"location":"module_usage/instructions/config_parameters_common.html","title":"PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e","text":""},{"location":"module_usage/instructions/config_parameters_common.html#global","title":"Global","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b model str \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mode str \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\uff08check_dataset/train/evaluate/export/predict\uff09 check_dataset dataset_dir str \u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b device str \u200b\u6307\u5b9a\u200b\u4f7f\u7528\u200b\u7684\u200b\u8bbe\u5907\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bbe\u5907\u200bid output str \u200b\u8f93\u51fa\u200b\u8def\u5f84\u200b \"output\""},{"location":"module_usage/instructions/config_parameters_common.html#checkdataset","title":"CheckDataset","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b convert.enable bool \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff1b\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u3001\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u3001\u200b\u6587\u6863\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u3001\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u3001\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u3001\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u3001\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u3001\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff1b\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u652f\u6301\u200bCOCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3001\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u652f\u6301\u200bLabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u548c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200bVOC\u3001LabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u652f\u6301\u200bPKL\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u652f\u6301\u200bxlsx\u200b\u548c\u200bxls\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b False convert.src_dataset_type str \u200b\u9700\u8981\u200b\u8f6c\u6362\u200b\u7684\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b null split.enable bool \u200b\u662f\u5426\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b False split.train_percent int \u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200bval_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null split.val_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null split.gallery_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u4e2d\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u3001query_percent\uff0c\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b\u200b\u8be5\u200b\u53c2\u6570\u200b\u53ea\u6709\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u624d\u200b\u4f1a\u200b\u4f7f\u7528\u200b null split.query_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u4e2d\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u3001gallery_percent\uff0c\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b\u200b\u8be5\u200b\u53c2\u6570\u200b\u53ea\u6709\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u624d\u200b\u4f1a\u200b\u4f7f\u7528\u200b null"},{"location":"module_usage/instructions/config_parameters_common.html#train","title":"Train","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b num_classes int \u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u200b\uff1b\u200b\u5982\u679c\u200b\u60a8\u200b\u9700\u8981\u200b\u5728\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u9700\u8981\u200b\u5bf9\u200b\u8be5\u200b\u53c2\u6570\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1b\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u3001\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4e0d\u200b\u652f\u6301\u200b\u8be5\u200b\u53c2\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7c7b\u522b\u200b\u6570\u200b epochs_iters int \u200b\u6a21\u578b\u200b\u5bf9\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b batch_size int \u200b\u8bad\u7ec3\u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6279\u200b\u5927\u5c0f\u200b learning_rate float \u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b pretrain_weight_path str \u200b\u9884\u200b\u8bad\u7ec3\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b null warmup_steps int \u200b\u9884\u70ed\u200b\u6b65\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u70ed\u200b\u6b65\u6570\u200b resume_path str \u200b\u6a21\u578b\u200b\u4e2d\u65ad\u200b\u540e\u200b\u7684\u200b\u6062\u590d\u200b\u8def\u5f84\u200b null log_interval int \u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694\u200b eval_interval int \u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u95f4\u9694\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u95f4\u9694\u200b save_interval int \u200b\u6a21\u578b\u200b\u4fdd\u5b58\u200b\u95f4\u9694\u200b\uff1b\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3001\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u8be5\u200b\u53c2\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u4fdd\u5b58\u200b\u95f4\u9694"},{"location":"module_usage/instructions/config_parameters_common.html#evaluate","title":"Evaluate","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd\u200b log_interval int \u200b\u8bc4\u4f30\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bc4\u4f30\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694"},{"location":"module_usage/instructions/config_parameters_common.html#export","title":"Export","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u5bfc\u51fa\u200b\u6a21\u578b\u200b\u7684\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd"},{"location":"module_usage/instructions/config_parameters_common.html#predict","title":"Predict","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b batch_size int \u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b model_dir str \u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u63a8\u7406\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd\u200b input str \u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84"},{"location":"module_usage/instructions/config_parameters_time_series.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e","text":""},{"location":"module_usage/instructions/config_parameters_time_series.html#global","title":"Global","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b model str \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mode str \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\uff08check_dataset/train/evaluate/export/predict\uff09 check_dataset dataset_dir str \u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b device str \u200b\u6307\u5b9a\u200b\u4f7f\u7528\u200b\u7684\u200b\u8bbe\u5907\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bbe\u5907\u200bid output str \u200b\u8f93\u51fa\u200b\u8def\u5f84\u200b \"output\""},{"location":"module_usage/instructions/config_parameters_time_series.html#checkdataset","title":"CheckDataset","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b convert.enable bool \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff1b\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u652f\u6301\u200bxlsx\u200b\u548c\u200bxls\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b False convert.src_dataset_type str \u200b\u9700\u8981\u200b\u8f6c\u6362\u200b\u7684\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b null split.enable bool \u200b\u662f\u5426\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b False split.train_percent int \u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200bval_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null split.val_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null"},{"location":"module_usage/instructions/config_parameters_time_series.html#train","title":"Train","text":""},{"location":"module_usage/instructions/config_parameters_time_series.html#_1","title":"\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u516c\u5171\u200b\u53c2\u6570","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b epochs_iters int \u200b\u6a21\u578b\u200b\u5bf9\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b batch_size int \u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6279\u200b\u5927\u5c0f\u200b learning_rate float \u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b time_col str \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\u3002 yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b freq str or int \u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\u3002 yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9891\u7387"},{"location":"module_usage/instructions/config_parameters_time_series.html#_2","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u53c2\u6570","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b target_cols str \u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b OT input_len int \u200b\u5bf9\u4e8e\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8be5\u200b\u53c2\u6570\u200b\u8868\u793a\u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u5386\u53f2\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u53ca\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u80fd\u591f\u200b\u53c2\u8003\u200b\u7684\u200b\u5386\u53f2\u200b\u4fe1\u606f\u200b\u8d8a\u200b\u591a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u9ad8\u200b\u3002 96 predict_len int \u200b\u5e0c\u671b\u200b\u6a21\u578b\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u5ea6\u200b\uff1b\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b\u7684\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u8d8a\u957f\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u4f4e\u200b\u3002 96 patience int early stop\u200b\u673a\u5236\u200b\u53c2\u6570\u200b\uff0c\u200b\u6307\u5728\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u5bb9\u5fcd\u200b\u6a21\u578b\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u7684\u200b\u6027\u80fd\u200b\u591a\u5c11\u200b\u6b21\u8fde\u7eed\u200b\u6ca1\u6709\u200b\u6539\u8fdb\u200b\uff1b\u200b\u8010\u5fc3\u200b\u503c\u8d8a\u200b\u5927\u200b\uff0c\u200b\u4e00\u822c\u200b\u8bad\u7ec3\u200b\u65f6\u95f4\u200b\u8d8a\u957f\u200b\u3002 10"},{"location":"module_usage/instructions/config_parameters_time_series.html#_3","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b input_len int \u200b\u5bf9\u4e8e\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8be5\u200b\u53c2\u6570\u200b\u8868\u793a\u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff0c\u200b\u4f1a\u200b\u6309\u7167\u200b\u8be5\u200b\u957f\u5ea6\u200b\u5bf9\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5207\u7247\u200b\uff0c\u200b\u9884\u6d4b\u200b\u8be5\u200b\u957f\u5ea6\u200b\u4e0b\u200b\u8fd9\u200b\u4e00\u6bb5\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u8003\u8651\u200b\u3002\u200b\u5982\u200b\uff1a\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\uff0c\u200b\u5219\u200b\u8868\u793a\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b 96 \u200b\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\u3002 96 feature_cols str \u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u8868\u793a\u200b\u80fd\u591f\u200b\u5224\u65ad\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u76f8\u5173\u200b\u53d8\u91cf\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\uff0c\u200b\u53ef\u80fd\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u8fd0\u8f6c\u200b\u65f6\u200b\u7684\u200b\u6563\u70ed\u91cf\u200b\u6709\u5173\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u8bbe\u7f6e\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\u3002 feature_0,feature_1 label_col str \u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u7f16\u53f7\u200b\uff0c\u200b\u5f02\u5e38\u200b\u70b9\u4e3a\u200b 1\uff0c\u200b\u6b63\u5e38\u200b\u70b9\u4e3a\u200b 0\u3002 label"},{"location":"module_usage/instructions/config_parameters_time_series.html#_4","title":"\u65f6\u5e8f\u200b\u5206\u7c7b","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b target_cols str \u200b\u7528\u4e8e\u200b\u5224\u522b\u200b\u7c7b\u522b\u200b\u7684\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b dim_0,dim_1,dim_2 freq str or int \u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\u3002 1 group_id str \u200b\u4e00\u4e2a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u8868\u793a\u200b\u7684\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65f6\u5e8f\u200b\u6837\u672c\u200b\uff0c\u200b\u76f8\u540c\u200b\u7f16\u53f7\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u7ec4\u6210\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u6307\u5b9a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b, \u200b\u5982\u200b\uff1agroup_id\u3002 group_id static_cov_cols str \u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u7684\u200b\u7c7b\u522b\u200b\u7f16\u53f7\u200b\u5217\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u6807\u7b7e\u200b\u76f8\u540c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u7c7b\u522b\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u5982\u200b\uff1alabel\u3002 label"},{"location":"module_usage/instructions/config_parameters_time_series.html#evaluate","title":"Evaluate","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd"},{"location":"module_usage/instructions/config_parameters_time_series.html#export","title":"Export","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u5bfc\u51fa\u200b\u6a21\u578b\u200b\u7684\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd"},{"location":"module_usage/instructions/config_parameters_time_series.html#predict","title":"Predict","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b batch_size int \u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b model_dir str \u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u63a8\u7406\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd\u200b input str \u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84"},{"location":"module_usage/instructions/model_python_API.html","title":"PaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200bPython\u200b\u811a\u672c\u200b\u8fdb\u884c\u200b\u5355\u200b\u6a21\u578b\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"module_usage/instructions/model_python_API.html#_1","title":"\u4e00\u200b\u3001\u200b\u4f7f\u7528\u200b\u793a\u4f8b","text":"

\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e09\u6b65\u200b\uff1a

  • \u200b\u8c03\u7528\u200bcreate_model()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u8c03\u7528\u200bprint()\u3001save_to_xxx()\u200b\u7b49\u200b\u76f8\u5173\u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316\u200b\u6216\u662f\u200b\u4fdd\u5b58\u200b\u3002
"},{"location":"module_usage/instructions/model_python_API.html#api","title":"\u4e8c\u200b\u3001API\u200b\u8bf4\u660e","text":""},{"location":"module_usage/instructions/model_python_API.html#1-create_model","title":"1. \u200b\u8c03\u7528\u200bcreate_model()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61","text":"
  • create_model\uff1a\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • model_name\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u6a21\u578b\u200b\u540d\u200b\u6216\u662f\u200b\u672c\u5730\u200binference\u200b\u6a21\u578b\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u201cPP-LCNet_x1_0\u201d\u3001\u201c/path/to/PP-LCNet_x1_0_infer/\u201d\uff1b
    • device\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff0c\u200b\u5982\u4e3a\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u53ef\u4ee5\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u201ccpu\u201d\u3001\u201cgpu:2\u201d\uff1b
    • pp_option\uff1aPaddlePredictorOption \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aBasePredictor\u200b\u7c7b\u578b\u200b\u3002
"},{"location":"module_usage/instructions/model_python_API.html#2-predict","title":"2. \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b","text":"
  • predict\uff1a\u200b\u4f7f\u7528\u200b\u5b9a\u4e49\u200b\u7684\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5bf9\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • input\uff1a\u200b\u4efb\u610f\u200b\u7c7b\u578b\u200b\uff0c\u200b\u652f\u6301\u200bstr\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6216\u662f\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6587\u4ef6\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u6216\u662f\u200b\u7f51\u7edc\u200bURL\uff1b\u200b\u5bf9\u4e8e\u200bCV\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\uff1b\u200b\u5bf9\u4e8e\u200bTS\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200bpandas.DataFrame\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff1b\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6240\u200b\u6784\u6210\u200b\u7684\u200blist\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1agenerator\uff0c\u200b\u6bcf\u6b21\u200b\u8c03\u7528\u200b\u8fd4\u56de\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
"},{"location":"module_usage/instructions/model_python_API.html#3","title":"3. \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316","text":"

\u200b\u6a21\u578b\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u652f\u6301\u200b\u8bbf\u95ee\u200b\u3001\u200b\u53ef\u89c6\u5316\u200b\u53ca\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u76f8\u5e94\u200b\u7684\u200b\u5c5e\u6027\u200b\u6216\u200b\u65b9\u6cd5\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"module_usage/instructions/model_python_API.html#_2","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • str\uff1astr \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bstr\u200b\u8868\u793a\u200b\uff1b
  • json\uff1ajson\u200b\u683c\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1adict \u200b\u7c7b\u578b\u200b\uff1b
  • img\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u56fe\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aPIL.Image \u200b\u7c7b\u578b\u200b\uff1b
  • html\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bHTML\u200b\u8868\u793a\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff1b
"},{"location":"module_usage/instructions/model_python_API.html#_3","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • print()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8f93\u51fa\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e0d\u200b\u4fbf\u4e8e\u200b\u76f4\u63a5\u200b\u8f93\u51fa\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u7701\u7565\u200b\u76f8\u5173\u200b\u5185\u5bb9\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • json_format\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4f7f\u7528\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u8f93\u51fa\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_json()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5305\u542b\u200b\u65e0\u6cd5\u200bjson\u200b\u5e8f\u5217\u5316\u200b\u7684\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u8fdb\u884c\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4ee5\u200b\u5b9e\u73b0\u200b\u5e8f\u5217\u5316\u200b\u4fdd\u5b58\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_img()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_csv()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bCSV\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_html()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bHTML\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_xlsx()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bXLSX\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
"},{"location":"module_usage/instructions/model_python_API.html#4","title":"4. \u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e","text":"

PaddleX \u200b\u652f\u6301\u200b\u901a\u8fc7\u200bPaddlePredictorOption\u200b\u8bbe\u7f6e\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u76f8\u5173\u200bAPI\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"module_usage/instructions/model_python_API.html#_4","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • deivce\uff1a\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u53ca\u200b\u5361\u53f7\u200b\uff0c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'gpu', 'cpu', 'npu', 'xpu', 'mlu'\uff0c\u200b\u5f53\u200b\u4f7f\u7528\u200b\u52a0\u901f\u5361\u200b\u65f6\u200b\uff0c\u200b\u652f\u6301\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u4f7f\u7528\u200b 0 \u200b\u53f7\u200b gpu\uff1a'gpu:0'\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'gpu:0'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002
  • run_mode\uff1a\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'paddle'\uff0c'trt_fp32'\uff0c'trt_fp16'\uff0c'trt_int8'\uff0c'mkldnn'\uff0c'mkldnn_bf16'\uff0c\u200b\u5176\u4e2d\u200b 'mkldnn' \u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u53ef\u9009\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'paddle'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u3002
  • cpu_threads\uff1acpu \u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b int \u200b\u7c7b\u578b\u200b\uff0ccpu \u200b\u63a8\u7406\u200b\u65f6\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aint \u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\u3002
"},{"location":"module_usage/instructions/model_python_API.html#_5","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • get_support_run_mode\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\u3002
  • get_support_device\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3002
  • get_device\uff1a\u200b\u83b7\u53d6\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html","title":"\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u662f\u200b\u4e00\u79cd\u200b\u5728\u200b\u6ca1\u6709\u200b\u6807\u7b7e\u200b\u6216\u200b\u5c11\u91cf\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u548c\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u4e0e\u200b\u5927\u591a\u6570\u200b\u6570\u636e\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u5f02\u5e38\u200b\u6216\u200b\u7f55\u89c1\u200b\u6837\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u8fd9\u79cd\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u8d28\u91cf\u200b\u63a7\u5236\u200b\u3001\u200b\u533b\u7597\u200b\u8bca\u65ad\u200b\u7b49\u200b\u591a\u4e2a\u200b\u9886\u57df\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ROCAUC\uff08Avg\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b STFPM\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.962 22.5 \u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u7531\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6559\u5e08\u200b\u7f51\u7edc\u200b\u548c\u200b\u7ed3\u6784\u200b\u76f8\u540c\u200b\u7684\u200b\u5b66\u751f\u200b\u7f51\u7edc\u200b\u7ec4\u6210\u200b\u3002\u200b\u5b66\u751f\u200b\u7f51\u7edc\u200b\u901a\u8fc7\u200b\u5c06\u200b\u81ea\u8eab\u200b\u7279\u5f81\u200b\u4e0e\u200b\u6559\u5e08\u200b\u7f51\u7edc\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u7279\u5f81\u200b\u76f8\u5339\u914d\u200b\u6765\u200b\u68c0\u6d4b\u200b\u5f02\u5e38\u200b\u3002

\u200b\u4ee5\u4e0a\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b MVTec_AD \u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002 \u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"STFPM\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"uad_grid.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleSeg\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bDemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mvtec_examples.tar -P ./dataset\ntar -xf ./dataset/mvtec_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"train_samples\": 264,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"val_samples\": 57,\n    \"num_classes\": 231\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mvtec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 264\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 57\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bSTFPM\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSTFPM.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSTFPM.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u8bb0\u5f55\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b IoU / Precision / Recall\uff1b

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff0c\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"uad_grid.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSTFPM.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html","title":"\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u4e00\u9879\u200b\u57fa\u672c\u200b\u4efb\u52a1\u200b\uff0c\u200b\u65e8\u5728\u200b\u4ece\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u5e76\u200b\u5b9a\u4f4d\u200b\u4eba\u8138\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5927\u5c0f\u200b\u3002\u200b\u5b83\u200b\u662f\u200b\u4eba\u8138\u8bc6\u522b\u200b\u3001\u200b\u4eba\u8138\u200b\u5206\u6790\u200b\u7b49\u200b\u540e\u7eed\u200b\u4efb\u52a1\u200b\u7684\u200b\u524d\u63d0\u200b\u548c\u200b\u57fa\u7840\u200b\u3002\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u901a\u8fc7\u200b\u6784\u5efa\u200b\u6df1\u5ea6\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b66\u4e60\u200b\u4eba\u8138\u200b\u7684\u200b\u7279\u5f81\u200b\u8868\u793a\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u51c6\u786e\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AP (%)Easy/Medium/Hard GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b BlazeFace\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.7/73.4/49.5 0.447 \u200b\u8f7b\u91cf\u200b\u9ad8\u6548\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b BlazeFace-FPN-SSH\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.2/80.5/60.5 0.606 BlazeFace\u200b\u7684\u200b\u6539\u8fdb\u200b\u6a21\u578b\u200b\uff0c\u200b\u589e\u52a0\u200bFPN\u200b\u548c\u200bSSH\u200b\u7ed3\u6784\u200b PicoDet_LCNet_x2_5_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.7/90.7/68.1 28.9 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.9/91.8/79.8 26.5 \u200b\u57fa\u4e8e\u200bPP-YOLOE_plus-S\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5728\u200bWIDER-FACE\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\uff0c\u200b\u4ee5\u200b640*640\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u5c3a\u5bf8\u200b\u8bc4\u4f30\u200b\u5f97\u5230\u200b\u7684\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PicoDet_LCNet_x2_5_face\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_detection.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerface_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerface_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_849.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_Parade_0_904.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_799.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_384.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_538.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_429.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerface_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPicoDet_LCNet_x2_5_face\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet_LCNet_x2_5_face.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet_LCNet_x2_5_face.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff0c\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_detection.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet_LCNet_x2_5_face.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u4eba\u8138\u8bc6\u522b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html","title":"\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4ee5\u200b\u7ecf\u8fc7\u200b\u68c0\u6d4b\u200b\u63d0\u53d6\u200b\u548c\u200b\u5173\u952e\u70b9\u200b\u77eb\u6b63\u200b\u5904\u7406\u200b\u7684\u200b\u6807\u51c6\u5316\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u4ece\u200b\u8fd9\u4e9b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u5177\u6709\u200b\u9ad8\u5ea6\u200b\u8fa8\u8bc6\u200b\u6027\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4f9b\u200b\u540e\u7eed\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\uff0c\u200b\u5982\u200b\u4eba\u8138\u200b\u5339\u914d\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u7b49\u200b\u4efb\u52a1\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8f93\u51fa\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b AP (%)AgeDB-30/CFP-FP/LFW GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b MobileFaceNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 128 96.28/96.71/99.58 4.1 \u200b\u57fa\u4e8e\u200bMobileFaceNet\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b ResNet50_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 512 98.12/98.56/99.77 87.2 \u200b\u57fa\u4e8e\u200bResNet50\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5206\u522b\u200b\u5728\u200bAgeDB-30\u3001CFP-FP\u200b\u548c\u200bLFW\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u6d4b\u5f97\u200b\u7684\u200bAccuracy\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"MobileFaceNet\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_recognition_001.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleClas\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u91c7\u53d6\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7ec4\u7ec7\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u8bf7\u200b\u6ce8\u610f\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u4e0e\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65b9\u5f0f\u200b\u6709\u6240\u4e0d\u540c\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b4.1.4\u200b\u8282\u200b \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u96c6\u200b\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_rec_examples.tar -P ./dataset\ntar -xf ./dataset/face_rec_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_label_file\": \"../../dataset/face_rec_examples/train/label.txt\",\n    \"train_num_classes\": 995,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/01378592.jpg\",\n      \"check_dataset/demo_img/04331410.jpg\",\n      \"check_dataset/demo_img/03485713.jpg\",\n      \"check_dataset/demo_img/02382123.jpg\",\n      \"check_dataset/demo_img/01722397.jpg\",\n      \"check_dataset/demo_img/02682349.jpg\",\n      \"check_dataset/demo_img/00272794.jpg\",\n      \"check_dataset/demo_img/03151987.jpg\",\n      \"check_dataset/demo_img/01725764.jpg\",\n      \"check_dataset/demo_img/02580369.jpg\"\n    ],\n    \"val_label_file\": \"../../dataset/face_rec_examples/val/pair_label.txt\",\n    \"val_num_classes\": 2,\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/Don_Carcieri_0001.jpg\",\n      \"check_dataset/demo_img/Eric_Fehr_0001.jpg\",\n      \"check_dataset/demo_img/Harry_Kalas_0001.jpg\",\n      \"check_dataset/demo_img/Francis_Ford_Coppola_0001.jpg\",\n      \"check_dataset/demo_img/Amer_al-Saadi_0001.jpg\",\n      \"check_dataset/demo_img/Sergei_Ivanov_0001.jpg\",\n      \"check_dataset/demo_img/Erin_Runnion_0003.jpg\",\n      \"check_dataset/demo_img/Bill_Stapleton_0001.jpg\",\n      \"check_dataset/demo_img/Daniel_Bruehl_0001.jpg\",\n      \"check_dataset/demo_img/Clare_Short_0004.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/face_rec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 995\uff1b
  • attributes.val_num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 2\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e0e\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#414","title":"4.1.4 \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u96c6\u200b\u7ec4\u7ec7\u200b\u65b9\u5f0f","text":"

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u4e0e\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u4e0d\u540c\u200b\uff0c\u200b\u82e5\u200b\u9700\u8981\u200b\u5728\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u4e0a\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u548c\u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u7ec4\u7ec7\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff1a

face_rec_dataroot      # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 train              # \u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n   \u251c\u2500\u2500 images          # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200blabel.txt\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      ...\n   \u2514\u2500\u2500 label.txt       # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u76f8\u5bf9\u200b`train`\u200b\u7684\u200b\u8def\u5f84\u200b\u548c\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\uff08\u200b\u4eba\u8138\u200b\u8eab\u4efd\u200b\uff09id\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/image_06765.jpg 0\n\u251c\u2500\u2500 val                # \u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n   \u251c\u2500\u2500 images          # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200bpari_label.txt\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      ...\n   \u2514\u2500\u2500 pair_label.txt  # \u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u4e24\u4e2a\u200b\u8981\u200b\u6bd4\u200b\u5bf9\u200b\u7684\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u4e00\u4e2a\u200b\u8868\u793a\u200b\u8be5\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u662f\u5426\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u4eba\u200b\u7684\u200b0\u30011\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\u3002\n

\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200bpair_label.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u793a\u4f8b\u200b:

# \u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b1.jpg \u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b2.jpg \u200b\u6807\u7b7e\u200b(0\u200b\u8868\u793a\u200b\u8be5\u884c\u200b\u7684\u200b\u4e24\u4e2a\u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u4e0d\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u4eba\u200b\uff0c1\u200b\u8868\u793a\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u4eba\u200b)\nimages/Angela_Merkel_0001.jpg images/Angela_Merkel_0002.jpg 1\nimages/Bruce_Gebhardt_0001.jpg images/Masao_Azuma_0001.jpg 0\nimages/Francis_Ford_Coppola_0001.jpg images/Francis_Ford_Coppola_0002.jpg 1\nimages/Jason_Kidd_0006.jpg images/Jason_Kidd_0008.jpg 1\nimages/Miyako_Miyazaki_0002.jpg images/Munir_Akram_0002.jpg 0\n
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bMobileFaceNet\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bMobileFaceNet.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bMobileFaceNet.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Accuracy\uff1b

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff0c\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_recognition_001.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bMobileFaceNet.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u4eba\u8138\u8bc6\u522b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5206\u652f\u200b\u4efb\u52a1\u200b\uff0c\u200b\u6307\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\u6765\u200b\u5224\u65ad\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u662f\u5426\u200b\u5b58\u5728\u200b\u884c\u4eba\u200b\uff0c\u200b\u5e76\u200b\u7ed9\u51fa\u200b\u6bcf\u4e2a\u200b\u884c\u4eba\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u4fe1\u606f\u200b\u5bf9\u4e8e\u200b\u667a\u80fd\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u3001\u200b\u4eba\u4f53\u200b\u884c\u4e3a\u200b\u5206\u6790\u200b\u3001\u200b\u667a\u80fd\u200b\u9a7e\u9a76\u200b\u3001\u200b\u667a\u80fd\u200b\u673a\u5668\u4eba\u200b\u7b49\u200b\u591a\u79cd\u200b\u5e94\u7528\u200b\u81f3\u5173\u91cd\u8981\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-L_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 48.0 81.9 32.8 777.7 196.02 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-S_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.5 77.9 15.0 179.3 28.79

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCrowdHuman\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_human\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"human_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerperson_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerperson_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000041.jpg\",\n      \"check_dataset/demo_img/000042.jpg\",\n      \"check_dataset/demo_img/000044.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/001138.jpg\",\n      \"check_dataset/demo_img/001140.jpg\",\n      \"check_dataset/demo_img/001141.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerperson_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b500\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-YOLOE-S_human\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_human.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_human.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"human_detection.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_human.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5bf9\u200b\u8f93\u5165\u200b\u7684\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u63a5\u6536\u200b\u56fe\u50cf\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u7136\u540e\u200b\u901a\u8fc7\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6216\u200b\u5176\u4ed6\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u6839\u636e\u200b\u56fe\u50cf\u200b\u7684\u200b\u7279\u6027\u200b\u548c\u200b\u5185\u5bb9\u200b\uff0c\u200b\u5c06\u200b\u5176\u200b\u5206\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u4e00\u4e2a\u200b\u52a8\u7269\u200b\u8bc6\u522b\u7cfb\u7edf\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u5c06\u200b\u8f93\u5165\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u732b\u200b\u201d\u3001\u201c\u200b\u72d7\u200b\u201d\u3001\u201c\u200b\u9a6c\u200b\u201d\u200b\u7b49\u200b\u7c7b\u522b\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u5206\u7c7b\u200b\u7ed3\u679c\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u51fa\u200b\uff0c\u200b\u4f9b\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\u6216\u200b\u7cfb\u7edf\u200b\u4f7f\u7528\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b9\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b80\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M CLIP\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u89c6\u89c9\u200b\u548c\u200b\u8bed\u8a00\u200b\u76f8\u5173\u8054\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u91c7\u7528\u200b\u5bf9\u6bd4\u200b\u5b66\u4e60\u200b\u548c\u200b\u9884\u200b\u8bad\u7ec3\u65b9\u6cd5\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u65e0\u200b\u76d1\u7763\u200b\u6216\u5f31\u200b\u76d1\u7763\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u5c24\u5176\u200b\u9002\u7528\u200b\u4e8e\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u5c06\u200b\u56fe\u50cf\u200b\u548c\u200b\u6587\u672c\u200b\u6620\u5c04\u200b\u5230\u200b\u540c\u4e00\u200b\u8868\u793a\u200b\u7a7a\u95f4\u200b\uff0c\u200b\u5b66\u4e60\u200b\u5230\u200b\u901a\u7528\u200b\u7279\u5f81\u200b\uff0c\u200b\u5177\u6709\u200b\u826f\u597d\u200b\u7684\u200b\u6cdb\u5316\u200b\u80fd\u529b\u200b\u548c\u200b\u89e3\u91ca\u6027\u200b\u3002\u200b\u5176\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8bad\u7ec3\u200b\u8bef\u5dee\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 CLIP_vit_large_patch14_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.84 12.8473 1513.87 313.9 M ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200bMeta\u200b\u5728\u200b2022\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u57fa\u4e8e\u200bCNN\u200b\u67b6\u6784\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200bResNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u901a\u8fc7\u200b\u501f\u9274\u200bSwinTransformer\u200b\u7684\u200b\u4f18\u70b9\u200b\u8bbe\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u8bad\u7ec3\u200b\u7b56\u7565\u200b\u548c\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7684\u200b\u4f18\u5316\u200b\u601d\u8def\u200b\uff0c\u200b\u4ece\u800c\u200b\u6539\u8fdb\u200b\u7684\u200b\u7eaf\u200bCNN\u200b\u67b6\u6784\u200b\u7f51\u7edc\u200b\uff0c\u200b\u63a2\u7d22\u200b\u4e86\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u6027\u80fd\u200b\u4e0a\u9650\u200b\u3002ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u5177\u5907\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u8bf8\u591a\u200b\u4f18\u70b9\u200b\uff0c\u200b\u5305\u62ec\u200b\u63a8\u7406\u200b\u6548\u7387\u9ad8\u200b\u548c\u200b\u6613\u4e8e\u200b\u8fc1\u79fb\u200b\u5230\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u7b49\u200b\u3002 ConvNeXt_base_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.27 66.4058 6598.92 700.7 M ConvNeXt_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.13 9.74075 1127.6 178.0 M ConvNeXt_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.03 5.48923 672.559 104.1 M FasterNet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.5 23.4415 - 357.1 M FasterNet\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e8\u5728\u200b\u63d0\u9ad8\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u7684\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u6539\u8fdb\u200b\u70b9\u200b\u4e3b\u8981\u200b\u5982\u4e0b\u200b\uff1a 1.\u200b\u91cd\u65b0\u200b\u5ba1\u89c6\u200b\u4e86\u200b\u6d41\u884c\u200b\u7684\u200b\u8fd0\u7b97\u7b26\u200b\uff0c\u200b\u53d1\u73b0\u200b\u4f4e\u200bFLOPS\u200b\u4e3b\u8981\u200b\u6765\u81ea\u200b\u4e8e\u200b\u8fd0\u7b97\u200b\u9891\u7e41\u200b\u7684\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\uff0c\u200b\u7279\u522b\u200b\u662f\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff1b 2.\u200b\u63d0\u51fa\u200b\u4e86\u200b\u90e8\u5206\u200b\u5377\u79ef\u200b(PConv)\uff0c\u200b\u901a\u8fc7\u200b\u51cf\u5c11\u200b\u5197\u4f59\u200b\u8ba1\u7b97\u200b\u548c\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\u6765\u200b\u66f4\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff1b 3.\u200b\u57fa\u4e8e\u200bPConv\u200b\u63a8\u51fa\u200b\u4e86\u200bFasterNet\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u8bbe\u8ba1\u65b9\u6848\u200b\uff0c\u200b\u5728\u200b\u4e0d\u200b\u5f71\u54cd\u200b\u6a21\u578b\u200b\u4efb\u52a1\u200b\u6027\u80fd\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5728\u200b\u5404\u79cd\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u663e\u8457\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u3002 FasterNet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.0 21.8936 - 204.6 M FasterNet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.3 13.0409 - 119.3 M FasterNet-T0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.9 12.2432 - 15.1 M FasterNet-T1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.9 11.3562 - 29.2 M FasterNet-T2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.703 - 57.4 M MobileNetV1_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.5 1.86754 7.48297 4.8 M MobileNetV1\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2017\u200b\u5e74\u200b\u53d1\u5e03\u200b\u7684\u200b\u7528\u4e8e\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u200b\u6216\u200b\u5d4c\u5165\u5f0f\u200b\u8bbe\u5907\u200b\u4e2d\u200b\u7684\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5c06\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u64cd\u4f5c\u200b\u62c6\u89e3\u200b\u6210\u200b\u6df1\u5ea6\u200b\u53ef\u200b\u5206\u79bb\u200b\u5377\u79ef\u200b\uff0c\u200b\u5373\u200bDepthwise\u200b\u5377\u79ef\u200b\u548c\u200bPointwise\u200b\u5377\u79ef\u200b\u7684\u200b\u7ec4\u5408\u200b\u3002\u200b\u76f8\u6bd4\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7ec4\u5408\u200b\u53ef\u4ee5\u200b\u5927\u5927\u200b\u8282\u7701\u200b\u53c2\u200b\u6570\u91cf\u200b\u548c\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u3002\u200b\u540c\u65f6\u200b\u8be5\u200b\u7f51\u7edc\u200b\u53ef\u4ee5\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7b49\u200b\u5176\u4ed6\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u3002 MobileNetV1_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.0 4.94234 11.1629 7.1 M MobileNetV2\u200b\u662f\u200bGoogle\u200b\u7ee7\u200bMobileNetV1\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u76f8\u6bd4\u200bMobileNetV1\uff0cMobileNetV2\u200b\u63d0\u51fa\u200b\u4e86\u200bLinear bottlenecks\u200b\u4e0e\u200bInverted residual block\u200b\u4f5c\u4e3a\u200b\u7f51\u7edc\u200b\u57fa\u672c\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u91cf\u200b\u5730\u200b\u5806\u53e0\u200b\u8fd9\u4e9b\u200b\u57fa\u672c\u200b\u6a21\u5757\u200b\uff0c\u200b\u6784\u6210\u200b\u4e86\u200bMobileNetV2\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u3002\u200b\u6700\u540e\u200b\uff0c\u200b\u5728\u200bFLOPs\u200b\u53ea\u6709\u200bMobileNetV1\u200b\u7684\u200b\u4e00\u534a\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\u53d6\u5f97\u200b\u4e86\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u5206\u7c7b\u200b\u7cbe\u5ea6\u200b\u3002 MobileNetV2_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 69.2 6.31302 14.5588 9.6 M MobileNetV3\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2019\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bNAS\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u4e3a\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\uff0c\u200b\u5c06\u200brelu\u200b\u548c\u200bsigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\u5206\u522b\u200b\u66ff\u6362\u200b\u4e3a\u200bhard_swish\u200b\u4e0e\u200bhard_sigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\uff0c\u200b\u540c\u65f6\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u4e9b\u200b\u4e13\u95e8\u200b\u4e3a\u200b\u51cf\u5c11\u200b\u7f51\u7edc\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u7684\u200b\u6539\u8fdb\u200b\u7b56\u7565\u200b\u3002 MobileNetV3_large_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.4 12.5485 51.6453 125.2 M MobileNetV4\u200b\u662f\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u8bbe\u8ba1\u200b\u7684\u200b\u9ad8\u6548\u200b\u67b6\u6784\u200b\u3002\u200b\u5176\u200b\u6838\u5fc3\u200b\u5728\u4e8e\u200b\u5f15\u5165\u200b\u4e86\u200bUIB\uff08Universal Inverted Bottleneck\uff09\u200b\u6a21\u5757\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u7edf\u4e00\u200b\u4e14\u200b\u7075\u6d3b\u200b\u7684\u200b\u7ed3\u6784\u200b\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bIB\uff08Inverted Bottleneck\uff09\u3001ConvNeXt\u3001FFN\uff08Feed Forward Network\uff09\u200b\u4ee5\u53ca\u200b\u6700\u65b0\u200b\u7684\u200bExtraDW\uff08Extra Depthwise\uff09\u200b\u6a21\u5757\u200b\u3002\u200b\u4e0e\u200bUIB\u200b\u540c\u65f6\u200b\u63a8\u51fa\u200b\u7684\u200b\u8fd8\u6709\u200bMobile MQA\uff0c\u200b\u8fd9\u200b\u662f\u200b\u79cd\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u52a0\u901f\u5668\u200b\u5b9a\u5236\u200b\u7684\u200b\u6ce8\u610f\u529b\u200b\u5757\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b\u9ad8\u200b\u8fbe\u200b39%\u200b\u7684\u200b\u663e\u8457\u200b\u52a0\u901f\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cMobileNetV4\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u795e\u7ecf\u200b\u67b6\u6784\u200b\u641c\u7d22\u200b\uff08Neural Architecture Search, NAS\uff09\u200b\u65b9\u6848\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u641c\u7d22\u200b\u7684\u200b\u6709\u6548\u6027\u200b\u3002 MobileNetV4_conv_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.5 19.7543 62.2624 42.9 M PP-HGNet_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.0 14.2969 327.114 249.4 M PP-HGNet\uff08High Performance GPU Net\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u9002\u7528\u200b\u4e8e\u200bGPU\u200b\u5e73\u53f0\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u7ed3\u5408\u200bVOVNet\u200b\u7684\u200b\u57fa\u7840\u200b\u51fa\u200b\u4f7f\u7528\u200b\u4e86\u200b\u53ef\u200b\u5b66\u4e60\u200b\u7684\u200b\u4e0b\u200b\u91c7\u6837\u200b\u5c42\u200b\uff08LDS Layer\uff09\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bResNet_vd\u3001PPHGNet\u200b\u7b49\u200b\u6a21\u578b\u200b\u7684\u200b\u4f18\u70b9\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200bGPU\u200b\u5e73\u53f0\u200b\u4e0a\u200b\u4e0e\u200b\u5176\u4ed6\u200bSOTA\u200b\u6a21\u578b\u200b\u5728\u200b\u76f8\u540c\u200b\u7684\u200b\u901f\u5ea6\u200b\u4e0b\u200b\u6709\u7740\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u5728\u200b\u540c\u7b49\u200b\u901f\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u9ad8\u4e8e\u200bResNet34-0\u200b\u6a21\u578b\u200b3.8\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u9ad8\u4e8e\u200bResNet50-0\u200b\u6a21\u578b\u200b2.4\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u5728\u200b\u4f7f\u7528\u200b\u76f8\u540c\u200b\u7684\u200bSLSD\u200b\u6761\u6b3e\u200b\u4e0b\u200b\uff0c\u200b\u6700\u7ec8\u200b\u8d85\u8d8a\u200b\u4e86\u200bResNet50-D\u200b\u6a21\u578b\u200b4.7\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\u3002\u200b\u4e0e\u6b64\u540c\u65f6\u200b\uff0c\u200b\u5728\u200b\u76f8\u540c\u200b\u7cbe\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u5176\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e5f\u200b\u8fdc\u8d85\u200b\u4e3b\u6d41\u200bVisionTransformer\u200b\u7684\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNet_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2\uff08High Performance GPU Network V2\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7684\u200bPP-HGNet\u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPP-HGNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u5176\u200b\u5728\u200bNVIDIA\u200b\u53d1\u5e03\u200b\u7684\u200b\u201cAccuracy-Latency Balance\u201d\u200b\u505a\u5230\u200b\u4e86\u200b\u6781\u81f4\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u4e86\u200b\u5176\u4ed6\u200b\u540c\u6837\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u6bcf\u79cd\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8003\u6807\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u5f3a\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 PP-HGNetV2-B1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.14 3.67722 6.66857 6.7 M PP-LCNet\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u5b83\u200b\u80fd\u200b\u5728\u200b\u4e0d\u200b\u589e\u52a0\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\uff0c\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u5176\u4ed6\u200b\u8f7b\u91cf\u7ea7\u200bSOTA\u200b\u6a21\u578b\u200b\u3002 PP-LCNet_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.05 5.23428 19.6005 23.7 M PP-LCNetV2 \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b PP-LCNet \u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200b PP-LCNet \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u4e3b\u8981\u200b\u4f7f\u7528\u200b\u91cd\u200b\u53c2\u6570\u200b\u5316\u200b\u7b56\u7565\u200b\u7ec4\u5408\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5927\u5c0f\u200b\u5377\u79ef\u200b\u6838\u200b\u7684\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff0c\u200b\u5e76\u200b\u4f18\u5316\u200b\u4e86\u200b\u70b9\u200b\u5377\u79ef\u200b\u3001Shortcut\u200b\u7b49\u200b\u3002\u200b\u5728\u200b\u4e0d\u200b\u4f7f\u7528\u200b\u989d\u5916\u200b\u6570\u636e\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0cPPLCNetV2_base \u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b ImageNet \u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u80fd\u591f\u200b\u53d6\u5f97\u200b\u8d85\u8fc7\u200b 77% \u200b\u7684\u200b Top1 Acc\uff0c\u200b\u540c\u65f6\u200b\u5728\u200b Intel CPU \u200b\u5e73\u53f0\u200b\u7684\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u5728\u200b 4.4 ms \u200b\u4ee5\u4e0b\u200b PP-LCNetV2_large \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.97 3.89762 13.0273 14.6 M ResNet18_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.3 3.53048 31.3014 41.5 M ResNet \u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200b 2015 \u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\uff0c\u200b\u4e00\u4e3e\u200b\u5728\u200b ILSVRC2015 \u200b\u6bd4\u8d5b\u200b\u4e2d\u200b\u53d6\u5f97\u200b\u51a0\u519b\u200b\uff0ctop5 \u200b\u9519\u8bef\u7387\u200b\u4e3a\u200b 3.57%\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u521b\u65b0\u6027\u200b\u7684\u200b\u63d0\u51fa\u200b\u4e86\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5806\u53e0\u200b\u591a\u4e2a\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\u4ece\u800c\u200b\u6784\u5efa\u200b\u4e86\u200b ResNet \u200b\u7f51\u7edc\u200b\u3002\u200b\u5b9e\u9a8c\u200b\u8868\u660e\u200b\u4f7f\u7528\u200b\u6b8b\u5dee\u200b\u5757\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u5730\u200b\u63d0\u5347\u200b\u6536\u655b\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u3002 ResNet18 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.4868 27.4601 41.5 M ResNet34_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.0 5.60675 56.0653 77.3 M ResNet34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 4.16902 51.925 77.3 M ResNet50_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.1885 68.446 90.8 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M ResNet101_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.2 20.0563 124.85 158.4 M ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.6 19.2297 121.006 158.4 M ResNet152_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.6 29.6439 181.678 214.3 M ResNet152\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.3 30.0461 177.707 214.2 M ResNet200_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.9 39.1628 235.185 266.0 M StarNet-S1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.6 9.895 23.0465 11.2 M StarNet \u200b\u805a\u7126\u200b\u4e8e\u200b\u7814\u7a76\u200b\u7f51\u7edc\u200b\u8bbe\u8ba1\u200b\u4e2d\u200b\u201c\u200b\u661f\u200b\u64cd\u4f5c\u200b\u201d\uff08\u200b\u5373\u200b\u5143\u7d20\u200b\u7ea7\u200b\u4e58\u6cd5\u200b\uff09\u200b\u7684\u200b\u672a\u200b\u5f00\u53d1\u200b\u6f5c\u529b\u200b\u3002\u200b\u63ed\u793a\u200b\u661f\u200b\u64cd\u4f5c\u200b\u80fd\u591f\u200b\u5c06\u200b\u8f93\u5165\u200b\u6620\u5c04\u200b\u5230\u200b\u9ad8\u7ef4\u200b\u3001\u200b\u975e\u7ebf\u6027\u200b\u7279\u5f81\u200b\u7a7a\u95f4\u200b\u7684\u200b\u80fd\u529b\u200b\uff0c\u200b\u8fd9\u4e00\u200b\u8fc7\u7a0b\u200b\u7c7b\u4f3c\u200b\u4e8e\u200b\u6838\u200b\u6280\u5de7\u200b\uff0c\u200b\u4f46\u200b\u65e0\u9700\u200b\u6269\u5927\u200b\u7f51\u7edc\u200b\u89c4\u6a21\u200b\u3002\u200b\u56e0\u6b64\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u51fa\u200b\u4e86\u200b StarNet\uff0c\u200b\u4e00\u4e2a\u200b\u7b80\u5355\u200b\u800c\u200b\u5f3a\u5927\u200b\u7684\u200b\u539f\u578b\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5728\u200b\u7d27\u51d1\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u548c\u200b\u6709\u9650\u200b\u7684\u200b\u8ba1\u7b97\u8d44\u6e90\u200b\u4e0b\u200b\uff0c\u200b\u5c55\u73b0\u51fa\u200b\u4e86\u200b\u5353\u8d8a\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u4f4e\u200b\u5ef6\u8fdf\u200b\u3002 StarNet-S2 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.8 7.91279 21.9571 14.3 M StarNet-S3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.0 10.7531 30.7656 22.2 M StarNet-S4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.37 16.9848 383.83 310.5 M SwinTransformer \u200b\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u89c6\u89c9\u200b Transformer \u200b\u7f51\u7edc\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u7528\u4f5c\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u901a\u7528\u200b\u9aa8\u5e72\u7f51\u200b\u8def\u200b\u3002SwinTransformer \u200b\u7531\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\uff08shifted windows\uff09\u200b\u8868\u793a\u200b\u7684\u200b\u5c42\u6b21\u200b Transformer \u200b\u7ed3\u6784\u200b\u7ec4\u6210\u200b\u3002\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\u5c06\u200b\u81ea\u200b\u6ce8\u610f\u200b\u8ba1\u7b97\u200b\u9650\u5236\u200b\u5728\u200b\u975e\u200b\u91cd\u53e0\u200b\u7684\u200b\u5c40\u90e8\u200b\u7a97\u53e3\u200b\u4e0a\u200b\uff0c\u200b\u540c\u65f6\u200b\u5141\u8bb8\u200b\u8de8\u200b\u7a97\u53e3\u200b\u8fde\u63a5\u200b\uff0c\u200b\u4ece\u800c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u7f51\u7edc\u200b\u6027\u80fd\u200b\u3002 SwinTransformer_base_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset\ntar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"dataset/label.txt\",\n    \"num_classes\": 102,\n    \"train_samples\": 1020,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/image_01904.jpg\",\n      \"check_dataset/demo_img/image_06940.jpg\"\n    ],\n    \"val_samples\": 1020,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/image_01937.jpg\",\n      \"check_dataset/demo_img/image_06958.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/cls_flowers_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 102\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1020\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1020\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0.yaml,\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c  paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b val.top1\u3001val.top5\uff1b

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_classification_001.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u7684\u200b\u4e00\u9879\u200b\u91cd\u8981\u200b\u4efb\u52a1\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u4e3b\u8981\u200b\u6307\u200b\u7684\u200b\u662f\u200b\u901a\u8fc7\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u65b9\u6cd5\u200b\u81ea\u52a8\u200b\u4ece\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u6709\u7528\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e8e\u200b\u540e\u7eed\u200b\u7684\u200b\u56fe\u50cf\u200b\u68c0\u7d22\u200b\u4efb\u52a1\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u540e\u7eed\u200b\u4efb\u52a1\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u5728\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4e2d\u200b\uff0c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u4e00\u7ec4\u200b\u7279\u5f81\u5411\u91cf\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u5411\u91cf\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u5730\u200b\u8868\u793a\u200b\u56fe\u50cf\u200b\u7684\u200b\u5185\u5bb9\u200b\u3001\u200b\u7ed3\u6784\u200b\u3001\u200b\u7eb9\u7406\u200b\u7b49\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u540e\u7eed\u200b\u7684\u200b\u68c0\u7d22\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b recall@1 (%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2\u200b\u662f\u200b\u4e00\u4e2a\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7531\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u7279\u5f81\u63d0\u53d6\u200b\u3001\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\u6784\u6210\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u662f\u200b\u5176\u4e2d\u200b\u7684\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u7cfb\u7edf\u200b\u7684\u200b\u60c5\u51b5\u200b\u9009\u62e9\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u578b\u200b\u3002 PP-ShiTuV2_rec_CLIP_vit_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.03 51.1284 1131.28 1.05 G

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-ShiTuV2_rec\")\noutput = model.predict(\"general_image_recognition_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX\u200b\u7684\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/Inshop_examples.tar -P ./dataset\ntar -xf ./dataset/Inshop_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/05_1_front.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/04_2_side.jpg\",\n      \"check_dataset/demo_img/12_1_front.jpg\",\n      \"check_dataset/demo_img/07_2_side.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/01_1_front.jpg\"\n    ],\n    \"gallery_samples\": 110,\n    \"gallery_sample_paths\": [\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/01_4_full.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/03_4_full.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\",\n      \"check_dataset/demo_img/03_2_side.jpg\"\n    ],\n    \"query_samples\": 125,\n    \"query_sample_paths\": [\n      \"check_dataset/demo_img/08_7_additional.jpg\",\n      \"check_dataset/demo_img/01_7_additional.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/09_7_additional.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/02_7_additional.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/Inshop_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ShiTuRecDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1000\uff1b
  • attributes.gallery_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 110\uff1b
  • attributes.query_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 125\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.gallery_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.query_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u56fe\u50cf\u200b\u6570\u91cf\u200b\u548c\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u652f\u6301\u200b LabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ShiTuRecDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u652f\u6301\u200b LabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ShiTuRecDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b LabelMe \uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200bLabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ShiTuRecDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c  paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b gallery_percent \u3001query_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b70%\u3001\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6570\u636e\u200b\u96c6\u5360\u200b\u6bd4\u200b20%\uff0c\u200b\u67e5\u8be2\u200b\u6570\u636e\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 70\n    gallery_percent: 20\n    query_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=70 \\\n    -o CheckDataset.split.gallery_percent=20 \\\n    -o CheckDataset.split.query_percent=10\n

\u2757\u200b\u6ce8\u610f\u200b \uff1a\u200b\u7531\u4e8e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7279\u6b8a\u6027\u200b\uff0c\u200b\u5f53\u4e14\u200b\u4ec5\u200b\u5f53\u200b train\u3001query\u3001gallery \u200b\u96c6\u5408\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\u4e0b\u200b\uff0c\u200b\u6570\u636e\u200b\u5207\u5206\u200b\u624d\u200b\u6709\u200b\u610f\u4e49\u200b\uff0c\u200b\u5728\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u200b\u7684\u200b\u8bc4\u4f30\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u5fc5\u987b\u200b\u6ee1\u8db3\u200b gallery \u200b\u96c6\u5408\u200b\u548c\u200b query \u200b\u96c6\u5408\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\uff0c\u200b\u5176\u200b\u5141\u8bb8\u200b\u548c\u200b train \u200b\u96c6\u5408\u200b\u4e0d\u200b\u5728\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\uff0c \u200b\u5982\u679c\u200b gallery \u200b\u96c6\u5408\u200b\u548c\u200b query \u200b\u96c6\u5408\u200b\u4e0e\u200b train \u200b\u96c6\u5408\u200b\u4e0d\u200b\u5728\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\uff0c\u200b\u5219\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u540e\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6ca1\u6709\u200b\u610f\u4e49\u200b\uff0c\u200b\u5efa\u8bae\u200b\u8c28\u614e\u200b\u64cd\u4f5c\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_rec.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir. \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200b Python \u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_recognition_001.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\". \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u2757 \u200b\u6ce8\u610f\u200b\uff1a\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u4e3a\u200b\u4e00\u7ec4\u200b\u5411\u91cf\u200b\uff0c\u200b\u9700\u8981\u200b\u914d\u5408\u200b\u68c0\u7d22\u200b\u6a21\u5757\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u7684\u200b\u8bc6\u522b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4ea7\u7ebf\u200b(comming soon)\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u4ef6\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5bf9\u200b\u8f93\u5165\u200b\u7684\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u591a\u200b\u6807\u7b7e\u200b\u7684\u200b\u5206\u7c7b\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u53ea\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u200b\u5230\u200b\u4e00\u4e2a\u200b\u7c7b\u522b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u9700\u8981\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u200b\u5230\u200b\u591a\u4e2a\u200b\u76f8\u5173\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u63a5\u6536\u200b\u56fe\u50cf\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u7136\u540e\u200b\u901a\u8fc7\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6216\u200b\u5176\u4ed6\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u6839\u636e\u200b\u56fe\u50cf\u200b\u7684\u200b\u7279\u6027\u200b\u548c\u200b\u5185\u5bb9\u200b\uff0c\u200b\u5c06\u200b\u5176\u200b\u5206\u7c7b\u200b\u5230\u200b\u591a\u4e2a\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u4e00\u5f20\u200b\u5305\u542b\u200b\u732b\u200b\u548c\u200b\u72d7\u200b\u7684\u200b\u56fe\u50cf\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u5c06\u200b\u5176\u200b\u540c\u65f6\u200b\u6807\u8bb0\u200b\u4e3a\u200b\u201c\u200b\u732b\u200b\u201d\u200b\u548c\u200b\u201c\u200b\u72d7\u200b\u201d\u3002\u200b\u8fd9\u4e9b\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u51fa\u200b\uff0c\u200b\u4f9b\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\u6216\u200b\u7cfb\u7edf\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b CLIP_vit_base_patch16_448_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.15 325.6 M CLIP_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bCLIP\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 PP-HGNetV2-B0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.98 39.6 M PP-HGNetV2_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-HGNetV2\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 PP-HGNetV2-B4_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.96 88.5 M PP-HGNetV2-B6_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.25 286.5 M PP-LCNet_x1_0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.96 29.4 M PP-LCNet_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 ResNet50_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.50 108.9 M ResNet50_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bResNet50\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_ML\")\noutput = model.predict(\"multilabel_classification_005.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mlcls_nus_examples.tar -P ./dataset\ntar -xf ./dataset/mlcls_nus_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/mlcls_nus_examples/label.txt\",\n    \"num_classes\": 33,\n    \"train_samples\": 17463,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0543_4338693.jpg\",\n      \"check_dataset/demo_img/0272_347806939.jpg\",\n      \"check_dataset/demo_img/0069_2291994812.jpg\",\n      \"check_dataset/demo_img/0012_1222850604.jpg\",\n      \"check_dataset/demo_img/0238_53773041.jpg\",\n      \"check_dataset/demo_img/0373_541261977.jpg\",\n      \"check_dataset/demo_img/0567_519506868.jpg\",\n      \"check_dataset/demo_img/0023_289621557.jpg\",\n      \"check_dataset/demo_img/0581_484524659.jpg\",\n      \"check_dataset/demo_img/0325_120753036.jpg\"\n    ],\n    \"val_samples\": 17463,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0546_130758157.jpg\",\n      \"check_dataset/demo_img/0284_2230710138.jpg\",\n      \"check_dataset/demo_img/0090_1491261559.jpg\",\n      \"check_dataset/demo_img/0013_392798436.jpg\",\n      \"check_dataset/demo_img/0246_2248376356.jpg\",\n      \"check_dataset/demo_img/0377_1349296474.jpg\",\n      \"check_dataset/demo_img/0570_2457645006.jpg\",\n      \"check_dataset/demo_img/0027_309333946.jpg\",\n      \"check_dataset/demo_img/0584_132639537.jpg\",\n      \"check_dataset/demo_img/0329_206031527.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/mlcls_nus_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 33\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 17463\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 17463\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u652f\u6301\u200b COCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b MLClsDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u652f\u6301\u200b COCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b MLClsDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b COCO \uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200bCOCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b MLClsDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: COCO\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b 90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b 10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b PP-LCNet_x1_0_ML \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_ML.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_ML.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b MultiLabelMAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"multilabel_classification_005.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_ML.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html","title":"\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u786e\u5b9a\u200b\u5e76\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u7279\u5b9a\u200b\u5bf9\u8c61\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6bcf\u4e2a\u200b\u76ee\u6807\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u7684\u200b\u63a9\u6a21\u200b\uff08masks\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u63a9\u6a21\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5bf9\u8c61\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b15\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Cascade-MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.3 - - 254.8 M Cascade-MaskRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bMask RCNN\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ea7\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIOU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u68c0\u6d4b\u200b\u4e0e\u200b\u63a8\u7406\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 - - 254.7 M Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 36.8329 - 66.6 M Mask-RT-DETR-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.0 33.5007 - 51.8 M Mask-RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.6 - - 157.5 M Mask R-CNN\u200b\u662f\u200b\u7531\u200b\u534e\u76db\u987f\u200b\u9996\u4f8b\u200b\u5373\u73b0\u200b\u6295\u5f71\u200b\u5361\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5168\u200b\u4efb\u52a1\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u6a21\u578b\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u56fe\u7247\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9a\u4f4d\u200b\uff0c\u200b\u5e76\u200b\u7ed3\u5408\u200b\u56fe\u50cf\u200b\u7ea7\u200b\u7684\u200b\u906e\u7f69\u200b\uff08Mask\uff09\u200b\u6765\u200b\u5b8c\u6210\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u3002 MaskRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.4 - - 157.5 M MaskRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.8 - - 128.7 M MaskRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 370.0 M PP-YOLOE_seg-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.5 - - 31.5 M PP-YOLOE_seg \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u6cbf\u7528\u200b\u4e86\u200bPP-YOLOE\u200b\u7684\u200bbackbone\u200b\u548c\u200bhead\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bPP-YOLOE\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u5934\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SOLOv2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.5 - - 179.1 M SOLOv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u6309\u200b\u4f4d\u7f6e\u200b\u5206\u5272\u200b\u7269\u4f53\u200b\u7684\u200b\u5b9e\u65f6\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7b97\u6cd5\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u662f\u200bSOLO\u200b\u7684\u200b\u6539\u8fdb\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u63a9\u7801\u200b\u5b66\u4e60\u200b\u548c\u200b\u63a9\u7801\u200bNMS\uff0c\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u901f\u5ea6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u826f\u597d\u200b\u5e73\u8861\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"Mask-RT-DETR-L\")\noutput = model.predict(\"general_instance_segmentation_004.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u5206\u5272\u200b \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_coco_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 2,\n    \"train_samples\": 79,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/pexels-photo-634007.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-59576.png\"\n    ],\n    \"val_samples\": 19,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/peasant-farmer-farmer-romania-botiza-47862.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-715546.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/instance_seg_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 2\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 79\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 19\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u652f\u6301\u200bLabelMe\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bCOCO\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200bLabelMe\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200bLabelMe\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b Mask-RT-DETR-L \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b Mask-RT-DETR-L.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b Mask-RT-DETR-L.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_instance_segmentation_004.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b Mask-RT-DETR-L.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b \u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u4e00\u9879\u200b\u57fa\u672c\u200b\u4efb\u52a1\u200b\uff0c\u200b\u65e8\u5728\u200b\u4ece\u200b\u56fe\u50cf\u200b\u3001\u200b\u89c6\u9891\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u5e76\u200b\u63d0\u53d6\u200b\u51fa\u200b\u7279\u5b9a\u200b\u7684\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u3001\u200b\u4eba\u200b\u3001\u200b\u5b9e\u4f53\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5927\u5c0f\u200b\u3002\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u901a\u8fc7\u200b\u6784\u5efa\u200b\u6df1\u5ea6\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b66\u4e60\u200b\u56fe\u50cf\u200b\u4e3b\u4f53\u200b\u7684\u200b\u7279\u5f81\u200b\u8868\u793a\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u51c6\u786e\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.5 62.0 33.7 537.0 27.54 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6a21\u578b\u200b\u53ef\u80fd\u200b\u4f1a\u200b\u540c\u65f6\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u591a\u4e2a\u200b\u5e38\u89c1\u200b\u4e3b\u4f53\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-ShiTuV2_det\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mainbody_det_examples.tar -P ./dataset\ntar -xf ./dataset/mainbody_det_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mainbody_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 701\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 176\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-ShiTuV2_det\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_det.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_det.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\uff08comming soon\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u7279\u5b9a\u200b\u76ee\u6807\u200b\u7684\u200b\u533a\u57df\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u76ee\u6807\u200b\u533a\u57df\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u76ee\u6807\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b6\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b37\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b Cascade-FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.1 - - 245.4 M Cascade-FasterRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bFaster R-CNN\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8026\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIoU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u8bad\u7ec3\u200b\u548c\u200b\u9884\u6d4b\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.0 - - 246.2 M CenterNet-DLA-34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.6 - - 75.4 M CenterNet\u200b\u662f\u200b\u4e00\u79cd\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u628a\u200b\u5f85\u200b\u68c0\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u5173\u952e\u70b9\u200b\u89c6\u4e3a\u200b\u5355\u200b\u4e00\u70b9\u200b-\u200b\u5373\u200b\u5176\u200b\u8fb9\u754c\u200b\u6846\u200b\u7684\u200b\u4e2d\u5fc3\u70b9\u200b\uff0c\u200b\u5e76\u200b\u901a\u8fc7\u200b\u5173\u952e\u70b9\u200b\u8fdb\u884c\u200b\u56de\u5f52\u200b\u3002 CenterNet-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.9 - - 319.7 M DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.3 59.2132 5334.52 159.3 M DETR \u200b\u662f\u200bFacebook\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200btransformer\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200b\u4e0d\u200b\u9700\u8981\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u5148\u9a8c\u200b\u6846\u200banchor\u200b\u548c\u200bNMS\u200b\u7684\u200b\u540e\u5904\u7406\u200b\u7b56\u7565\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002 FasterRCNN-ResNet34-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.8 - - 137.5 M Faster R-CNN\u200b\u662f\u200b\u5178\u578b\u200b\u7684\u200btwo-stage\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5373\u200b\u5148\u751f\u200b\u6210\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff08Region Proposal\uff09\uff0c\u200b\u7136\u540e\u200b\u5728\u200b\u751f\u6210\u200b\u7684\u200bRegion Proposal\u200b\u4e0a\u200b\u505a\u200b\u5206\u7c7b\u200b\u548c\u200b\u56de\u5f52\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200b\u524d\u4ee3\u200bR-CNN\u200b\u548c\u200bFast R-CNN\uff0cFaster R-CNN\u200b\u7684\u200b\u6539\u8fdb\u200b\u4e3b\u8981\u200b\u5728\u4e8e\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u65b9\u9762\u200b\uff0c\u200b\u4f7f\u7528\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7f51\u7edc\u200b\uff08Region Proposal Network, RPN\uff09\u200b\u63d0\u4f9b\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff0c\u200b\u4ee5\u200b\u53d6\u4ee3\u200b\u4f20\u7edf\u200b\u9009\u62e9\u6027\u200b\u641c\u7d22\u200b\u3002RPN\u200b\u662f\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5e76\u200b\u4e0e\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u5171\u4eab\u200b\u56fe\u50cf\u200b\u7684\u200b\u5377\u79ef\u200b\u7279\u5f81\u200b\uff0c\u200b\u51cf\u5c11\u200b\u4e86\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7684\u200b\u8ba1\u7b97\u200b\u5f00\u9500\u200b\u3002 FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 148.1 M FasterRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.7 - - 120.2 M FasterRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 216.3 M FasterRCNN-ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 - - 159.8 M FCOS-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.6 103.367 3424.91 124.2 M FCOS\u200b\u662f\u200b\u4e00\u79cd\u200b\u5bc6\u96c6\u200b\u9884\u6d4b\u200b\u7684\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u4f7f\u7528\u200bRetinaNet\u200b\u7684\u200b\u9aa8\u67b6\u200b\uff0c\u200b\u76f4\u63a5\u200b\u5728\u200bfeature map\u200b\u4e0a\u200b\u56de\u5f52\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u957f\u5bbd\u200b\uff0c\u200b\u5e76\u200b\u9884\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u7c7b\u522b\u200b\u4ee5\u53ca\u200bcenterness\uff08feature map\u200b\u4e0a\u200b\u50cf\u7d20\u70b9\u200b\u79bb\u200b\u7269\u4f53\u200b\u4e2d\u5fc3\u200b\u7684\u200b\u504f\u79fb\u200b\u7a0b\u5ea6\u200b\uff09\uff0ccenterness\u200b\u6700\u7ec8\u200b\u4f1a\u200b\u4f5c\u4e3a\u200b\u6743\u91cd\u200b\u6765\u200b\u8c03\u6574\u200b\u7269\u4f53\u200b\u5f97\u5206\u200b\u3002 PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.5 16.2311 71.7257 16.8 M PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PicoDet-XS\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.7 57.8995 1439.93 349.4 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M RT-DETR-R18\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.5 19.89 784.824 70.7 M RT-DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.1 41.9327 1625.95 149.1 M RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 40.1055 883.041 219.7 M YOLOv3\u200b\u662f\u200b\u4e00\u79cd\u200b\u5b9e\u65f6\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u5b83\u200b\u4f7f\u7528\u200b\u4e00\u4e2a\u200b\u72ec\u7279\u200b\u7684\u200b\u5355\u4e2a\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c06\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u95ee\u9898\u200b\u5206\u89e3\u200b\u4e3a\u200b\u4e00\u4e2a\u200b\u56de\u5f52\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5b9e\u65f6\u200b\u7684\u200b\u68c0\u6d4b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u91c7\u7528\u200b\u4e86\u200b\u591a\u4e2a\u200b\u5c3a\u5ea6\u200b\u7684\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5c3a\u5ea6\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOv3-MobileNetV3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.6 31.6276 856.047 163.0 M YOLOX-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.1 185.691 1250.58 192.5 M YOLOX\u200b\u6a21\u578b\u200b\u4ee5\u200bYOLOv3\u200b\u4f5c\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u200b\u7684\u200b\u6846\u67b6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bDecoupled Head\u3001Data Aug\u3001Anchor Free\u200b\u4ee5\u53ca\u200bSimOTA\u200b\u7ec4\u4ef6\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u5404\u79cd\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOX-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.9 123.324 688.071 90.0 M YOLOX-N\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.1 79.1665 155.59 3.4 M YOLOX-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.4 184.828 474.446 32.0 M YOLOX-T\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.9 102.748 212.52 18.1 M YOLOX-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.8 227.361 2067.84 351.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PicoDet-S\")\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\",\n      \"check_dataset/demo_img/road237.png\",\n      \"check_dataset/demo_img/road733.png\",\n      \"check_dataset/demo_img/road861.png\",\n      \"check_dataset/demo_img/road762.png\",\n      \"check_dataset/demo_img/road515.png\",\n      \"check_dataset/demo_img/road754.png\",\n      \"check_dataset/demo_img/road173.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\",\n      \"check_dataset/demo_img/road544.png\",\n      \"check_dataset/demo_img/road596.png\",\n      \"check_dataset/demo_img/road857.png\",\n      \"check_dataset/demo_img/road203.png\",\n      \"check_dataset/demo_img/road589.png\",\n      \"check_dataset/demo_img/road655.png\",\n      \"check_dataset/demo_img/road245.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 704\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 176\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b VOC\u3001LabelMe \u200b\u548c\u200b VOCWithUnlabeled\u3001LabelMeWithUnlabeled \uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u8f6c\u6362\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u4ee5\u200b\u4e0b\u9762\u200b\u7684\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples\n

\u200b\u5f53\u7136\u200b\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ee5\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PicoDet-S \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-S.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-S.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-S.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html","title":"\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u884c\u200b\u4eba\u200b\u7684\u200b\u7279\u5b9a\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5982\u200b\u6027\u522b\u200b\u3001\u200b\u5e74\u9f84\u200b\u3001\u200b\u8863\u7269\u200b\u989c\u8272\u200b\u548c\u200b\u7c7b\u578b\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6bcf\u4e2a\u200b\u884c\u4eba\u200b\u7684\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u4fe1\u606f\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\uff08\u200b\u5982\u200b\u884c\u4eba\u200b\u8ddf\u8e2a\u200b\u3001\u200b\u884c\u4eba\u200b\u91cd\u200b\u8bc6\u522b\u200b\u7b49\u200b\uff09\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_pedestrian_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b26\u200b\u4e2a\u200b\u7c7b\u522b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b mA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_pedestrian_attribute\")\noutput = model.predict(\"pedestrian_attribute_006.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

\u200b\u5907\u6ce8\u200b\uff1a\u200b\u5176\u4e2d\u200b output \u200b\u7684\u200b\u503c\u200b\u7d22\u5f15\u200b\u4e3a\u200b0\u200b\u8868\u793a\u200b\u662f\u5426\u200b\u4f69\u6234\u200b\u5e3d\u5b50\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u4e3a\u200b1\u200b\u8868\u793a\u200b\u662f\u5426\u200b\u4f69\u6234\u200b\u773c\u955c\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b2-7\u200b\u8868\u793a\u200b\u4e0a\u8863\u200b\u98ce\u683c\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b8-13\u200b\u8868\u793a\u200b\u4e0b\u88c5\u200b\u98ce\u683c\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b14\u200b\u8868\u793a\u200b\u662f\u5426\u200b\u7a7f\u200b\u9774\u5b50\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b15-17\u200b\u8868\u793a\u200b\u80cc\u200b\u7684\u200b\u5305\u200b\u7684\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b18\u200b\u8868\u793a\u200b\u6b63\u9762\u200b\u662f\u5426\u200b\u6301\u7269\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b19-21\u200b\u8868\u793a\u200b\u5e74\u9f84\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b22\u200b\u8868\u793a\u200b\u6027\u522b\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b23-25\u200b\u8868\u793a\u200b\u671d\u5411\u200b\u3002\u200b\u5177\u4f53\u200b\u5730\u200b\uff0c\u200b\u5c5e\u6027\u200b\u5305\u542b\u200b\u4ee5\u4e0b\u200b\u7c7b\u578b\u200b\uff1a

- \u200b\u6027\u522b\u200b\uff1a\u200b\u7537\u200b\u3001\u200b\u5973\u200b\n- \u200b\u5e74\u9f84\u200b\uff1a\u200b\u5c0f\u4e8e\u200b18\u300118-60\u3001\u200b\u5927\u4e8e\u200b60\n- \u200b\u671d\u5411\u200b\uff1a\u200b\u671d\u524d\u200b\u3001\u200b\u671d\u540e\u200b\u3001\u200b\u4fa7\u9762\u200b\n- \u200b\u914d\u9970\u200b\uff1a\u200b\u773c\u955c\u200b\u3001\u200b\u5e3d\u5b50\u200b\u3001\u200b\u65e0\u200b\n- \u200b\u6b63\u9762\u200b\u6301\u7269\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u5305\u200b\uff1a\u200b\u53cc\u80a9\u5305\u200b\u3001\u200b\u5355\u80a9\u200b\u5305\u200b\u3001\u200b\u624b\u63d0\u5305\u200b\n- \u200b\u4e0a\u8863\u200b\u98ce\u683c\u200b\uff1a\u200b\u5e26\u200b\u6761\u7eb9\u200b\u3001\u200b\u5e26\u200blogo\u3001\u200b\u5e26\u200b\u683c\u5b50\u200b\u3001\u200b\u62fc\u63a5\u200b\u98ce\u683c\u200b\n- \u200b\u4e0b\u88c5\u200b\u98ce\u683c\u200b\uff1a\u200b\u5e26\u200b\u6761\u7eb9\u200b\u3001\u200b\u5e26\u200b\u56fe\u6848\u200b\n- \u200b\u77ed\u8896\u200b\u4e0a\u8863\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u957f\u8896\u200b\u4e0a\u8863\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u957f\u200b\u5916\u5957\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u957f\u88e4\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u77ed\u88e4\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u77ed\u88d9\u200b&\u200b\u88d9\u5b50\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u7a7f\u9774\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/pedestrian_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/pedestrian_attribute_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/pedestrian_attribute_examples/label.txt\",\n    \"num_classes\": 26,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/020907.jpg\",\n      \"check_dataset/demo_img/004274.jpg\",\n      \"check_dataset/demo_img/009412.jpg\",\n      \"check_dataset/demo_img/026873.jpg\",\n      \"check_dataset/demo_img/030560.jpg\",\n      \"check_dataset/demo_img/022846.jpg\",\n      \"check_dataset/demo_img/009055.jpg\",\n      \"check_dataset/demo_img/015399.jpg\",\n      \"check_dataset/demo_img/006435.jpg\",\n      \"check_dataset/demo_img/055307.jpg\"\n    ],\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/080381.jpg\",\n      \"check_dataset/demo_img/080469.jpg\",\n      \"check_dataset/demo_img/080146.jpg\",\n      \"check_dataset/demo_img/080003.jpg\",\n      \"check_dataset/demo_img/080283.jpg\",\n      \"check_dataset/demo_img/080104.jpg\",\n      \"check_dataset/demo_img/080149.jpg\",\n      \"check_dataset/demo_img/080313.jpg\",\n      \"check_dataset/demo_img/080131.jpg\",\n      \"check_dataset/demo_img/080412.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/pedestrian_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 26\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u56fe\u7247\u200b\u7684\u200b\u957f\u5bbd\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-LCNet\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08PP-LCNet_x1_0_pedestrian_attribute\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_pedestrian_attribute.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_pedestrian_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b MultiLabelMAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"pedestrian_attribute_006.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_pedestrian_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u7684\u200b\u4e00\u79cd\u200b\u6280\u672f\u200b\uff0c\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5212\u5206\u200b\u4e3a\u200b\u4e0d\u540c\u200b\u7684\u200b\u8bed\u4e49\u200b\u533a\u57df\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u533a\u57df\u200b\u5bf9\u5e94\u200b\u4e00\u4e2a\u200b\u5177\u4f53\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u8fd9\u79cd\u200b\u6280\u672f\u200b\u80fd\u591f\u200b\u751f\u6210\u200b\u7cbe\u7ec6\u200b\u7684\u200b\u5206\u5272\u200b\u56fe\u200b\uff0c\u200b\u6e05\u6670\u200b\u5730\u200b\u5c55\u73b0\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u8c61\u200b\u53ca\u5176\u200b\u8fb9\u754c\u200b\uff0c\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u6709\u529b\u200b\u652f\u6301\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b18\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

\u200b\u4ee5\u4e0a\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

SeaFormer\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bADE20k\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LiteSeg-T\")\noutput = model.predict(\"general_semantic_segmentation_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset\ntar -xf ./dataset/seg_optic_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/P0005.jpg\",\n      \"check_dataset/demo_img/P0050.jpg\"\n    ],\n    \"train_samples\": 267,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/N0139.jpg\",\n      \"check_dataset/demo_img/P0137.jpg\"\n    ],\n    \"val_samples\": 76,\n    \"num_classes\": 2\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/seg_optic_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 2\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 267\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 76\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09","text":"\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u652f\u6301\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u8981\u6c42\u200b\u7684\u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u652f\u6301\u200b\u7684\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u662f\u200bLabelMe\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u8f6c\u6362\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e00\u4e2a\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5982\u4e0b\u200b\uff1a
wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n

\u200b\u4e0b\u8f7d\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u4fee\u6539\u200b paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert\n

\u200b\u5f53\u7136\u200b\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ee5\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200bPP-LiteSeg-T\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b PP-LiteSeg-T.yam\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LiteSeg-T.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Top1 Acc

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model\" \\\n    -o Predict.input=\"general_semantic_segmentation_002.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LiteSeg-T.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u901a\u5e38\u200b\u6307\u200b\u7684\u200b\u662f\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u7cbe\u786e\u200b\u5730\u200b\u68c0\u6d4b\u200b\u548c\u200b\u5b9a\u4f4d\u200b\u5c3a\u5bf8\u200b\u8f83\u200b\u5c0f\u200b\u3001\u200b\u9762\u79ef\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u76ee\u6807\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u50cf\u7d20\u200b\u5c3a\u5bf8\u200b\u901a\u5e38\u200b\u8f83\u200b\u5c0f\u200b\uff0c\u200b\u53ef\u80fd\u200b\u5c0f\u4e8e\u200b32\u200b\u50cf\u7d20\u200b\u00d732\u200b\u50cf\u7d20\u200b\uff08\u200b\u6839\u636e\u200bMS COCO\u200b\u7b49\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u5b9a\u4e49\u200b\uff09\uff0c\u200b\u4e14\u200b\u53ef\u80fd\u200b\u88ab\u200b\u80cc\u666f\u200b\u6216\u200b\u5176\u4ed6\u200b\u7269\u4f53\u200b\u6240\u200b\u63a9\u76d6\u200b\uff0c\u200b\u96be\u4ee5\u200b\u88ab\u200b\u8089\u773c\u200b\u76f4\u63a5\u200b\u89c2\u5bdf\u51fa\u6765\u200b\u3002\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u4e2d\u200b\u7684\u200b\u4e00\u4e2a\u200b\u91cd\u8981\u200b\u7814\u7a76\u200b\u65b9\u5411\u200b\uff0c\u200b\u65e8\u5728\u200b\u7cbe\u51c6\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u53ef\u89c6\u5316\u200b\u7279\u5f81\u200b\u6781\u5c11\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE_plus_SOD-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.9 52.1 57.1 1007.0 324.93 \u200b\u57fa\u4e8e\u200bVisDrone\u200b\u8bad\u7ec3\u200b\u7684\u200bPP-YOLOE_plus\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002VisDrone\u200b\u662f\u200b\u9488\u5bf9\u200b\u65e0\u4eba\u673a\u200b\u89c6\u89c9\u200b\u6570\u636e\u200b\u7684\u200b\u57fa\u51c6\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7531\u4e8e\u200b\u76ee\u6807\u200b\u8f83\u200b\u5c0f\u200b\u540c\u65f6\u200b\u5177\u6709\u200b\u4e00\u5b9a\u200b\u7684\u200b\u6311\u6218\u6027\u200b\u800c\u200b\u88ab\u200b\u7528\u4e8e\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u6d4b\u200b PP-YOLOE_plus_SOD-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 25.1 42.8 65.5 324.4 77.29 PP-YOLOE_plus_SOD-largesize-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 65.9 458.5 11172.7 340.42

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE_plus_SOD-S\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"small_object_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bDetection\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/small_det_examples.tar -P ./dataset\ntar -xf ./dataset/small_det_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 1610,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/9999938_00000_d_0000352.jpg\",\n      \"check_dataset/demo_img/9999941_00000_d_0000014.jpg\",\n      \"check_dataset/demo_img/9999973_00000_d_0000043.jpg\"\n    ],\n    \"val_samples\": 548,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0000330_00801_d_0000804.jpg\",\n      \"check_dataset/demo_img/0000103_00180_d_0000026.jpg\",\n      \"check_dataset/demo_img/0000291_04001_d_0000888.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/small_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 10\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1610\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 548\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b VOC\u3001LabelMe \u200b\u548c\u200b VOCWithUnlabeled\u3001LabelMeWithUnlabeled \uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u8f6c\u6362\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u4ee5\u200b\u4e0b\u9762\u200b\u7684\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset\n

\u200b\u5f53\u7136\u200b\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ee5\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-YOLOE_plus_SOD-S\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o Train.num_classes=10\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE_plus_SOD-S.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE_plus_SOD-S.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"small_object_detection.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE_plus_SOD-S.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html","title":"\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u5176\u200b\u4e3b\u8981\u200b\u4efb\u52a1\u200b\u662f\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u6807\u8bb0\u200b\u51fa\u200b\u8f66\u8f86\u200b\u7684\u200b\u7279\u5b9a\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5982\u200b\u8f66\u8f86\u200b\u7c7b\u578b\u200b\u3001\u200b\u989c\u8272\u200b\u3001\u200b\u8f66\u724c\u53f7\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u5305\u542b\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\uff08\u200b\u5982\u200b\u8f66\u8f86\u200b\u8ddf\u8e2a\u200b\u3001\u200b\u8f66\u8f86\u200b\u91cd\u200b\u8bc6\u522b\u200b\u7b49\u200b\uff09\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_vehicle_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VeRi \u200b\u6570\u636e\u200b\u96c6\u200bmA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_vehicle_attribute\")\noutput = model.predict(\"vehicle_attribute_007.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

\u200b\u5907\u6ce8\u200b\uff1a\u200b\u5176\u4e2d\u200b output \u200b\u7684\u200b\u503c\u200b\u7d22\u5f15\u200b\u4e3a\u200b0-9\u200b\u8868\u793a\u200b\u989c\u8272\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u989c\u8272\u200b\u5206\u522b\u200b\u662f\u200b\uff1ayellow(\u200b\u9ec4\u8272\u200b), orange(\u200b\u6a59\u8272\u200b), green(\u200b\u7eff\u8272\u200b), gray(\u200b\u7070\u8272\u200b), red(\u200b\u7ea2\u8272\u200b), blue(\u200b\u84dd\u8272\u200b), white(\u200b\u767d\u8272\u200b), golden(\u200b\u91d1\u8272\u200b), brown(\u200b\u68d5\u8272\u200b), black(\u200b\u9ed1\u8272\u200b)\uff1b\u200b\u7d22\u5f15\u200b\u4e3a\u200b10-18\u200b\u8868\u793a\u200b\u8f66\u578b\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u8f66\u578b\u200b\u5206\u522b\u200b\u662f\u200bsedan(\u200b\u8f7f\u8f66\u200b), suv(\u200b\u8d8a\u91ce\u8f66\u200b), van(\u200b\u9762\u5305\u8f66\u200b), hatchback(\u200b\u6380\u200b\u80cc\u8f66\u200b), mpv(\u200b\u591a\u7528\u9014\u200b\u6c7d\u8f66\u200b), pickup(\u200b\u76ae\u5361\u8f66\u200b), bus(\u200b\u516c\u5171\u6c7d\u8f66\u200b), truck(\u200b\u5361\u8f66\u200b), estate(\u200b\u65c5\u884c\u8f66\u200b)\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u5206\u7c7b\u200b \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_attribute_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/vehicle_attribute_examples/label.txt\",\n    \"num_classes\": 19,\n    \"train_samples\": 1200,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0018_c017_00033140_0.jpg\",\n      \"check_dataset/demo_img/0010_c019_00034275_0.jpg\",\n      \"check_dataset/demo_img/0015_c019_00068660_0.jpg\",\n      \"check_dataset/demo_img/0016_c017_00049590_1.jpg\",\n      \"check_dataset/demo_img/0018_c016_00052280_0.jpg\",\n      \"check_dataset/demo_img/0023_c001_00006995_0.jpg\",\n      \"check_dataset/demo_img/0022_c004_00065910_0.jpg\",\n      \"check_dataset/demo_img/0007_c019_00048655_1.jpg\",\n      \"check_dataset/demo_img/0022_c007_00072970_0.jpg\",\n      \"check_dataset/demo_img/0022_c008_00065785_0.jpg\"\n    ],\n    \"val_samples\": 300,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0025_c003_00054095_0.jpg\",\n      \"check_dataset/demo_img/0023_c013_00006350_1.jpg\",\n      \"check_dataset/demo_img/0024_c003_00046320_0.jpg\",\n      \"check_dataset/demo_img/0025_c005_00054795_2.jpg\",\n      \"check_dataset/demo_img/0024_c012_00041770_0.jpg\",\n      \"check_dataset/demo_img/0024_c007_00060845_1.jpg\",\n      \"check_dataset/demo_img/0023_c017_00013150_0.jpg\",\n      \"check_dataset/demo_img/0024_c014_00040410_0.jpg\",\n      \"check_dataset/demo_img/0025_c002_00050685_1.jpg\",\n      \"check_dataset/demo_img/0025_c005_00032645_0.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/vehicle_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 19\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1200\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 300\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u56fe\u7247\u200b\u7684\u200b\u957f\u5bbd\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b PP-LCNet \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08PP-LCNet_x1_0_vehicle_attribute\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_vehicle_attribute.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_vehicle_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b MultiLabelMAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_attribute_007.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_vehicle_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442_1","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5b50\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5177\u4f53\u200b\u6307\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\u6765\u200b\u5224\u65ad\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u662f\u5426\u200b\u5b58\u5728\u200b\u8f66\u8f86\u200b\uff0c\u200b\u5e76\u200b\u7ed9\u51fa\u200b\u6bcf\u4e2a\u200b\u8f66\u8f86\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\uff08\u200b\u5982\u200b\u8fb9\u754c\u200b\u6846\u200b\u7684\u200b\u5750\u6807\u200b\uff09\u3002\u200b\u8fd9\u4e9b\u200b\u4fe1\u606f\u200b\u5bf9\u4e8e\u200b\u667a\u80fd\u200b\u4ea4\u901a\u7cfb\u7edf\u200b\u3001\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u7b49\u200b\u591a\u4e2a\u200b\u9886\u57df\u200b\u5177\u6709\u200b\u91cd\u8981\u200b\u610f\u4e49\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP 0.5:0.95 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-S_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 61.3 15.4 178.4 28.79 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-L_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.9 32.6 775.6 196.02

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bPPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_vehicle\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"vehicle_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_coco_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20011__img00001.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00005.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00009.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20032__img00401.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00405.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00409.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/vehicle_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b4\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-YOLOE-S_vehicle\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_vehicle.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_vehicle.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_detection.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_vehicle.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html","title":"\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e3b\u8981\u200b\u662f\u200b\u5c06\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u7684\u200b\u65b9\u5411\u200b\u533a\u5206\u200b\u51fa\u6765\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u540e\u5904\u7406\u200b\u5c06\u200b\u5176\u200b\u77eb\u6b63\u200b\u3002\u200b\u5728\u200b\u8bf8\u5982\u200b\u6587\u6863\u200b\u626b\u63cf\u200b\u3001\u200b\u8bc1\u7167\u200b\u62cd\u6444\u200b\u7b49\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u6709\u65f6\u200b\u4e3a\u4e86\u200b\u62cd\u6444\u200b\u66f4\u200b\u6e05\u6670\u200b\uff0c\u200b\u4f1a\u200b\u5c06\u200b\u62cd\u6444\u200b\u8bbe\u5907\u200b\u8fdb\u884c\u200b\u65cb\u8f6c\u200b\uff0c\u200b\u5bfc\u81f4\u200b\u5f97\u5230\u200b\u7684\u200b\u56fe\u7247\u200b\u4e5f\u200b\u662f\u200b\u4e0d\u540c\u200b\u65b9\u5411\u200b\u7684\u200b\u3002\u200b\u6b64\u65f6\u200b\uff0c\u200b\u6807\u51c6\u200b\u7684\u200bOCR\u200b\u6d41\u7a0b\u200b\u65e0\u6cd5\u200b\u5f88\u200b\u597d\u200b\u5730\u200b\u5e94\u5bf9\u200b\u8fd9\u4e9b\u200b\u6570\u636e\u200b\u3002\u200b\u5229\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6280\u672f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9884\u5148\u5224\u65ad\u200b\u542b\u200b\u6587\u5b57\u200b\u533a\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u6216\u200b\u8bc1\u4ef6\u200b\u7684\u200b\u65b9\u5411\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5176\u200b\u8fdb\u884c\u200b\u65b9\u5411\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ece\u800c\u200b\u63d0\u9ad8\u200bOCR\u200b\u5904\u7406\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200bModel Download Link Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 \u200b\u57fa\u4e8e\u200bPP-LCNet_x1_0\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u542b\u6709\u200b\u56db\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5373\u200b0\u200b\u5ea6\u200b\uff0c90\u200b\u5ea6\u200b\uff0c180\u200b\u5ea6\u200b\uff0c270\u200b\u5ea6\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8bc1\u4ef6\u200b\u548c\u200b\u6587\u6863\u200b\u7b49\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5305\u542b\u200b 1000 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_doc_ori\")\noutput = model.predict(\"img_rot180_demo.jpg\",  batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/demo.png\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/text_image_orientation.tar -P ./dataset\ntar -xf ./dataset/text_image_orientation.tar  -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"..\\/..\\/text_image_orientation\\/label.txt\",\n    \"num_classes\": 4,\n    \"train_samples\": 1553,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_10351.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_3908.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_7712.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_7480.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot270_9599.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_10323.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4885.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_3939.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7153.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1747.jpg\"\n    ],\n    \"val_samples\": 2593,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_3190.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_10272.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_9930.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_918.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_2079.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_8574.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7595.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_1751.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1573.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4401.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/text_image_orientation\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1552\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2593\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff08PP-LCNet_x1_0_doc_ori\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_doc_ori.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_doc_ori.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Top1 Acc\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"img_rot180_demo.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_doc_ori.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=``\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html","title":"\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6570\u5b66\u516c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u6587\u672c\u200b\u6216\u200b\u8ba1\u7b97\u673a\u200b\u53ef\u200b\u8bc6\u522b\u200b\u7684\u200b\u683c\u5f0f\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6570\u5b66\u516c\u5f0f\u200b\u7684\u200b LaTeX \u200b\u6216\u200b MathML \u200b\u4ee3\u7801\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u4ee3\u7801\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u6587\u672c\u200b\u7406\u89e3\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b normed edit distance BLEU score ExpRate \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b LaTeX_OCR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.8821 0.0823 40.01 89.7 M LaTeX-OCR\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u81ea\u200b\u56de\u5f52\u200b\u5927\u200b\u6a21\u578b\u200b\u7684\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b Hybrid ViT \u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0ctransformer\u200b\u4f5c\u4e3a\u200b\u89e3\u7801\u5668\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7684\u200b\u51c6\u786e\u6027\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"LaTeX_OCR_rec\")\noutput = model.predict(\"general_formula_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b PaddleOCR \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bLaTeX-OCR \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u9879\u76ee\u200b

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_latexocr_dataset_example.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_latexocr_dataset_example.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 9452,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0109284.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0217434.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0166758.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0022294.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0071799.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0017043.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0026204.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0209202.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0157332.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0232582.png\"\n    ],\n    \"val_samples\": 1050,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0070221.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0157901.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0085392.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0196480.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0096180.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0136149.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0143310.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0004560.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0115191.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0015323.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_latexocr_dataset_example\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"LaTeXOCRDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 9452\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1050\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u652f\u6301\u200b MSTextRecDataset\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b LaTeXOCRDataset\u200b\u683c\u5f0f\u200b(PKL\u200b\u683c\u5f0f\u200b)\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u652f\u6301\u200b MSTextRecDataset\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b LaTeXOCRDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b True;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b MSTextRecDataset\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b MSTextRecDataset\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b LaTeXOCRDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: MSTextRecDataset\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=MSTextRecDataset\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b LaTeX_OCR_rec \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bLaTeX_OCR_rec.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bLaTeX_OCR_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b exp_rate \uff1b

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_formula_rec_001.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bLaTeX_OCR_rec.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html","title":"\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u6838\u5fc3\u200b\u662f\u200b\u5bf9\u200b\u8f93\u5165\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5185\u5bb9\u200b\u89e3\u6790\u200b\u548c\u200b\u533a\u57df\u200b\u5212\u5206\u200b\u3002\u200b\u901a\u8fc7\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u4e0d\u540c\u200b\u5143\u7d20\u200b\uff08\u200b\u5982\u200b\u6587\u5b57\u200b\u3001\u200b\u56fe\u8868\u200b\u3001\u200b\u56fe\u7247\u200b\u7b49\u200b\uff09\uff0c\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u4e3a\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u7c7b\u522b\u200b\uff08\u200b\u5982\u7eaf\u200b\u6587\u672c\u200b\u533a\u200b\u3001\u200b\u6807\u9898\u200b\u533a\u200b\u3001\u200b\u8868\u683c\u200b\u533a\u200b\u3001\u200b\u56fe\u7247\u200b\u533a\u200b\u3001\u200b\u5217\u8868\u200b\u533a\u200b\u7b49\u200b\uff09\uff0c\u200b\u5e76\u200b\u786e\u5b9a\u200b\u8fd9\u4e9b\u200b\u533a\u57df\u200b\u5728\u200b\u6587\u6863\u200b\u4e2d\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5927\u5c0f\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PicoDet-L_layout_3cls\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"layout.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bDetection\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bDemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_layout_examples.tar -P ./dataset\ntar -xf ./dataset/det_layout_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 11,\n    \"train_samples\": 90,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/train_0077.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0028.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0012.jpg\"\n    ],\n    \"val_samples\": 20,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/val_0007.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0019.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0010.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/det_layout_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b11\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b90\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 20\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPicoDet-L_layout_3cls\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-L_layout_3cls.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-L_layout_3cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"layout.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-L_layout_3cls.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

  • \u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u7528\u200bPaddleX \u200b\u7684\u200b whl \u200b\u5305\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5730\u200b\u5c06\u200b\u6a21\u578b\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u96c6\u6210\u200b\u65b9\u5f0f\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u7b2c\u4e09\u6b65\u200b\u7684\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200bcreate_model(model_name=model_name, , kernel_option=kernel_option)\u200b\u589e\u52a0\u200b\u53c2\u6570\u200bmodel_dir=\"/output/best_model/inference\"\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

  1. \u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

  2. \u200b\u6a21\u5757\u200b\u96c6\u6210\u200b \u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html","title":"\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u7684\u200b\u591a\u70b9\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5f2f\u66f2\u200b\u77eb\u6b63\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u5370\u7ae0\u200b\u7684\u200b\u6587\u5b57\u200b\u5185\u5bb9\u200b\u3002\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u8bc6\u522b\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u4e2d\u200b\u7684\u200b\u5b50\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u533a\u57df\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u5370\u7ae0\u200b\u6587\u672c\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_server_seal_det\")\noutput = model.predict(\"seal_text_det.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleOCR \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_curve_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_curve_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 606,\n    \"train_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07834.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09943.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04079.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05701.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08324.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07451.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09562.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08237.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug01788.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06481.png\"\n    ],\n    \"val_samples\": 152,\n    \"val_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03724.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06456.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04029.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03603.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05454.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06269.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00624.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug02818.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00538.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04935.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/ocr_curve_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 606\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 152\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c55\u5f00\u200b\u67e5\u770b\u200b\u8be6\u60c5\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-OCRv4\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08PP-OCRv4_server_seal_det\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_server_seal_det.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_server_seal_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200bprecision\uff0crecall\u200b\u548c\u200bhmean.

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"seal_text_det.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_server_seal_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html","title":"\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u662f\u200b\u8868\u683c\u200b\u8bc6\u522b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u80fd\u591f\u200b\u5c06\u200b\u4e0d\u53ef\u200b\u7f16\u8f91\u8868\u683c\u200b\u56fe\u7247\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u8868\u683c\u200b\u5f62\u5f0f\u200b\uff08\u200b\u4f8b\u5982\u200bhtml\uff09\u3002\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u76ee\u6807\u200b\u662f\u200b\u5bf9\u200b\u8868\u683c\u200b\u7684\u200b\u884c\u200b\u3001\u200b\u5217\u200b\u548c\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8868\u683c\u200b\u8bc6\u522b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u8868\u683c\u200b\u533a\u57df\u200b\u7684\u200bhtml\u200b\u4ee3\u7801\u200b\u6216\u200bLatex\u200b\u4ee3\u7801\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u4ee3\u7801\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M SLANet_plus \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bSLANet\u200b\u7684\u200b\u589e\u5f3a\u7248\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200bSLANet\uff0cSLANet_plus \u200b\u5bf9\u200b\u65e0\u7ebf\u200b\u8868\u200b\u3001\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\u5f97\u5230\u200b\u4e86\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\uff0c\u200b\u5e76\u200b\u964d\u4f4e\u200b\u4e86\u200b\u6a21\u578b\u200b\u5bf9\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51c6\u786e\u6027\u200b\u7684\u200b\u654f\u611f\u5ea6\u200b\uff0c\u200b\u5373\u4f7f\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51fa\u73b0\u200b\u504f\u79fb\u200b\uff0c\u200b\u4e5f\u200b\u80fd\u591f\u200b\u8f83\u200b\u51c6\u786e\u200b\u5730\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"SLANet\")\noutput = model.predict(\"table_recognition.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b PaddleOCR\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/table_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/table_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 2000,\n    \"train_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_right_7384_X9UFEPKVMLALY7DDB11A.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_13708_VE2DGBD4DCQU2ITLBTEA.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_6490_14Z6ZN6G52GG4XA0K4XU.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_14236_DG96EX0EDKIIDK8P6ENG.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_19648_SV8B7X34RTYRAT2T5CPI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_7186_HODBC25HISMCSVKY0HJ9.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_5773_4K4H9OVK9X9YVHE4Y1BQ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_7760_8C62CCH5T57QUGE0NTHZ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_15707_B1YVOU3X4NHHB6TL269O.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_5223_HLG406UK35UD5EUYC2AV.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_2945_L7MSRHBZRW6Y347G39O6.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_4825_LH9WI6X104CP3VFXPSON.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_16837_79KHWU9WDM9ZQHNBGQAL.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_10107_9ENLLC29SQ6XI8WZY53E.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_16668_JIS0YFDZKTKETZIEKCKX.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_18653_J9SSKHLFTRJD4J8W17OW.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_8396_VJ3QJ3I0DP63P4JR77FE.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_9017_K2V7QBWSU2BA4R3AJSO7.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_19494_SDFMWP92NOB2OT7109FI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_288_6LK683JUCMOQ38V5BV29.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/table_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"PubTabTableRecDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b 90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b 10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b SLANet \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSLANet.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSLANet.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b acc \uff1b

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/table_recognition/SLANet.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"table_recognition.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSLANet.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
  • \u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u7528\u200bPaddleX \u200b\u7684\u200b whl \u200b\u5305\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5730\u200b\u5c06\u200b\u6a21\u578b\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u6587\u672c\u200b\u7684\u200b\u533a\u57df\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_det\")\noutput = model.predict(\"general_ocr_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b PaddleOCR \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002 \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 200,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/train_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/train_img_289.jpg\"\n    ],\n    \"val_samples\": 50,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/val_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/val_img_137.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 200\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 50\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u56fe\u7247\u200b\u7684\u200b\u957f\u5bbd\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b PP-OCRv4 \u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08PP-OCRv4_mobile_det\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_det.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200b PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b precision\u3001recall\u3001hmean\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_001.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

  • \u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u7528\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5730\u200b\u5c06\u200b\u6a21\u578b\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html","title":"\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u7684\u200b\u4e3b\u8981\u200b\u76ee\u7684\u200b\u662f\u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u51e0\u4f55\u53d8\u6362\u200b\uff0c\u200b\u4ee5\u200b\u7ea0\u6b63\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u6863\u200b\u626d\u66f2\u200b\u3001\u200b\u503e\u659c\u200b\u3001\u200b\u900f\u89c6\u200b\u53d8\u5f62\u200b\u7b49\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ee5\u4f9b\u200b\u540e\u7eed\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u66f4\u200b\u51c6\u786e\u200b\u7684\u200b\u8bc6\u522b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MS-SSIM \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b UVDoc\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.40 30.3 M \u200b\u9ad8\u7cbe\u5ea6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u578b\u200b

\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b DocUNet benchmark\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\uff0cwheel\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"UVDoc\")\noutput = model.predict(\"doc_test.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5f53\u524d\u200b\u6a21\u5757\u200b\u6682\u65f6\u200b\u4e0d\u200b\u652f\u6301\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ec5\u200b\u652f\u6301\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u3002\u200b\u5173\u4e8e\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8ba1\u5212\u200b\u5728\u200b\u672a\u6765\u200b\u652f\u6301\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u6838\u5fc3\u200b\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u4ece\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u63d0\u53d6\u200b\u51fa\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u63a5\u6536\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u8f93\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u7136\u540e\u200b\u901a\u8fc7\u200b\u590d\u6742\u200b\u7684\u200b\u56fe\u50cf\u5904\u7406\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u548c\u200b\u53ef\u200b\u641c\u7d22\u200b\u7684\u200b\u7535\u5b50\u6587\u672c\u200b\u3002\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u540e\u7eed\u200b\u7684\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u6316\u6398\u200b\u7b49\u200b\u5e94\u7528\u200b\u81f3\u5173\u91cd\u8981\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b4\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0cwheel\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_rec\")\noutput = model.predict(\"general_ocr_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b OCR \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 4468,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_10.png\"\n    ],\n    \"val_samples\": 2077,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_10.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 4468\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2077\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u5b57\u7b26\u200b\u957f\u5ea6\u200b\u5360\u200b\u6bd4\u200b\u7684\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b PP-OCRv4 \u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08PP-OCRv4_mobile_rec\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_rec.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1aevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b acc\u3001norm_edit_dis\uff1b

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_rec_001.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u3001\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4e13\u6ce8\u200b\u4e8e\u200b\u8bc6\u522b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u4e2d\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\u6a21\u5f0f\u200b\u3001\u200b\u8d8b\u52bf\u200b\u6216\u200b\u5468\u671f\u6027\u200b\u89c4\u5f8b\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\u6216\u200b\u5f02\u5e38\u200b\u65f6\u6bb5\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u5f02\u5e38\u200b\u53ef\u80fd\u200b\u7531\u200b\u7cfb\u7edf\u6545\u969c\u200b\u3001\u200b\u5916\u90e8\u200b\u51b2\u51fb\u200b\u3001\u200b\u6570\u636e\u5f55\u5165\u200b\u9519\u8bef\u200b\u6216\u200b\u7f55\u89c1\u200b\u4e8b\u4ef6\u200b\u7b49\u200b\u591a\u79cd\u200b\u56e0\u7d20\u200b\u5f15\u8d77\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u53ca\u65f6\u200b\u54cd\u5e94\u200b\u3001\u200b\u98ce\u9669\u200b\u8bc4\u4f30\u200b\u53ca\u200b\u4e1a\u52a1\u200b\u51b3\u7b56\u200b\u5177\u6709\u200b\u91cd\u5927\u610f\u4e49\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9898 0.9396 0.9641 72.8K DLinear_ad\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b Nonstationary_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9855 0.8895 0.9351 1.5MB \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b AutoEncoder_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9936 0.8436 0.9125 32K AutoEncoder_ad\u200b\u662f\u200b\u7ecf\u5178\u200b\u7684\u200b\u81ea\u200b\u7f16\u7801\u200b\u7ed3\u6784\u200b\u7684\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PatchTST_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9878 0.9070 0.9457 164K PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b TimesNet_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9837 0.9480 0.9656 732K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPSM\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u957f\u5ea6\u200b\u4e3a\u200b100\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u662f\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"AutoEncoder_ad\")\noutput = model.predict(\"ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleTS \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_anomaly_examples.tar -P ./dataset\ntar -xf ./dataset/ts_anomaly_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22032,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        0.0,\n        0.7326893750079723,\n        \"...\",\n        0.1382488479262673,\n        0.0\n      ]\n    ],\n    \"val_samples\": 198290,\n    \"val_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        22032.0,\n        0.8604795809835284,\n        \"...\",\n        0.1428571428571428,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_anomaly_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 22032\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 198290\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b csv \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b CSV \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b \u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.convert.enable=True\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5c06\u200bxlsx\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8f6c\u6362\u200b\u4e3a\u200bcsv\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08AutoEncoder_ad\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bAutoEncoder_ad.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bAutoEncoder_ad.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b f1\u3001recall \u200b\u548c\u200b precision\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_ad.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bAutoEncoder_ad.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u8d8b\u52bf\u200b\u3001\u200b\u5468\u671f\u6027\u200b\u3001\u200b\u5b63\u8282\u6027\u200b\u7b49\u200b\u56e0\u7d20\u200b\uff0c\u200b\u6765\u200b\u8bc6\u522b\u200b\u5e76\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u4e13\u95e8\u200b\u7528\u4e8e\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u3002\u200b\u8fd9\u79cd\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u533b\u7597\u200b\u8bca\u65ad\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u5206\u7c7b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\uff0c\u200b\u4e3a\u200b\u51b3\u7b56\u200b\u63d0\u4f9b\u200b\u6709\u529b\u200b\u652f\u6301\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b TimesNet_cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.5 792K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b UWaveGestureLibrary\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u662f\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleTS \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u7c7b\u522b\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.000949,\n        ...,\n        0.12107,\n        1.0,\n        0.0\n      ]\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.004578,\n        ...,\n        0.15728,\n        1.0,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass\u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 82620\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 83025\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u2757\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b csv \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200b xlsx\u200b\u548c\u200bxls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b CSV \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b \u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.convert.enable=True\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5c06\u200bxlsx\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8f6c\u6362\u200b\u4e3a\u200bcsv\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff08TimesNet_cls\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Acc \u200b\u548c\u200b F1 score\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_cls.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u65e8\u5728\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6a21\u5f0f\u200b\u3001\u200b\u8d8b\u52bf\u200b\u548c\u200b\u5468\u671f\u6027\u200b\u7b49\u200b\u7279\u5f81\u200b\uff0c\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u67d0\u4e00\u65f6\u95f4\u200b\u70b9\u200b\u6216\u200b\u65f6\u95f4\u6bb5\u200b\u5185\u200b\u53ef\u80fd\u200b\u53d1\u751f\u200b\u7684\u200b\u503c\u200b\u6216\u200b\u72b6\u6001\u200b\u3002\u200b\u8fd9\u200b\u6709\u52a9\u4e8e\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u505a\u51fa\u200b\u66f4\u52a0\u200b\u7cbe\u51c6\u200b\u7684\u200b\u51b3\u7b56\u200b\uff0c\u200b\u4f18\u5316\u200b\u8d44\u6e90\u914d\u7f6e\u200b\uff0c\u200b\u51cf\u5c11\u200b\u98ce\u9669\u200b\uff0c\u200b\u5e76\u200b\u6293\u4f4f\u200b\u6f5c\u5728\u200b\u7684\u200b\u5e02\u573a\u200b\u673a\u4f1a\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u901a\u5e38\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u5404\u79cd\u200b\u4f20\u611f\u5668\u200b\u3001\u200b\u7ecf\u6d4e\u200b\u6d3b\u52a8\u200b\u3001\u200b\u793e\u4f1a\u200b\u884c\u4e3a\u200b\u7b49\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u80a1\u7968\u4ef7\u683c\u200b\u3001\u200b\u6c14\u6e29\u200b\u53d8\u5316\u200b\u3001\u200b\u7f51\u7ad9\u200b\u8bbf\u95ee\u91cf\u200b\u3001\u200b\u9500\u552e\u200b\u6570\u636e\u200b\u7b49\u200b\u90fd\u200b\u662f\u200b\u5178\u578b\u200b\u7684\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.382 0.394 76k DLinear\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b Nonstationary\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.600 0.515 60.3M \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b PatchTST\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.385 0.397 2.2M PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b TiDE\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.405 0.412 34.9M TiDE\u200b\u662f\u200b\u9002\u7528\u200b\u4e8e\u200b\u5904\u7406\u200b\u591a\u200b\u53d8\u91cf\u200b\u3001\u200b\u957f\u671f\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u9884\u6d4b\u200b\u95ee\u9898\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200b TimesNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.417 0.431 5.2M \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5206\u6790\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6d4b\u8bd5\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u4e3a\u200b96\uff0c\u200b\u9884\u6d4b\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u9664\u200b TiDE \u200b\u5916\u4e3a\u200b96\uff0cTiDE\u200b\u4e3a\u200b720 \u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u662f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleTS \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ts_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 12194,\n    \"train_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2016-07-01 00:00:00\",\n        5.827000141143799,\n        2.009000062942505,\n        1.5989999771118164,\n        0.4620000123977661,\n        4.203000068664552,\n        1.3400000333786009,\n        30.5310001373291\n      ],\n      [\n        \"2016-07-01 01:00:00\",\n        5.692999839782715,\n        2.075999975204468,\n        1.4919999837875366,\n        0.4259999990463257,\n        4.142000198364259,\n        1.371000051498413,\n        27.78700065612793\n      ]\n    ],\n    \"val_samples\": 3484,\n    \"val_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2017-11-21 02:00:00\",\n        12.994000434875488,\n        4.889999866485597,\n        10.055999755859377,\n        2.878000020980835,\n        2.559000015258789,\n        1.2489999532699585,\n        4.7129998207092285\n      ],\n      [\n        \"2017-11-21 03:00:00\",\n        11.92199993133545,\n        4.554999828338623,\n        9.097000122070312,\n        3.0920000076293945,\n        2.559000015258789,\n        1.2790000438690186,\n        4.8540000915527335\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_dataset_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 12194\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 3484\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b csv \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200b xlsx\u200b\u548c\u200bxls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b CSV \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\uff1b \u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.convert.enable=True\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5c06\u200bxlsx\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8f6c\u6362\u200b\u4e3a\u200bcsv\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u9ad8\u6548\u7387\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\uff08DLinear\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b mse \u200b\u548c\u200b mae\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_fc.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"other_devices_support/multi_devices_use_guide.html","title":"PaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u4e3b\u8981\u200b\u9488\u5bf9\u200b\u6607\u200b\u817e\u200b NPU\u3001\u200b\u6606\u4ed1\u200b XPU\u3001\u200b\u5bd2\u6b66\u7eaa\u200b MLU\u3001\u200b\u6d77\u5149\u200bDCU \u200b\u786c\u4ef6\u5e73\u53f0\u200b\uff0c\u200b\u4ecb\u7ecd\u200b PaddleX \u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"other_devices_support/multi_devices_use_guide.html#1","title":"1\u3001\u200b\u5b89\u88c5","text":""},{"location":"other_devices_support/multi_devices_use_guide.html#11-paddlepaddle","title":"1.1 PaddlePaddle\u200b\u5b89\u88c5","text":"

\u200b\u9996\u5148\u200b\u8bf7\u200b\u60a8\u200b\u6839\u636e\u200b\u6240\u5c5e\u200b\u786c\u4ef6\u5e73\u53f0\u200b\uff0c\u200b\u5b8c\u6210\u200b\u98de\u6868\u200b PaddlePaddle \u200b\u7684\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5404\u200b\u786c\u4ef6\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6607\u200b\u817e\u200b NPU\uff1a\u200b\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u6606\u4ed1\u200b XPU\uff1a\u200b\u6606\u4ed1\u200b XPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5bd2\u6b66\u7eaa\u200b MLU\uff1a\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u6d77\u5149\u200b DCU\uff1a\u200b\u6d77\u5149\u200b DCU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"other_devices_support/multi_devices_use_guide.html#12-paddlex","title":"1.2 PaddleX\u200b\u5b89\u88c5","text":"

\u200b\u6b22\u8fce\u60a8\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200bPaddleX\uff0c\u200b\u5728\u200b\u6211\u4eec\u200b\u6b63\u5f0f\u200b\u5f00\u59cb\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u660e\u786e\u200b\u60a8\u200b\u7684\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u9700\u6c42\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

PaddleX\u200b\u4e3a\u200b\u60a8\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff1aWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u548c\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\uff0c\u200b\u4e0b\u9762\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u8fd9\u200b\u4e24\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u548c\u200b\u5b89\u88c5\u200b\u65b9\u6cd5\u200b\u3002

"},{"location":"other_devices_support/multi_devices_use_guide.html#121-wheel","title":"1.2.1 Wheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b \uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u66f4\u200b\u4fbf\u6377\u200b\u3001\u200b\u66f4\u200b\u8f7b\u91cf\u200b\u7684\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200b\u8f7b\u91cf\u7ea7\u200b\u7684\u200bWheel\u200b\u5305\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u5373\u53ef\u200b\u57fa\u4e8e\u200bPaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u6240\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u5e76\u200b\u80fd\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u8fdb\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bWheel\u200b\u5305\u200b\uff1a

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b1-py3-none-any.whl\n
"},{"location":"other_devices_support/multi_devices_use_guide.html#122","title":"1.2.2 \u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u4e8c\u6b21\u5f00\u53d1\u200b \uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u529f\u80fd\u200b\u66f4\u52a0\u200b\u5f3a\u5927\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5b89\u88c5\u200b\u60a8\u200b\u9700\u8981\u200b\u7684\u200bPaddleX\u200b\u63d2\u4ef6\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u4e0d\u4ec5\u200b\u540c\u6837\u200b\u80fd\u591f\u200b\u5bf9\u200b\u63d2\u4ef6\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\uff0c\u200b\u8fd8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u5176\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u66f4\u200b\u9ad8\u7ea7\u200b\u7684\u200b\u64cd\u4f5c\u200b\u3002

PaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5982\u4e0b\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u6839\u636e\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff1a

\ud83d\udc49 \u200b\u63d2\u4ef6\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09 \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u6a21\u5757\u200b \u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b PaddleSeg \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b PaddleDetection \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCR \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCRPaddleDetection \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b PaddleOCRPaddleDetectionPaddleClas \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u901a\u7528\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b PaddleSeg

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u7684\u200b\u63d2\u4ef6\u200b\u4e3a\u200bPaddleXXX\uff08\u200b\u53ef\u4ee5\u200b\u6709\u200b\u591a\u4e2a\u200b\uff09\uff0c\u200b\u5728\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b\uff1a

# \u200b\u4e0b\u8f7d\u200b PaddleX \u200b\u6e90\u7801\u200b\ngit clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\n\n# \u200b\u5b89\u88c5\u200b PaddleX whl\n# -e\uff1a\u200b\u4ee5\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel\npip install -e .\n\n# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleXXX\n
\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200bPaddleOCR\u3001PaddleClas\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u5b89\u88c5\u200b\u63d2\u4ef6\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleOCR\u3001PaddleClas \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleOCR PaddleClas\n
\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u586b\u5199\u200b\u5177\u4f53\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\npaddlex --install\n
\u200b\u63d2\u4ef6\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u514b\u9686\u200b\u6e90\u4e3a\u200b github.com\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u652f\u6301\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b--platform \u200b\u6307\u5b9a\u200b\u514b\u9686\u200b\u6e90\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200bPaddleX\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install --platform gitee.com\n
\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u5c06\u4f1a\u200b\u6709\u200b\u5982\u4e0b\u200b\u63d0\u793a\u200b\uff1a

All packages are installed.\n
"},{"location":"other_devices_support/multi_devices_use_guide.html#2","title":"2\u3001\u200b\u4f7f\u7528","text":"

\u200b\u57fa\u4e8e\u200b\u6607\u200b\u817e\u200b NPU\u3001\u200b\u5bd2\u6b66\u7eaa\u200b MLU\u3001\u200b\u6606\u4ed1\u200b XPU\u3001\u200b\u6d77\u5149\u200bDCU \u200b\u786c\u4ef6\u5e73\u53f0\u200b\u7684\u200b PaddleX \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u5de5\u5177\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\u4e0e\u200b GPU \u200b\u76f8\u540c\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6839\u636e\u200b\u6240\u5c5e\u200b\u786c\u4ef6\u5e73\u53f0\u200b\uff0c\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u8bbe\u5907\u200b\u7684\u200b\u53c2\u6570\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u5de5\u5177\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

"},{"location":"other_devices_support/paddlepaddle_install_DCU.html","title":"\u6d77\u5149\u200b DCU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u6d77\u5149\u200b Z100 \u200b\u7cfb\u5217\u200b\u82af\u7247\u200b\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u53d1\u5e03\u200b\u7684\u200b\u6d77\u5149\u200b DCU \u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\uff0c\u200b\u8be5\u200b\u955c\u50cf\u200b\u9884\u88c5\u200b\u6709\u200b\u6d77\u5149\u200b DCU \u200b\u57fa\u7840\u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\u5e93\u200b\uff08DTK\uff09\u3002

"},{"location":"other_devices_support/paddlepaddle_install_DCU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"

\u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b

docker pull registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310\n
\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b

docker run -it --name paddle-dcu-dev -v `pwd`:/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310 /bin/bash\n
"},{"location":"other_devices_support/paddlepaddle_install_DCU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5728\u200b\u542f\u52a8\u200b\u7684\u200b docker \u200b\u5bb9\u5668\u200b\u4e2d\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u53d1\u5e03\u200b\u7684\u200b wheel \u200b\u5305\u200b\u3002\u200b\u6ce8\u610f\u200b\uff1a\u200b\u98de\u6868\u200b\u6846\u67b6\u200b DCU \u200b\u7248\u4ec5\u200b\u652f\u6301\u200b\u6d77\u5149\u200b C86 \u200b\u67b6\u6784\u200b\u3002

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b wheel \u200b\u5305\u200b\npip install paddlepaddle-rocm -i https://www.paddlepaddle.org.cn/packages/nightly/dcu\n
\u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b \u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b

python -c \"import paddle; paddle.utils.run_check()\"\n
\u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"other_devices_support/paddlepaddle_install_MLU.html","title":"\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u5bd2\u6b66\u7eaa\u200b MLU370X8 \u200b\u82af\u7247\u200b\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\u5b8c\u6210\u200b\u73af\u5883\u200b\u51c6\u5907\u200b\u3002

"},{"location":"other_devices_support/paddlepaddle_install_MLU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"

\u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b

# \u200b\u9002\u7528\u200b\u4e8e\u200b X86 \u200b\u67b6\u6784\u200b\uff0c\u200b\u6682\u65f6\u200b\u4e0d\u200b\u63d0\u4f9b\u200b Arch64 \u200b\u67b6\u6784\u200b\u955c\u50cf\u200b\ndocker pull registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310\n
\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b

docker run -it --name paddle-mlu-dev -v $(pwd):/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v /usr/bin/cnmon:/usr/bin/cnmon \\\n  registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310 /bin/bash\n
"},{"location":"other_devices_support/paddlepaddle_install_MLU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5728\u200b\u542f\u52a8\u200b\u7684\u200b docker \u200b\u5bb9\u5668\u200b\u4e2d\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u53d1\u5e03\u200b\u7684\u200b wheel \u200b\u5305\u200b\u3002\u200b\u5f53\u524d\u200b\u63d0\u4f9b\u200b Python3.10 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b\u3002\u200b\u5982\u200b\u6709\u200b\u5176\u4ed6\u200b Python \u200b\u7248\u672c\u200b\u9700\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u81ea\u884c\u200b\u7f16\u8bd1\u200b\u5b89\u88c5\u200b\u3002

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b wheel \u200b\u5305\u200b\n# \u200b\u6ce8\u610f\u200b\u9700\u8981\u200b\u5148\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b cpu \u200b\u7248\u672c\u200b\npython -m pip install paddlepaddle==3.0.0.dev20240624 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython -m pip install paddle-custom-mlu==3.0.0.dev20240806 -i https://www.paddlepaddle.org.cn/packages/nightly/mlu/\n
\u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b \u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b

python -c \"import paddle; paddle.utils.run_check()\"\n
\u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b

Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 mlu.\nPaddlePaddle works well on 16 mlus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"other_devices_support/paddlepaddle_install_NPU.html","title":"\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u6607\u200b\u817e\u200b 910B \u200b\u82af\u7247\u200b\uff08\u200b\u66f4\u200b\u591a\u200b\u578b\u53f7\u200b\u8fd8\u200b\u5728\u200b\u652f\u6301\u200b\u4e2d\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u6709\u200b\u5176\u4ed6\u200b\u578b\u53f7\u200b\u7684\u200b\u76f8\u5173\u200b\u9700\u6c42\u200b\uff0c\u200b\u8bf7\u200b\u63d0\u4ea4\u200bissue\u200b\u544a\u77e5\u200b\u6211\u4eec\u200b\uff09\uff0c\u200b\u6607\u200b\u817e\u200b\u9a71\u52a8\u200b\u7248\u672c\u200b\u4e3a\u200b 23.0.3\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6607\u200b\u817e\u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\u5b8c\u6210\u200b\u73af\u5883\u200b\u51c6\u5907\u200b\u3002

"},{"location":"other_devices_support/paddlepaddle_install_NPU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"
  • \u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u5df2\u7ecf\u200b\u9ed8\u8ba4\u200b\u5b89\u88c5\u200b\u4e86\u200b\u6607\u200b\u817e\u200b\u7b97\u5b50\u200b\u5e93\u200b CANN-8.0.T13\u3002
    # \u200b\u9002\u7528\u200b\u4e8e\u200b X86 \u200b\u67b6\u6784\u200b\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-x86_64-gcc84-py39\n# \u200b\u9002\u7528\u200b\u4e8e\u200b Aarch64 \u200b\u67b6\u6784\u200b\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-aarch64-gcc84-py39\n
  • \u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b\uff0cASCEND_RT_VISIBLE_DEVICES \u200b\u6307\u5b9a\u200b\u53ef\u89c1\u200b\u7684\u200b NPU \u200b\u5361\u53f7\u200b
    docker run -it --name paddle-npu-dev -v $(pwd):/work \\\n    --privileged --network=host --shm-size=128G -w=/work \\\n    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \\\n    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\\n    -v /usr/local/dcmi:/usr/local/dcmi \\\n    -e ASCEND_RT_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" \\\n    registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-$(uname -m)-gcc84-py39 /bin/bash\n
"},{"location":"other_devices_support/paddlepaddle_install_NPU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5f53\u524d\u200b\u63d0\u4f9b\u200b Python3.9 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b\u3002\u200b\u5982\u200b\u6709\u200b\u5176\u4ed6\u200b Python \u200b\u7248\u672c\u200b\u9700\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u81ea\u884c\u200b\u7f16\u8bd1\u200b\u5b89\u88c5\u200b\u3002

  • \u200b\u4e0b\u8f7d\u5b89\u88c5\u200b Python3.9 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b
    # \u200b\u6ce8\u610f\u200b\u9700\u8981\u200b\u5148\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b cpu \u200b\u7248\u672c\u200b\npython3.9 -m pip install paddlepaddle==3.0.0.dev20240520 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython3.9 -m pip install paddle_custom_npu==3.0.0.dev20240719 -i https://www.paddlepaddle.org.cn/packages/nightly/npu/\n
  • \u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b
    python -c \"import paddle; paddle.utils.run_check()\"\n
    \u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b
Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 npu.\nPaddlePaddle works well on 8 npus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"other_devices_support/paddlepaddle_install_XPU.html","title":"\u6606\u4ed1\u200b XPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u6606\u4ed1\u200b R200/R300 \u200b\u7b49\u200b\u82af\u7247\u200b\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u53d1\u5e03\u200b\u7684\u200b\u6606\u4ed1\u200b XPU \u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\uff0c\u200b\u8be5\u200b\u955c\u50cf\u200b\u9884\u88c5\u200b\u6709\u200b\u6606\u4ed1\u200b\u57fa\u7840\u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\u5e93\u200b\uff08XRE\uff09\u3002

"},{"location":"other_devices_support/paddlepaddle_install_XPU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"

\u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b

docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # X86 \u200b\u67b6\u6784\u200b\ndocker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # ARM \u200b\u67b6\u6784\u200b\n
\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b

docker run -it --name=xxx -m 81920M --memory-swap=81920M \\\n    --shm-size=128G --privileged --net=host \\\n    -v $(pwd):/workspace -w /workspace \\\n    registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash\n
"},{"location":"other_devices_support/paddlepaddle_install_XPU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5f53\u524d\u200b\u63d0\u4f9b\u200b Python3.10 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b\u3002\u200b\u5982\u200b\u6709\u200b\u5176\u4ed6\u200b Python \u200b\u7248\u672c\u200b\u9700\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u81ea\u884c\u200b\u7f16\u8bd1\u200b\u5b89\u88c5\u200b\u3002

\u200b\u5b89\u88c5\u200b Python3.10 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b

pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # X86 \u200b\u67b6\u6784\u200b\npip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # ARM \u200b\u67b6\u6784\u200b\n
\u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b \u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b

python -c \"import paddle; paddle.utils.run_check()\"\n
\u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"pipeline_deploy/edge_deploy.html","title":"PaddleX \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u4f7f\u7528\u6307\u5357","text":"
  • PaddleX \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u4f7f\u7528\u6307\u5357\u200b
  • \u200b\u5b89\u88c5\u200b\u6d41\u7a0b\u200b\u4e0e\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b
    • \u200b\u73af\u5883\u200b\u51c6\u5907\u200b
    • \u200b\u7269\u6599\u200b\u51c6\u5907\u200b
    • \u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b
  • \u200b\u53c2\u8003\u8d44\u6599\u200b
  • \u200b\u53cd\u9988\u200b\u4e13\u533a\u200b

\u200b\u672c\u200b\u6307\u5357\u200b\u4e3b\u8981\u200b\u4ecb\u7ecd\u200b PaddleX \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u5728\u200b Android shell \u200b\u4e0a\u200b\u7684\u200b\u8fd0\u884c\u200b\u65b9\u6cd5\u200b\u3002 \u200b\u672c\u200b\u6307\u5357\u200b\u9002\u7528\u200b\u4e8e\u200b\u4e0b\u5217\u200b 6 \u200b\u79cd\u200b\u6a21\u5757\u200b\u7684\u200b 8 \u200b\u4e2a\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u5757\u200b \u200b\u5177\u4f53\u200b\u6a21\u578b\u200b CPU GPU \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PicoDet-S \u2705 \u2705 PicoDet-L \u2705 \u2705 \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b PicoDet_layout_1x \u2705 \u2705 \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b PP-LiteSeg-T \u2705 \u2705 \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PP-LCNet_x1_0 \u2705 \u2705 MobileNetV3_small_x1_0 \u2705 \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b PP-OCRv4_mobile_det \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PP-OCRv4_mobile_rec \u2705

\u200b\u5907\u6ce8\u200b - GPU \u200b\u6307\u200b\u7684\u200b\u662f\u200b \u200b\u4f7f\u7528\u200b OpenCL \u200b\u5c06\u200b\u8ba1\u7b97\u200b\u6620\u5c04\u200b\u5230\u200b GPU \u200b\u4e0a\u200b\u6267\u884c\u200b \uff0c\u200b\u4ee5\u200b\u5145\u5206\u5229\u7528\u200b GPU \u200b\u786c\u4ef6\u200b\u7b97\u529b\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u63a8\u7406\u200b\u6027\u80fd\u200b\u3002

"},{"location":"pipeline_deploy/edge_deploy.html#_1","title":"\u5b89\u88c5\u200b\u6d41\u7a0b\u200b\u4e0e\u200b\u4f7f\u7528\u200b\u65b9\u5f0f","text":""},{"location":"pipeline_deploy/edge_deploy.html#_2","title":"\u73af\u5883\u200b\u51c6\u5907","text":"
  1. \u200b\u5728\u200b\u672c\u5730\u200b\u73af\u5883\u200b\u5b89\u88c5\u200b\u597d\u200b CMake \u200b\u7f16\u8bd1\u200b\u5de5\u5177\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b\u5f53\u524d\u200b\u7cfb\u7edf\u200b\u7b26\u5408\u8981\u6c42\u200b\u7684\u200b\u7248\u672c\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b Mac \u200b\u4e0a\u200b\u5f00\u53d1\u200b\uff0c\u200b\u9700\u8981\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b Mac \u200b\u5e73\u53f0\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002

    \u200b\u73af\u5883\u200b\u8981\u6c42\u200b - CMake >= 3.10\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b 3.20 \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09 - Android NDK >= r17c\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b r20b \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09

    \u200b\u672c\u200b\u6307\u5357\u200b\u6240\u200b\u4f7f\u7528\u200b\u7684\u200b\u6d4b\u8bd5\u73af\u5883\u200b\uff1a - cmake == 3.20.0 - android-ndk == r20b

  2. \u200b\u51c6\u5907\u200b\u4e00\u90e8\u200b Android \u200b\u624b\u673a\u200b\uff0c\u200b\u5e76\u200b\u5f00\u542f\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002\u200b\u5f00\u542f\u200b\u65b9\u6cd5\u200b: \u200b\u624b\u673a\u200b\u8bbe\u7f6e\u200b -> \u200b\u67e5\u627e\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b -> \u200b\u6253\u5f00\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b\u548c\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002

  3. \u200b\u7535\u8111\u200b\u4e0a\u200b\u5b89\u88c5\u200b ADB \u200b\u5de5\u5177\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8c03\u8bd5\u200b\u3002ADB \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

    3.1. Mac \u200b\u7535\u8111\u200b\u5b89\u88c5\u200b ADB

     brew cask install android-platform-tools\n

    3.2. Linux \u200b\u5b89\u88c5\u200b ADB

     # debian\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo apt update\n sudo apt install -y wget adb\n\n # redhat\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo yum install adb\n

    3.3. Windows \u200b\u5b89\u88c5\u200b ADB

    win \u200b\u4e0a\u200b\u5b89\u88c5\u200b\u9700\u8981\u200b\u53bb\u200b\u8c37\u6b4c\u200b\u7684\u200b\u5b89\u5353\u200b\u5e73\u53f0\u200b\u4e0b\u8f7d\u200b ADB \u200b\u8f6f\u4ef6\u5305\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\uff1a\u200b\u94fe\u63a5\u200b

    \u200b\u6253\u5f00\u200b\u7ec8\u7aef\u200b\uff0c\u200b\u624b\u673a\u200b\u8fde\u63a5\u200b\u7535\u8111\u200b\uff0c\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4e2d\u200b\u8f93\u5165\u200b

     adb devices\n

    \u200b\u5982\u679c\u200b\u6709\u200b device \u200b\u8f93\u51fa\u200b\uff0c\u200b\u5219\u200b\u8868\u793a\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u3002

     List of devices attached\n 744be294    device\n
"},{"location":"pipeline_deploy/edge_deploy.html#_3","title":"\u7269\u6599\u200b\u51c6\u5907","text":"
  1. \u200b\u514b\u9686\u200b Paddle-Lite-Demo \u200b\u4ed3\u5e93\u200b\u7684\u200b feature/paddle-x \u200b\u5206\u652f\u200b\u5230\u200b PaddleX-Lite-Deploy \u200b\u76ee\u5f55\u200b\u3002

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. \u200b\u586b\u5199\u200b \u200b\u95ee\u5377\u200b \u200b\u4e0b\u8f7d\u200b\u538b\u7f29\u5305\u200b\uff0c\u200b\u5c06\u200b\u538b\u7f29\u5305\u200b\u653e\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\u540e\u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\u3002

    • object_detection\uff08\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff09\u200b\u95ee\u5377\u200b
    • semantic_segmentation\uff08\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\uff09\u200b\u95ee\u5377\u200b
    • image_classification\uff08\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff09\u200b\u95ee\u5377\u200b
    • ocr\uff08\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\uff09\u200b\u95ee\u5377\u200b

    \u200b\u4e0b\u9762\u200b\u662f\u200b object_detection \u200b\u89e3\u538b\u200b\u64cd\u4f5c\u200b\u793a\u4f8b\u200b\uff0c\u200b\u5176\u4ed6\u200b\u4efb\u52a1\u200b\u53ef\u200b\u53c2\u8003\u200b\u540e\u9762\u200b\u7684\u200b\u8868\u683c\u200b\u3002

    # 1. \u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\ncd PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection\n\n# 2. \u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\nunzip object_detection.zip\n

    \u200b\u4efb\u52a1\u200b\u540d\u200b \u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b \u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b object_detection PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection unzip object_detection.zip semantic_segmentation PaddleX-Lite-Deploy/semantic_segmentation/android/shell/cxx/semantic_segmentation unzip semantic_segmentation.zip image_classification PaddleX-Lite-Deploy/image_classification/android/shell/cxx/image_classification unzip image_classification.zip ocr PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo unzip ocr.zip

"},{"location":"pipeline_deploy/edge_deploy.html#_4","title":"\u90e8\u7f72\u200b\u6b65\u9aa4","text":"
  1. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX_Lite_Deploy/libs\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u6240\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\u3002\u200b\u6b64\u200b\u6b65\u9aa4\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u4e00\u6b21\u200b\uff0c\u200b\u5373\u53ef\u200b\u652f\u6301\u200b\u6bcf\u4e2a\u200b demo \u200b\u4f7f\u7528\u200b\u3002

  2. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX_Lite_Deploy/{Task_Name}/assets\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b \u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u3001\u200b\u6d4b\u8bd5\u200b\u56fe\u7247\u200b\u548c\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u7b49\u200b\u3002

  3. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX_Lite_Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}\uff0c\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\u548c\u200b\u8fd0\u884c\u200b\u3002

  4. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}\uff0c\u200b\u8fd0\u884c\u200b run.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u5728\u200b\u7aef\u4fa7\u200b\u7684\u200b\u9884\u6d4b\u200b\u3002

    \u200b\u6ce8\u610f\u200b\uff1a - Pipeline_Name \u200b\u548c\u200b Demo_Name \u200b\u4e3a\u200b\u5360\u4f4d\u200b\u7b26\u200b\uff0c\u200b\u5177\u4f53\u200b\u503c\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u7684\u200b\u8868\u683c\u200b\u3002 - download.sh \u200b\u548c\u200b run.sh \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u6a21\u578b\u200b\u540d\u6765\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u200b\u4e0d\u200b\u6307\u5b9a\u200b\u5219\u200b\u4f7f\u7528\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u3002\u200b\u76ee\u524d\u200b\u9002\u914d\u200b\u7684\u200b\u6a21\u578b\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u8868\u683c\u200b\u7684\u200b Model_Name \u200b\u5217\u200b\u3002 - \u200b\u82e5\u60f3\u200b\u4f7f\u7528\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u8f6c\u6362\u65b9\u6cd5\u200b \u200b\u5f97\u5230\u200b .nb \u200b\u6a21\u578b\u200b\uff0c\u200b\u653e\u5230\u200bPaddleX_Lite_Deploy/{Pipeline_Name}/assets/{Model_Name}\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c Model_Name\u200b\u4e3a\u200b\u6a21\u578b\u200b\u540d\u200b\uff0c\u200b\u4f8b\u5982\u200b PaddleX_Lite_Deploy/object_detection/assets/PicoDet-L\u3002 - \u200b\u5728\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b NDK_ROOT \u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e3a\u200b\u5b9e\u9645\u200b\u5b89\u88c5\u200b\u7684\u200b NDK \u200b\u8def\u5f84\u200b\u3002 - \u200b\u5728\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\u65f6\u9700\u200b\u4fdd\u6301\u200b ADB \u200b\u8fde\u63a5\u200b\u3002 - \u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b Git Bash \u200b\u6267\u884c\u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b\u3002 - \u200b\u82e5\u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b windows\u3002 - \u200b\u82e5\u200b\u5728\u200b Mac \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b darwin\u3002

\u200b\u4ee5\u4e0b\u200b\u4e3a\u200b object_detection \u200b\u7684\u200b\u793a\u4f8b\u200b\uff0c\u200b\u5176\u4ed6\u200b demo \u200b\u9700\u200b\u6309\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u7684\u200b\u8868\u683c\u200b\u6539\u53d8\u200b\u7b2c\u4e8c\u6b65\u200b\u548c\u200b\u7b2c\u4e09\u6b65\u200b\u6240\u200b\u5207\u6362\u200b\u7684\u200b\u76ee\u5f55\u200b\u3002

 # 1. \u200b\u4e0b\u8f7d\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\n cd PaddleX_Lite_Deploy/libs\n sh download.sh\n\n # 2. \u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u3001\u200b\u6d4b\u8bd5\u200b\u56fe\u7247\u200b\u3001\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\n cd ../object_detection/assets\n sh download.sh\n # \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u6a21\u578b\u200b\u540d\u6765\u200b\u6307\u5b9a\u200b\u4e0b\u8f7d\u200b\u7684\u200b\u6a21\u578b\u200b \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u8868\u683c\u200b\u7684\u200b Model_Name \u200b\u5217\u200b\n # sh download.sh PicoDet-L\n\n # 3. \u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\n cd ../android/app/shell/cxx/picodet_detection\n sh build.sh\n\n # 4. \u200b\u9884\u6d4b\u200b\n sh run.sh\n # \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u6a21\u578b\u200b\u540d\u6765\u200b\u6307\u5b9a\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u8868\u683c\u200b\u7684\u200b Model_Name \u200b\u5217\u200b\n # sh run.sh PicoDet-L\n

\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\u6240\u793a\u200b\uff0c\u200b\u5e76\u200b\u751f\u6210\u200b\u4e00\u5f20\u200b\u540d\u53eb\u200b dog_picodet_detection_result.jpg \u200b\u7684\u200b\u7ed3\u679c\u200b\u56fe\u200b\uff1a

======= benchmark summary =======\ninput_shape(s) (NCHW): {1, 3, 320, 320}\nmodel_dir:./models/PicoDet-S/model.nb\nwarmup:1\nrepeats:10\npower_mode:1\nthread_num:0\n<b>* time info(ms) </b>*\n1st_duration:320.086\nmax_duration:277.331\nmin_duration:272.67\navg_duration:274.91\n\n====== output summary ======\ndetection, image size: 768, 576, detect object: bicycle, score: 0.905929, location: x=125, y=120, width=441, height=304\ndetection, image size: 768, 576, detect object: truck, score: 0.653789, location: x=465, y=72, width=230, height=98\ndetection, image size: 768, 576, detect object: dog, score: 0.731584, location: x=128, y=222, width=182, height=319\n

\u200b\u672c\u200b\u8282\u200b\u63cf\u8ff0\u200b\u7684\u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b\u9002\u7528\u200b\u4e8e\u200b\u4e0b\u8868\u4e2d\u200b\u5217\u4e3e\u200b\u7684\u200b demo\uff1a

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b Pipeline_Name \u200b\u6a21\u5757\u200b Demo_Name \u200b\u5177\u4f53\u200b\u6a21\u578b\u200b Model_Name \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b object_detection \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b picodet_detection PicoDet-S PicoDet-S\uff08default\uff09PicoDet-S_gpu PicoDet-L PicoDet-LPicoDet-L_gpu PicoDet_layout_1x PicoDet_layout_1xPicoDet_layout_1x_gpu \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b semantic_segmentation \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b semantic_segmentation PP-LiteSeg-T PP-LiteSeg-T\uff08default\uff09PP-LiteSeg-T_gpu \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b image_classification \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b image_classification PP-LCNet_x1_0 PP-LCNet_x1_0\uff08default\uff09PP-LCNet_x1_0_gpu MobileNetV3_small_x1_0 MobileNetV3_small_x1_0MobileNetV3_small_x1_0_gpu \u200b\u901a\u7528\u200bOCR ocr \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b ppocr_demo PP-OCRv4_mobile_det PP-OCRv4_mobile_det \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PP-OCRv4_mobile_rec PP-OCRv4_mobile_rec

\u200b\u5907\u6ce8\u200b - \u200b\u76ee\u524d\u200b\u6ca1\u6709\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo\uff0c\u200b\u56e0\u6b64\u200b\u590d\u7528\u200b picodet_detectiondemo \u200b\u6765\u200b\u90e8\u7f72\u200bPicoDet_layout_1x\u200b\u6a21\u578b\u200b\u3002

"},{"location":"pipeline_deploy/edge_deploy.html#_5","title":"\u53c2\u8003\u8d44\u6599","text":"

\u200b\u672c\u200b\u6307\u5357\u200b\u4ec5\u200b\u4ecb\u7ecd\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u7684\u200b\u57fa\u672c\u200b\u5b89\u88c5\u200b\u3001\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u82e5\u200b\u60f3\u8981\u200b\u4e86\u89e3\u200b\u66f4\u200b\u7ec6\u81f4\u200b\u7684\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5982\u200b\u4ee3\u7801\u200b\u4ecb\u7ecd\u200b\u3001\u200b\u4ee3\u7801\u200b\u8bb2\u89e3\u200b\u3001\u200b\u66f4\u65b0\u200b\u6a21\u578b\u200b\u3001\u200b\u66f4\u65b0\u200b\u8f93\u5165\u200b\u548c\u200b\u8f93\u51fa\u200b\u9884\u5904\u7406\u200b\u3001\u200b\u66f4\u65b0\u200b\u9884\u6d4b\u200b\u5e93\u200b\u7b49\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b\u4e0b\u5217\u200b\u6587\u6863\u200b\uff1a

  • object_detection\uff08\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff09
  • semantic_segmentation\uff08\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\uff09
  • image_classification\uff08\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff09
  • ocr\uff08\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\uff09
"},{"location":"pipeline_deploy/edge_deploy.html#_6","title":"\u53cd\u9988\u200b\u4e13\u533a","text":"

\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b\u6301\u7eed\u200b\u4f18\u5316\u200b\u4e2d\u200b\uff0c\u200b\u6b22\u8fce\u200b\u63d0\u200b issue \u200b\u53cd\u9988\u200b\u95ee\u9898\u200b\u4e0e\u200b\u9700\u6c42\u200b\uff0c\u200b\u6211\u4eec\u200b\u4f1a\u200b\u53ca\u65f6\u200b\u8ddf\u8fdb\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html","title":"PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357","text":"

\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\u3002\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u9996\u5148\u200b\u4ecb\u7ecd\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u5b89\u88c5\u200b\u548c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u7136\u540e\u200b\u5217\u4e3e\u200b\u76ee\u524d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e0e\u200b\u6a21\u578b\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#1","title":"1.\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u5b89\u88c5\u200b\u4e0e\u200b\u4f7f\u7528","text":"

\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b \u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\uff0c\u200b\u4e14\u200b\u6309\u7167\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u6216\u200bPaddleX\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u8dd1\u901a\u200b\u4e86\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#11","title":"1.1 \u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u4e0b\u8868\u4e2d\u200b\u6839\u636e\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b\u3001\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3001Python \u200b\u7248\u672c\u200b\u7b49\u200b\u4fe1\u606f\u200b\uff0c\u200b\u627e\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u5e76\u200b\u5728\u200b\u90e8\u7f72\u200b\u73af\u5883\u200b\u4e2d\u200b\u6267\u884c\u200b\u3002\u200b\u8bf7\u200b\u5c06\u200b {paddlex \u200b\u7248\u672c\u53f7\u200b} \u200b\u66ff\u6362\u200b\u4e3a\u200b\u5b9e\u9645\u200b\u7684\u200b paddlex \u200b\u7684\u200b\u7248\u672c\u53f7\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5f53\u524d\u200b\u6700\u65b0\u200b\u7684\u200b\u7a33\u5b9a\u200b\u7248\u672c\u200b 3.0.0b2\u3002\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5f00\u53d1\u200b\u5206\u652f\u200b\u5bf9\u5e94\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u8bf7\u200b\u5c06\u200b {paddlex \u200b\u7248\u672c\u53f7\u200b} \u200b\u66ff\u6362\u200b\u4e3a\u200b 0.0.0.dev0\u3002

\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b \u200b\u64cd\u4f5c\u7cfb\u7edf\u200b \u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b Python \u200b\u7248\u672c\u200b \u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0\uff08CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6\uff09 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • \u200b\u5bf9\u4e8e\u200b Linux \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u4f7f\u7528\u200b Bash \u200b\u6267\u884c\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u3002
  • \u200b\u5f53\u200b\u4f7f\u7528\u200b NVIDIA GPU \u200b\u65f6\u200b\uff0c\u200b\u8bf7\u200b\u4f7f\u7528\u200b\u4e0e\u200b\u73af\u5883\u200b\u5339\u914d\u200b\u7684\u200b CUDA \u200b\u548c\u200b cuDNN \u200b\u7248\u672c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5426\u5219\u200b\uff0c\u200b\u5c06\u200b\u65e0\u6cd5\u200b\u6b63\u5e38\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002
  • \u200b\u5f53\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200b CPU \u200b\u65f6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4ec5\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff1b\u200b\u5bf9\u4e8e\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5219\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u6216\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u3002
"},{"location":"pipeline_deploy/high_performance_inference.html#12","title":"1.2 \u200b\u83b7\u53d6\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u6fc0\u6d3b","text":"

\u200b\u5728\u200b \u200b\u98de\u6868\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b-\u200b\u4eba\u5de5\u667a\u80fd\u200b\u5b66\u4e60\u200b\u4e0e\u200b\u5b9e\u8bad\u200b\u793e\u533a\u200b \u200b\u9875\u9762\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u5e8f\u5217\u53f7\u200b\u54a8\u8be2\u200b\u4e0e\u200b\u83b7\u53d6\u200b\u201d\u200b\u90e8\u5206\u200b\u9009\u62e9\u200b\u201c\u200b\u7acb\u5373\u200b\u83b7\u53d6\u200b\u201d\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u90e8\u7f72\u200b\u7684\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5e76\u200b\u70b9\u51fb\u200b\u201c\u200b\u83b7\u53d6\u200b\u201d\u3002\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u9875\u9762\u200b\u4e0b\u65b9\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200bSDK\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u201d\u200b\u90e8\u5206\u200b\u627e\u5230\u200b\u83b7\u53d6\u200b\u5230\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\uff1a

\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002PaddleX \u200b\u63d0\u4f9b\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u548c\u200b\u5728\u7ebf\u200b\u6fc0\u6d3b\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff08\u200b\u5747\u200b\u53ea\u200b\u652f\u6301\u200b Linux \u200b\u7cfb\u7edf\u200b\uff09\uff1a

  • \u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u53ca\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u4f7f\u200b\u7a0b\u5e8f\u200b\u81ea\u52a8\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002
  • \u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u6309\u7167\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u754c\u9762\u200b\u4e2d\u200b\u7684\u200b\u6307\u5f15\u200b\uff08\u200b\u70b9\u51fb\u200b\u201c\u200b\u64cd\u4f5c\u200b\u201d\u200b\u4e2d\u200b\u7684\u200b\u201c\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u201d\uff09\uff0c\u200b\u83b7\u53d6\u200b\u673a\u5668\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\u7ed1\u5b9a\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u8bc1\u4e66\u200b\uff0c\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u4f7f\u7528\u200b\u8fd9\u79cd\u200b\u6fc0\u6d3b\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u5c06\u200b\u8bc1\u4e66\u200b\u5b58\u653e\u200b\u5728\u200b\u673a\u5668\u200b\u7684\u200b ${HOME}/.baidu/paddlex/licenses \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff08\u200b\u5982\u679c\u200b\u76ee\u5f55\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u521b\u5efa\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u5e8f\u5217\u53f7\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u5230\u200b\u552f\u4e00\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u4e14\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u4e00\u6b21\u200b\u3002\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u7528\u6237\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u673a\u5668\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b\u6bcf\u53f0\u200b\u673a\u5668\u200b\u51c6\u5907\u200b\u5355\u72ec\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002
"},{"location":"pipeline_deploy/high_performance_inference.html#13","title":"1.3 \u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5bf9\u4e8e\u200b Linux \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b Docker \u200b\u5bb9\u5668\u200b\u4e2d\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8bf7\u200b\u4e3a\u200b\u5bb9\u5668\u200b\u6302\u8f7d\u200b\u5bbf\u4e3b\u673a\u200b\u7684\u200b /dev/disk/by-uuid \u200b\u4e0e\u200b ${HOME}/.baidu/paddlex/licenses \u200b\u76ee\u5f55\u200b\u3002

\u200b\u5bf9\u4e8e\u200b PaddleX CLI\uff0c\u200b\u6307\u5b9a\u200b --use_hpip\uff0c\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u5e8f\u5217\u53f7\u200b\uff0c\u200b\u5373\u53ef\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002\u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u65f6\u200b\uff0c\u200b\u9700\u200b\u6307\u5b9a\u200b --update_license\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n\n# \u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\npaddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n    --update_license\n

\u200b\u5bf9\u4e8e\u200b PaddleX Python API\uff0c\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u65b9\u6cd5\u200b\u7c7b\u4f3c\u200b\u3002\u200b\u4ecd\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"image_classification\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": \"{\u200b\u5e8f\u5217\u53f7\u200b}\"},\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\n

\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5f97\u5230\u200b\u7684\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u672a\u200b\u542f\u7528\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u4e00\u81f4\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u9996\u6b21\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\uff0c\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u82b1\u8d39\u200b\u8f83\u957f\u65f6\u95f4\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u6784\u5efa\u200b\u3002PaddleX \u200b\u5c06\u200b\u5728\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u7b2c\u4e00\u6b21\u200b\u6784\u5efa\u200b\u5b8c\u6210\u200b\u540e\u200b\u5c06\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7f13\u5b58\u200b\u5728\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u540e\u7eed\u200b\u590d\u7528\u200b\u7f13\u5b58\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u4ee5\u200b\u63d0\u5347\u200b\u521d\u59cb\u5316\u200b\u901f\u5ea6\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#14","title":"1.4 \u200b\u4fee\u6539\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u914d\u7f6e","text":"

PaddleX \u200b\u7ed3\u5408\u200b\u6a21\u578b\u200b\u4fe1\u606f\u200b\u4e0e\u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\u4fe1\u606f\u200b\u4e3a\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u914d\u7f6e\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u9ed8\u8ba4\u200b\u914d\u7f6e\u200b\u7ecf\u8fc7\u200b\u7cbe\u5fc3\u200b\u51c6\u5907\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u5728\u200b\u6570\u4e2a\u200b\u5e38\u89c1\u200b\u573a\u666f\u200b\u4e2d\u200b\u53ef\u7528\u200b\uff0c\u200b\u4e14\u200b\u80fd\u591f\u200b\u53d6\u5f97\u200b\u8f83\u4f18\u200b\u7684\u200b\u6027\u80fd\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u901a\u5e38\u200b\u7528\u6237\u200b\u53ef\u80fd\u200b\u5e76\u200b\u4e0d\u7528\u200b\u5173\u5fc3\u200b\u5982\u4f55\u200b\u8fd9\u4e9b\u200b\u914d\u7f6e\u200b\u7684\u200b\u5177\u4f53\u200b\u7ec6\u8282\u200b\u3002\u200b\u7136\u800c\u200b\uff0c\u200b\u7531\u4e8e\u200b\u5b9e\u9645\u200b\u90e8\u7f72\u200b\u73af\u5883\u200b\u4e0e\u200b\u9700\u6c42\u200b\u7684\u200b\u591a\u6837\u6027\u200b\uff0c\u200b\u4f7f\u7528\u200b\u9ed8\u8ba4\u200b\u914d\u7f6e\u200b\u53ef\u80fd\u200b\u65e0\u6cd5\u200b\u5728\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u83b7\u53d6\u200b\u7406\u60f3\u200b\u7684\u200b\u6027\u80fd\u200b\uff0c\u200b\u751a\u81f3\u200b\u53ef\u80fd\u200b\u51fa\u73b0\u200b\u63a8\u7406\u200b\u5931\u8d25\u200b\u7684\u200b\u60c5\u51b5\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u9ed8\u8ba4\u200b\u914d\u7f6e\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\u7684\u200b\u60c5\u5f62\u200b\uff0c\u200b\u7528\u6237\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\u4e2d\u200b inference.yml \u200b\u6587\u4ef6\u200b\u4e2d\u200b Hpi \u200b\u5b57\u200b\u6bb5\u200b\uff08\u200b\u5982\u679c\u200b\u8be5\u5b57\u200b\u6bb5\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u65b0\u589e\u200b\uff09\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u624b\u52a8\u200b\u8c03\u6574\u200b\u914d\u7f6e\u200b\u3002\u200b\u4ee5\u4e0b\u200b\u5217\u4e3e\u200b\u4e24\u79cd\u200b\u5e38\u89c1\u200b\u7684\u200b\u60c5\u5f62\u200b\uff1a

  • \u200b\u66f4\u6362\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1a

    \u200b\u5f53\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u4e0d\u53ef\u200b\u7528\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u66f4\u6362\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u3002\u200b\u7528\u6237\u200b\u9700\u8981\u200b\u4fee\u6539\u200b selected_backends \u200b\u5b57\u200b\u6bb5\u200b\uff08\u200b\u5982\u679c\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u65b0\u589e\u200b\uff09\u3002

    Hpi:\n  ...\n  selected_backends:\n    cpu: paddle_infer\n    gpu: onnx_runtime\n  ...\n

    \u200b\u5176\u4e2d\u200b\u6bcf\u4e00\u9879\u200b\u5747\u200b\u6309\u7167\u200b {\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b}: {\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u540d\u79f0\u200b} \u200b\u7684\u200b\u683c\u5f0f\u200b\u586b\u5199\u200b\u3002

    \u200b\u76ee\u524d\u200b\u6240\u6709\u200b\u53ef\u9009\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u5982\u4e0b\u200b\uff1a

    • paddle_infer\uff1aPaddle Inference \u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u3002\u200b\u652f\u6301\u200b CPU \u200b\u548c\u200b GPU\u3002\u200b\u76f8\u6bd4\u200b PaddleX \u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u652f\u6301\u200b\u4ee5\u200b\u96c6\u6210\u200b TensorRT \u200b\u5b50\u56fe\u200b\u7684\u200b\u65b9\u5f0f\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b GPU \u200b\u63a8\u7406\u200b\u6027\u80fd\u200b\u3002
    • openvino\uff1aOpenVINO\uff0cIntel \u200b\u63d0\u4f9b\u200b\u7684\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u63a8\u7406\u200b\u5de5\u5177\u200b\uff0c\u200b\u4f18\u5316\u200b\u4e86\u200b\u591a\u79cd\u200b Intel \u200b\u786c\u4ef6\u200b\u4e0a\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u6027\u80fd\u200b\u3002\u200b\u4ec5\u200b\u652f\u6301\u200b CPU\u3002\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u81ea\u52a8\u200b\u5c06\u200b\u6a21\u578b\u200b\u8f6c\u6362\u200b\u4e3a\u200b ONNX \u200b\u683c\u5f0f\u200b\u540e\u7528\u200b\u8be5\u200b\u5f15\u64ce\u200b\u63a8\u7406\u200b\u3002
    • onnx_runtime\uff1aONNX Runtime\uff0c\u200b\u8de8\u5e73\u53f0\u200b\u3001\u200b\u9ad8\u6027\u80fd\u200b\u7684\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u3002\u200b\u652f\u6301\u200b CPU \u200b\u548c\u200b GPU\u3002\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u81ea\u52a8\u200b\u5c06\u200b\u6a21\u578b\u200b\u8f6c\u6362\u200b\u4e3a\u200b ONNX \u200b\u683c\u5f0f\u200b\u540e\u7528\u200b\u8be5\u200b\u5f15\u64ce\u200b\u63a8\u7406\u200b\u3002
    • tensorrt\uff1aTensorRT\uff0cNVIDIA \u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u63a8\u7406\u200b\u5e93\u200b\uff0c\u200b\u9488\u5bf9\u200b NVIDIA GPU \u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901f\u5ea6\u200b\u3002\u200b\u4ec5\u200b\u652f\u6301\u200b GPU\u3002\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u81ea\u52a8\u200b\u5c06\u200b\u6a21\u578b\u200b\u8f6c\u6362\u200b\u4e3a\u200b ONNX \u200b\u683c\u5f0f\u200b\u540e\u7528\u200b\u8be5\u200b\u5f15\u64ce\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u4fee\u6539\u200b Paddle Inference \u200b\u6216\u200b TensorRT \u200b\u7684\u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\u914d\u7f6e\u200b\uff1a

    \u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\u662f\u200b TensorRT \u200b\u5ef6\u8fdf\u200b\u6307\u5b9a\u200b\u90e8\u5206\u200b\u6216\u200b\u5168\u90e8\u200b\u5f20\u91cf\u200b\u7ef4\u5ea6\u200b\u76f4\u5230\u200b\u8fd0\u884c\u200b\u65f6\u200b\u7684\u200b\u80fd\u529b\u200b\u3002\u200b\u5f53\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\u914d\u7f6e\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u200b\u9700\u6c42\u200b\uff08\u200b\u4f8b\u5982\u200b\uff0c\u200b\u6a21\u578b\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u8303\u56f4\u200b\u5916\u200b\u7684\u200b\u8f93\u5165\u200b\u5f62\u72b6\u200b\uff09\uff0c\u200b\u7528\u6237\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u72b6\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u914d\u7f6e\u200b\u4e2d\u200b\u7684\u200b trt_dynamic_shapes \u200b\u6216\u200b dynamic_shapes \u200b\u5b57\u200b\u6bb5\u200b\uff1a

    Hpi:\n  ...\n  backend_configs:\n    # Paddle Inference \u200b\u540e\u200b\u7aef\u200b\u914d\u7f6e\u200b\n    paddle_infer:\n      ...\n      trt_dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n    # TensorRT \u200b\u540e\u200b\u7aef\u200b\u914d\u7f6e\u200b\n    tensorrt:\n      ...\n      dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n

    \u200b\u5728\u200b trt_dynamic_shapes \u200b\u6216\u200b dynamic_shapes \u200b\u4e2d\u200b\uff0c\u200b\u9700\u8981\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u8f93\u5165\u200b\u5f20\u91cf\u200b\u6307\u5b9a\u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\uff0c\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a{\u200b\u8f93\u5165\u200b\u5f20\u91cf\u200b\u540d\u79f0\u200b}: [{\u200b\u6700\u5c0f\u200b\u5f62\u72b6\u200b}, [{\u200b\u6700\u4f18\u200b\u5f62\u72b6\u200b}], [{\u200b\u6700\u5927\u200b\u5f62\u72b6\u200b}]]\u3002\u200b\u6709\u5173\u200b\u6700\u5c0f\u200b\u5f62\u72b6\u200b\u3001\u200b\u6700\u4f18\u200b\u5f62\u72b6\u200b\u4ee5\u53ca\u200b\u6700\u5927\u200b\u5f62\u72b6\u200b\u7684\u200b\u76f8\u5173\u200b\u4ecb\u7ecd\u200b\u53ca\u200b\u66f4\u200b\u591a\u200b\u7ec6\u8282\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b TensorRT \u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u3002

    \u200b\u5728\u200b\u5b8c\u6210\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u8bf7\u200b\u5220\u9664\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u7684\u200b\u7f13\u5b58\u200b\u6587\u4ef6\u200b\uff08shape_range_info.pbtxt \u200b\u4e0e\u200b trt_serialized \u200b\u5f00\u5934\u200b\u7684\u200b\u6587\u4ef6\u200b\uff09\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#2","title":"2\u3001\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e0e\u200b\u6a21\u578b","text":"\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u2705 \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u2705 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b FasterRCNN-Swin-Tiny-FPN \u274cCenterNet-DLA-34 \u274c CenterNet-ResNet50 \u274c \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b Mask-RT-DETR-S \u274c \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u2705 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u2705 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u274c \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u9884\u6d4b\u200b \u274c \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u274c \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u2705 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u2705 \u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u274c \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u2705 \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u2705 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u274c \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u274c \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b \u2705 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b \u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b \u2705 \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b \u274c \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u274c \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b \u274c \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u274c \u200b\u4eba\u8138\u8bc6\u522b\u200b \u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b \u2705"},{"location":"pipeline_deploy/service_deploy.html","title":"PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357","text":"

\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u3002\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u9996\u5148\u200b\u4ecb\u7ecd\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u7684\u200b\u57fa\u672c\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u7136\u540e\u200b\u4ecb\u7ecd\u200b\u5c06\u200b\u670d\u52a1\u200b\u7528\u4e8e\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u65f6\u200b\u7684\u200b\u6ce8\u610f\u4e8b\u9879\u200b\u4ee5\u53ca\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u6267\u884c\u200b\u7684\u200b\u64cd\u4f5c\u200b\u3002

\u200b\u6ce8\u610f\u200b - \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d0\u4f9b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u5177\u4f53\u200b\u5230\u200b\u67d0\u4e2a\u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b\u3002

\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u793a\u4f8b\u200b\u56fe\u200b\uff1a

"},{"location":"pipeline_deploy/service_deploy.html#1","title":"1\u3001\u200b\u57fa\u672c\u200b\u6d41\u7a0b","text":""},{"location":"pipeline_deploy/service_deploy.html#11","title":"1.1 \u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6","text":"

\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6\u200b\uff1a

paddlex --install serving\n
"},{"location":"pipeline_deploy/service_deploy.html#12","title":"1.2 \u200b\u542f\u52a8\u200b\u670d\u52a1","text":"

\u200b\u901a\u8fc7\u200b PaddleX CLI \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\uff0c\u200b\u6307\u4ee4\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a

paddlex --serve --pipeline {\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b} [{\u200b\u5176\u4ed6\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b}]\n

\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --serve --pipeline image_classifcation\n

\u200b\u670d\u52a1\u200b\u542f\u52a8\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u7c7b\u4f3c\u200b\u4ee5\u4e0b\u200b\u5c55\u793a\u200b\u7684\u200b\u4fe1\u606f\u200b\uff1a

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline\u200b\u53ef\u200b\u6307\u5b9a\u200b\u4e3a\u200b\u5b98\u65b9\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u200b\u672c\u5730\u4ea7\u200b\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002PaddleX \u200b\u4ee5\u6b64\u200b\u6784\u5efa\u200b\u4ea7\u7ebf\u200b\u5e76\u200b\u90e8\u7f72\u200b\u4e3a\u200b\u670d\u52a1\u200b\u3002\u200b\u5982\u9700\u200b\u8c03\u6574\u200b\u914d\u7f6e\u200b\uff08\u200b\u5982\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u3001batch_size\u3001\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u7b49\u200b\uff09\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b \u201c\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b \u200b\u90e8\u5206\u200b\u3002

\u200b\u4e0e\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u76f8\u5173\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u8bf4\u660e\u200b --pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002 --device \u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b cpu\uff08\u200b\u5982\u200b GPU \u200b\u4e0d\u53ef\u200b\u7528\u200b\uff09\u200b\u6216\u200b gpu\uff08\u200b\u5982\u200b GPU \u200b\u53ef\u7528\u200b\uff09\u3002 --host \u200b\u670d\u52a1\u5668\u200b\u7ed1\u5b9a\u200b\u7684\u200b\u4e3b\u673a\u540d\u200b\u6216\u200b IP \u200b\u5730\u5740\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b0.0.0.0\u3002 --port \u200b\u670d\u52a1\u5668\u200b\u76d1\u542c\u200b\u7684\u200b\u7aef\u53e3\u53f7\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b8080\u3002 --use_hpip \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002 --serial_number \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4f7f\u7528\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5e76\u975e\u200b\u6240\u6709\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6a21\u578b\u200b\u90fd\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002 --update_license \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002"},{"location":"pipeline_deploy/service_deploy.html#13","title":"1.3 \u200b\u8c03\u7528\u200b\u670d\u52a1","text":"

\u200b\u8bf7\u200b\u53c2\u8003\u200b\u5404\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b \u201c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u201d \u200b\u90e8\u5206\u200b\u3002\u200b\u5728\u200b\u6b64\u5904\u200b\u53ef\u4ee5\u200b\u627e\u5230\u200b\u5404\u4ea7\u7ebf\u200b\u7684\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"pipeline_deploy/service_deploy.html#2","title":"2\u3001\u200b\u5c06\u200b\u670d\u52a1\u200b\u7528\u4e8e\u200b\u751f\u4ea7","text":"

\u200b\u5c06\u200b\u670d\u52a1\u200b\u5e94\u7528\u200b\u4e8e\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u65f6\u200b\uff0c\u200b\u670d\u52a1\u200b\u7684\u200b\u7a33\u5b9a\u6027\u200b\u3001\u200b\u9ad8\u6548\u6027\u200b\u4e0e\u200b\u5b89\u5168\u6027\u200b\u5c24\u4e3a\u91cd\u8981\u200b\u3002\u200b\u4ee5\u4e0b\u200b\u662f\u200b\u4e00\u4e9b\u200b\u9488\u5bf9\u200b\u5c06\u200b\u670d\u52a1\u200b\u7528\u4e8e\u200b\u751f\u4ea7\u200b\u7684\u200b\u5efa\u8bae\u200b\u3002

"},{"location":"pipeline_deploy/service_deploy.html#21-paddlex","title":"2.1 \u200b\u4f7f\u7528\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u54cd\u5e94\u200b\u65f6\u95f4\u200b\u8981\u6c42\u200b\u8f83\u200b\u4e25\u683c\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u52a0\u901f\u200b\uff0c\u200b\u4ece\u800c\u200b\u964d\u4f4e\u200b\u54cd\u5e94\u200b\u65f6\u95f4\u200b\u3001\u200b\u63d0\u5347\u200b\u541e\u5410\u91cf\u200b\u3002

\u200b\u4f7f\u7528\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u4e2d\u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3001\u200b\u83b7\u53d6\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u6fc0\u6d3b\u200b\u90e8\u5206\u200b\u5b8c\u6210\u200b\u63d2\u4ef6\u200b\u7684\u200b\u5b89\u88c5\u200b\u4e0e\u200b\u5e8f\u5217\u53f7\u200b\u7684\u200b\u7533\u8bf7\u200b\u3002\u200b\u540c\u65f6\u200b\uff0c\u200b\u4e0d\u662f\u200b\u6240\u6709\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6a21\u578b\u200b\u548c\u200b\u73af\u5883\u200b\u90fd\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u7684\u200b\u8be6\u7ec6\u60c5\u51b5\u200b\u8bf7\u200b\u53c2\u8003\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e0e\u200b\u6a21\u578b\u200b\u90e8\u5206\u200b\u3002

\u200b\u5728\u200b\u542f\u52a8\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u65f6\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u6307\u5b9a\u200b --use_hpip \u200b\u53ca\u200b\u5e8f\u5217\u53f7\u200b\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002\u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b \u200b\u9700\u200b\u6307\u5b9a\u200b --update_license\u3002\u200b\u4f7f\u7528\u200b\u793a\u4f8b\u200b\uff1a

paddlex --serve --pipeline image_classfication --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n\n# \u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\npaddlex --serve --pipeline image_classfication --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license\n
"},{"location":"pipeline_deploy/service_deploy.html#22","title":"2.2 \u200b\u8003\u8651\u200b\u5b89\u5168\u6027","text":"

\u200b\u4e00\u4e2a\u200b\u5178\u578b\u200b\u7684\u200b\u573a\u666f\u200b\u662f\u200b\uff0c\u200b\u5e94\u7528\u200b\u63a5\u53d7\u200b\u6765\u81ea\u200b\u7f51\u7edc\u200b\u7684\u200b\u8f93\u5165\u200b\uff0cPaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u4f5c\u4e3a\u200b\u5e94\u7528\u200b\u4e2d\u200b\u7684\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u901a\u8fc7\u200b API \u200b\u4e0e\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\u4ea4\u4e92\u200b\u3002\u200b\u6b64\u65f6\u200b\uff0cPaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u5728\u200b\u5e94\u7528\u200b\u4e2d\u6240\u5904\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u5c24\u4e3a\u91cd\u8981\u200b\u3002PaddleX \u200b\u63d0\u4f9b\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b\u4e13\u6ce8\u200b\u4e8e\u200b\u63d0\u4f9b\u200b\u9ad8\u6548\u6027\u200b\u548c\u200b\u6613\u7528\u6027\u200b\uff0c\u200b\u4f46\u200b\u672a\u200b\u5bf9\u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u8db3\u591f\u200b\u7684\u200b\u5b89\u5168\u68c0\u67e5\u200b\u3002\u200b\u6765\u81ea\u200b\u7f51\u7edc\u200b\u7684\u200b\u6076\u610f\u200b\u8bf7\u6c42\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8d85\u5927\u200b\u5c3a\u5bf8\u200b\u7684\u200b\u56fe\u50cf\u200b\u6216\u200b\u7cbe\u5fc3\u200b\u6784\u9020\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u90fd\u200b\u53ef\u80fd\u200b\u5bfc\u81f4\u200b\u670d\u52a1\u200b\u5d29\u6e83\u200b\u7b49\u200b\u4e25\u91cd\u540e\u679c\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5c06\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u653e\u7f6e\u200b\u4e8e\u200b\u5e94\u7528\u200b\u5185\u90e8\u200b\uff0c\u200b\u4e0d\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u5916\u90e8\u200b\u8f93\u5165\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5176\u200b\u53ea\u200b\u5904\u7406\u200b\u53ef\u4fe1\u8d56\u200b\u7684\u200b\u8bf7\u6c42\u200b\u3002\u200b\u5728\u200b\u5e94\u7528\u200b\u7684\u200b\u5916\u5c42\u200b\uff0c\u200b\u9700\u8981\u200b\u6dfb\u52a0\u200b\u5408\u9002\u200b\u7684\u200b\u9632\u62a4\u200b\u63aa\u65bd\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8f93\u5165\u200b\u9a8c\u8bc1\u200b\u3001\u200b\u8eab\u4efd\u9a8c\u8bc1\u200b\u7b49\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6982\u89c8","text":"

\u200b\u82e5\u200b\u60a8\u200b\u5df2\u7ecf\u200b\u4f53\u9a8c\u200b\u8fc7\u200bPaddleX\u200b\u4e2d\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u5e0c\u671b\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u8df3\u8f6c\u200b\u5230\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b

\u200b\u5b8c\u6574\u200b\u7684\u200bPaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

PaddleX \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u56fe\u200b

graph LR\n    select_pipeline(\u200b\u9009\u62e9\u200b\u4ea7\u7ebf\u200b) --> online_experience[\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b]\n    online_experience --> online_ok{\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff1f}\n    online_ok --\u200b\u4e0d\u200b\u6ee1\u610f\u200b--> select_model[\u200b\u9009\u62e9\u200b\u6a21\u578b\u200b]\n    select_model --> model_finetune[\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b]\n    online_ok --\u200b\u6ee1\u610f\u200b--> development_integration(\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b)\n    model_finetune --> pipeline_test[\u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5\u200b]\n    pipeline_test --> test_ok{\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff1f}\n    test_ok --\u200b\u4e0d\u200b\u6ee1\u610f\u200b--> select_model\n    test_ok --\u200b\u6ee1\u610f\u200b--> development_integration

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5c06\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff0c\u200b\u76f4\u5230\u200b\u8fbe\u5230\u200b\u6ee1\u610f\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u4e0b\u9762\u200b\uff0c\u200b\u8ba9\u200b\u6211\u4eec\u200b\u4ee5\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4ecb\u7ecd\u200bPaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u8fc7\u7a0b\u200b\u3002 \u200b\u5728\u200b\u4f7f\u7528\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#1","title":"1\u3001\u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

PaddleX\u200b\u4e2d\u200b\u6bcf\u200b\u6761\u4ea7\u7ebf\u200b\u90fd\u200b\u53ef\u4ee5\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\u7684\u200b\u95ee\u9898\u200b\u5982\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7b49\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u9009\u62e9\u200b\u540e\u7eed\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u4f8b\u5982\u200b\u6b64\u5904\u200b\u4e3a\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u66f4\u200b\u591a\u4efb\u52a1\u200b\u4e0e\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)\u200b\u67e5\u8be2\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#2","title":"2\u3001\u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX\u200b\u7684\u200b\u6bcf\u200b\u6761\u4ea7\u7ebf\u200b\u90fd\u200b\u96c6\u6210\u200b\u4e86\u200b\u4f17\u591a\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5148\u200b\u4f53\u9a8c\u200bPaddleX\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u5982\u679c\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u7b26\u5408\u200b\u60a8\u200b\u7684\u200b\u9884\u671f\u200b\uff0c\u200b\u5373\u53ef\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u7b26\u5408\u200b\uff0c\u200b\u518d\u200b\u6839\u636e\u200b\u540e\u7eed\u200b\u6b65\u9aa4\u200b\u5bf9\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\u3002

PaddleX\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e09\u79cd\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u4f53\u9a8c\u200b\uff1a

  • \u200b\u5728\u7ebf\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b\uff1aPaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)
  • \u200b\u547d\u4ee4\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1aPaddleX\u200b\u4ea7\u7ebf\u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b
  • Python\u200b\u811a\u672c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1aPaddleX\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b

\u200b\u4ee5\u200b\u5b9e\u73b0\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u7528\u200b\u4e09\u79cd\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff1a

\ud83c\udf10 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200bAI Studio\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\ud83d\udcbb \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c\u200b

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b,\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200bOCR\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u53f7\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u53f7\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n
\ud83d\udc49\u200b\u70b9\u51fb\u200b\u67e5\u770b\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_ocr_002.png', 'dt_polys': [array([[ 6, 13],\n       [64, 13],\n       [64, 31],\n       [ 6, 31]], dtype=int16), array([[210,  14],\n       [238,  14],\n        ......\n       [830, 445],\n       [830, 464],\n       [338, 473]], dtype=int16)], 'dt_scores': [0.7629529090100092, 0.7717284653547034, 0.7139251666762622, 0.8057611181556994, 0.8840947658872964, 0.793295938183885, 0.8342027855884783, 0.8081378522874861, 0.8436969344212185, 0.8500845646497226, 0.7932189714842249, 0.8875924621248228, 0.8827884273639948, 0.8322404317386042, 0.8614796803023563, 0.8804252994596097, 0.9069978945305474, 0.8383917914190059, 0.8495824076580516, 0.8825556800041383, 0.852788927706737, 0.8379584696974435, 0.8633519228646618, 0.763234473595298, 0.8602154244410916, 0.9206341882426813, 0.6341425973804049, 0.8490156149797171, 0.758314821564747, 0.8757849788793592, 0.772485060565334, 0.8404023012596349, 0.8190037953773427, 0.851908529295617, 0.6126112758079643, 0.7324388418218587], 'rec_text': ['www.9', '5', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', '', 'CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO', '\u200b\u5ea7\u4f4d\u53f7\u200b', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200b DATE', '03DEC', 'W', '035', 'MU 2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200b', 'GATES CLOSE 1O MINUTESBEFOREDEPARTURE TIME'], 'rec_score': [0.683099627494812, 0.23417049646377563, 0.9969978928565979, 0.9945957660675049, 0.9787729382514954, 0.9983421564102173, 0.0, 0.9896272420883179, 0.9927973747253418, 0.9976049065589905, 0.9330753684043884, 0.9562691450119019, 0.9312669038772583, 0.9749765396118164, 0.9749416708946228, 0.9988260865211487, 0.9319792985916138, 0.9979889988899231, 0.9956836700439453, 0.9991750717163086, 0.9938803315162659, 0.9982991218566895, 0.9701204299926758, 0.9986245632171631, 0.9888408780097961, 0.9793729782104492, 0.9952947497367859, 0.9945247173309326, 0.9919753670692444, 0.991995632648468, 0.9937331080436707, 0.9963390827178955, 0.9954304695129395, 0.9934715628623962, 0.9974429607391357, 0.9529641270637512]}\n

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200bOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6309\u7167\u200b\u4e0b\u9762\u200b\u7684\u200b\u6b65\u9aa4\u200b\u8fdb\u884c\u200b\u64cd\u4f5c\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b

\u200b\u83b7\u53d6\u200bOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff1a

paddlex --get_pipeline_config OCR\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0cOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path\uff09\uff1a

paddlex --get_pipeline_config OCR --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ocr.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ocr.yaml --input general_ocr_002.png\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\ud83d\udcbbPython\u200b\u811a\u672c\u200b\u4f53\u9a8c\u200b

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

  • create_pipeline() \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b
  • \u200b\u4f20\u5165\u200b\u56fe\u7247\u200b\u5e76\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b
  • \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b

\u2757 Python\u200b\u811a\u672c\u200b\u8fd0\u884c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5982\u679c\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u7b26\u5408\u200b\u60a8\u200b\u7684\u200b\u9884\u671f\u200b\uff0c\u200b\u5373\u53ef\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u7b26\u5408\u200b\uff0c\u200b\u518d\u200b\u6839\u636e\u200b\u540e\u7eed\u200b\u6b65\u9aa4\u200b\u5bf9\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#3","title":"3\u3001\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u7531\u4e8e\u200b\u4e00\u4e2a\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u53ef\u80fd\u200b\u5305\u542b\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff0c\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u65f6\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6d4b\u8bd5\u200b\u7684\u200b\u60c5\u51b5\u200b\u786e\u5b9a\u200b\u5fae\u8c03\u200b\u5176\u4e2d\u200b\u7684\u200b\u54ea\u4e2a\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u4ee5\u200b\u6b64\u5904\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u7684\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u8be5\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200b PP-OCRv4_mobile_det\uff09\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200b PP-OCRv4_mobile_rec\uff09\uff0c\u200b\u5982\u200b\u53d1\u73b0\u200b\u6587\u5b57\u200b\u7684\u200b\u5b9a\u4f4d\u200b\u4e0d\u51c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u679c\u200b\u53d1\u73b0\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b\u4e0d\u51c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4e0d\u200b\u6e05\u695a\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#4","title":"4\u3001\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u786e\u5b9a\u200b\u597d\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u7684\u200b\u6a21\u578b\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5bf9\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08 PP-OCRv4_mobile_rec\uff09\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=your/dataset_dir\n
\u200b\u6b64\u5916\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u4e2d\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u51c6\u5907\u200b\u3001\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u7b49\u200b\u5185\u5bb9\u200b\uff0cPaddleX\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6559\u7a0b\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

"},{"location":"pipeline_usage/pipeline_develop_guide.html#5","title":"5\u3001\u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  det_model: PP-OCRv4_server_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5373\u53ef\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5373\u53ef\u200b\u56de\u5230\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u5c1d\u8bd5\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\u5176\u4ed6\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u76f4\u5230\u200b\u8fbe\u5230\u200b\u6ee1\u610f\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#6","title":"6\u3001\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u53ca\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200bPython\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

\u2757 PaddleX\u200b\u4e3a\u200b\u6bcf\u4e2a\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u8be6\u7ec6\u200b\u7684\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u8fdb\u884c\u200b\u9009\u62e9\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u7684\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200bOCR \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b"},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200bCLI\u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528\u200b\u8bf4\u660e","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200bCLI\u200b\u547d\u4ee4\u884c\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html#_1","title":"\u4e00\u200b\u3001\u200b\u4f7f\u7528\u200b\u793a\u4f8b","text":""},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html#1","title":"1. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

paddlex --pipeline image_classification \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --device gpu:0 \\\n        --save_path ./output/\n
\u200b\u53ea\u200b\u9700\u200b\u4e00\u6b65\u200b\u5c31\u200b\u80fd\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • pipeline\uff1a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u540d\u200b\u201cimage_classification\u201d\uff0c\u200b\u6216\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u201cpath/to/image_classification.yaml\u201d\uff1b
  • input\uff1a\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u652f\u6301\u200b\u672c\u5730\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3001\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\u3001\u200b\u6587\u4ef6\u200bURL\u200b\u94fe\u63a5\u200b\uff1b
  • device\uff1a\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff0c\u200b\u5982\u4e3a\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u53ef\u4ee5\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u201ccpu\u201d\u3001\u201cgpu:2\u201d\uff0c\u200b\u5f53\u200b\u4e0d\u200b\u4f20\u5165\u200b\u65f6\u200b\uff0c\u200b\u5982\u200b\u6709\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u4f7f\u7528\u200bGPU\uff0c\u200b\u5426\u5219\u200b\u4f7f\u7528\u200bCPU\uff1b
  • save_path\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u4e0d\u200b\u4f20\u5165\u200b\u65f6\u200b\uff0c\u200b\u5219\u200b\u4e0d\u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html#2","title":"2. \u200b\u81ea\u5b9a\u4e49\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e","text":"

\u200b\u5982\u9700\u200b\u5bf9\u4ea7\u7ebf\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\uff0c\u200b\u53ef\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\uff0c\u200b\u4ecd\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

paddlex --get_pipeline_config image_classification\n\n# Please enter the path that you want to save the pipeline config file: (default `./`)\n./configs/\n\n# The pipeline config has been saved to: configs/image_classification.yaml\n

\u200b\u7136\u540e\u200b\u53ef\u200b\u4fee\u6539\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200bconfigs/image_classification.yaml\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

Global:\n  pipeline_name: image_classification\n  input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\n\nPipeline:\n  model: PP-LCNet_x0_5\n  batch_size: 1\n  device: \"gpu:0\"\n

\u200b\u5728\u200b\u4fee\u6539\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8be5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

paddlex --pipeline configs/image_classification.yaml \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --save_path ./output/\n\n# {'input_path': '/root/.paddlex/predict_input/general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': array([0.62817, 0.03729, 0.03262, 0.03247, 0.03196]), 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200bPython\u200b\u811a\u672c\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_1","title":"\u4e00\u200b\u3001\u200b\u4f7f\u7528\u200b\u793a\u4f8b","text":"

\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(\"image_classification\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e09\u6b65\u200b\uff1a

  • \u200b\u8c03\u7528\u200bcreate_pipeline()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u8c03\u7528\u200bprint()\u3001save_to_xxx()\u200b\u7b49\u200b\u76f8\u5173\u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316\u200b\u6216\u662f\u200b\u4fdd\u5b58\u200b\u3002
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#api","title":"\u4e8c\u200b\u3001API\u200b\u8bf4\u660e","text":""},{"location":"pipeline_usage/instructions/pipeline_python_API.html#1-create_pipeline","title":"1. \u200b\u8c03\u7528\u200bcreate_pipeline()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61","text":"
  • create_pipeline\uff1a\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • pipeline_name\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u4ea7\u7ebf\u200b\u540d\u200b\u6216\u662f\u200b\u672c\u5730\u4ea7\u200b\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u201cimage_classification\u201d\u3001\u201c/path/to/image_classification.yaml\u201d\uff1b
    • device\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff0c\u200b\u5982\u4e3a\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u53ef\u4ee5\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u201ccpu\u201d\u3001\u201cgpu:2\u201d\uff1b
    • pp_option\uff1aPaddlePredictorOption \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aBasePredictor\u200b\u7c7b\u578b\u200b\u3002
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#2-predict","title":"2. \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b","text":"
  • predict\uff1a\u200b\u4f7f\u7528\u200b\u5b9a\u4e49\u200b\u7684\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5bf9\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • input\uff1a\u200b\u4efb\u610f\u200b\u7c7b\u578b\u200b\uff0c\u200b\u652f\u6301\u200bstr\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6216\u662f\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6587\u4ef6\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u6216\u662f\u200b\u7f51\u7edc\u200bURL\uff1b\u200b\u5bf9\u4e8e\u200bCV\u200b\u4efb\u52a1\u200b\uff0c\u200b\u652f\u6301\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\uff1b\u200b\u5bf9\u4e8e\u200bTS\u200b\u4efb\u52a1\u200b\uff0c\u200b\u652f\u6301\u200bpandas.DataFrame\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff1b\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6240\u200b\u6784\u6210\u200b\u7684\u200blist\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1agenerator\uff0c\u200b\u6bcf\u6b21\u200b\u8c03\u7528\u200b\u8fd4\u56de\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#3","title":"3. \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316","text":"

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u652f\u6301\u200b\u8bbf\u95ee\u200b\u3001\u200b\u53ef\u89c6\u5316\u200b\u53ca\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u76f8\u5e94\u200b\u7684\u200b\u5c5e\u6027\u200b\u6216\u200b\u65b9\u6cd5\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_2","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • str\uff1astr \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bstr\u200b\u8868\u793a\u200b\uff1b
  • json\uff1ajson\u200b\u683c\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1adict \u200b\u7c7b\u578b\u200b\uff1b
  • img\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u56fe\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aPIL.Image \u200b\u7c7b\u578b\u200b\uff1b
  • html\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bHTML\u200b\u8868\u793a\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_3","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • print()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8f93\u51fa\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e0d\u200b\u4fbf\u4e8e\u200b\u76f4\u63a5\u200b\u8f93\u51fa\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u7701\u7565\u200b\u76f8\u5173\u200b\u5185\u5bb9\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • json_format\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4f7f\u7528\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u8f93\u51fa\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_json()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5305\u542b\u200b\u65e0\u6cd5\u200bjson\u200b\u5e8f\u5217\u5316\u200b\u7684\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u8fdb\u884c\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4ee5\u200b\u5b9e\u73b0\u200b\u5e8f\u5217\u5316\u200b\u4fdd\u5b58\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_img()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_csv()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bCSV\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_html()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bHTML\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_xlsx()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bXLSX\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#4","title":"4. \u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e","text":"

PaddleX \u200b\u652f\u6301\u200b\u901a\u8fc7\u200bPaddlePredictorOption\u200b\u8bbe\u7f6e\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u76f8\u5173\u200bAPI\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_4","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • deivce\uff1a\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u53ca\u200b\u5361\u53f7\u200b\uff0c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'gpu', 'cpu', 'npu', 'xpu', 'mlu'\uff0c\u200b\u5f53\u200b\u4f7f\u7528\u200b\u52a0\u901f\u5361\u200b\u65f6\u200b\uff0c\u200b\u652f\u6301\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u4f7f\u7528\u200b 0 \u200b\u53f7\u200b gpu\uff1a'gpu:0'\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'gpu:0'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002
  • run_mode\uff1a\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'paddle'\uff0c'trt_fp32'\uff0c'trt_fp16'\uff0c'trt_int8'\uff0c'mkldnn'\uff0c'mkldnn_bf16'\uff0c\u200b\u5176\u4e2d\u200b 'mkldnn' \u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u53ef\u9009\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'paddle'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u3002
  • cpu_threads\uff1acpu \u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b int \u200b\u7c7b\u578b\u200b\uff0ccpu \u200b\u63a8\u7406\u200b\u65f6\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aint \u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\u3002
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_5","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • get_support_run_mode\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\u3002
  • get_support_device\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3002
  • get_device\uff1a\u200b\u83b7\u53d6\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\u3002
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html","title":"\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#1","title":"1. \u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u65e8\u5728\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u548c\u200b\u6bd4\u8f83\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u4e2a\u4eba\u8eab\u4efd\u200b\u7684\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u3002\u200b\u8be5\u200b\u4efb\u52a1\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u68c0\u6d4b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u4eba\u8138\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u5bf9\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7279\u5f81\u63d0\u53d6\u200b\u548c\u200b\u5339\u914d\u200b\uff0c\u200b\u4ece\u800c\u200b\u5728\u200b\u6570\u636e\u5e93\u200b\u4e2d\u200b\u627e\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u8eab\u4efd\u200b\u4fe1\u606f\u200b\u3002\u200b\u4eba\u8138\u8bc6\u522b\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5b89\u5168\u200b\u8ba4\u8bc1\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u3001\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u548c\u200b\u667a\u80fd\u200b\u8bbe\u5907\u200b\u7b49\u200b\u573a\u666f\u200b\u3002

\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u4e13\u6ce8\u200b\u4e8e\u200b\u89e3\u51b3\u200b\u4eba\u8138\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4ece\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5feb\u901f\u200b\u51c6\u786e\u200b\u5730\u200b\u5b9a\u4f4d\u200b\u4eba\u8138\u200b\u533a\u57df\u200b\u3001\u200b\u63d0\u53d6\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u4e0e\u200b\u7279\u5f81\u200b\u5e93\u4e2d\u200b\u9884\u5148\u200b\u5efa\u7acb\u200b\u7684\u200b\u7279\u5f81\u200b\u505a\u200b\u68c0\u7d22\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u4ece\u800c\u200b\u786e\u8ba4\u200b\u8eab\u4efd\u200b\u4fe1\u606f\u200b\u3002

\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AP (%)Easy/Medium/Hard GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b BlazeFace\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.7/73.4/49.5 0.447 \u200b\u8f7b\u91cf\u200b\u9ad8\u6548\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b BlazeFace-FPN-SSH\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.2/80.5/60.5 0.606 BlazeFace\u200b\u7684\u200b\u6539\u8fdb\u200b\u6a21\u578b\u200b\uff0c\u200b\u589e\u52a0\u200bFPN\u200b\u548c\u200bSSH\u200b\u7ed3\u6784\u200b PicoDet_LCNet_x2_5_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.7/90.7/68.1 28.9 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.9/91.8/79.8 26.5 \u200b\u57fa\u4e8e\u200bPP-YOLOE_plus-S\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5728\u200bWIDER-FACE\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\uff0c\u200b\u4ee5\u200b640 *640\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u5c3a\u5bf8\u200b\u8bc4\u4f30\u200b\u5f97\u5230\u200b\u7684\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8f93\u51fa\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b Acc (%)AgeDB-30/CFP-FP/LFW GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b MobileFaceNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 128 96.28/96.71/99.58 4.1 \u200b\u57fa\u4e8e\u200bMobileFaceNet\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b ResNet50_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 512 98.12/98.56/99.77 87.2 \u200b\u57fa\u4e8e\u200bResNet50\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5206\u522b\u200b\u5728\u200b AgeDB-30\u3001CFP-FP \u200b\u548c\u200b LFW \u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u6d4b\u5f97\u200b\u7684\u200b Accuracy\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u2757 \u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u547d\u4ee4\u884c\u200b\u4f53\u9a8c\u200b

\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5185\u7f6e\u200b\u7684\u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config face_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b./my_path\uff09\uff1a

paddlex --get_pipeline_config face_recognition --save_path ./my_path\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u8bf7\u200b\u4e0b\u8f7d\u200b\u6d4b\u8bd5\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\u3002 \u200b\u5728\u200b\u8be5\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8fd0\u884c\u200b\u793a\u4f8b\u200b\u4e2d\u200b\u9700\u8981\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u4e0b\u8f7d\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200bdemo\u200b\u6570\u636e\u200b\u7528\u6765\u200b\u540e\u7eed\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_demo_gallery.tar\ntar -xf ./face_demo_gallery.tar\n

\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5efa\u7acb\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u3002\u200b\u4e4b\u540e\u200b\u901a\u8fc7\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u5efa\u7acb\u200b\u548c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\", index_dir=\"face_gallery_index\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b \u200b\u4eba\u8138\u8bc6\u522b\u200b \u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b index_dir \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u68c0\u7d22\u200b\u5e93\u200b\u6587\u4ef6\u200b\u6240\u5728\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5728\u200bpredict()\u200b\u4e2d\u200b\u6307\u5b9a\u200bindex_dir\u3002 str None device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b build_index \u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u4e3a\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b data_root \u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b index_dir \u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u3002\u200b\u6210\u529f\u200b\u8c03\u7528\u200bbuild_index\u200b\u65b9\u6cd5\u200b\u540e\u4f1a\u200b\u5728\u200b\u6539\u200b\u8def\u5f84\u200b\u4e0b\u200b\u751f\u6210\u200b\u4e24\u4e2a\u200b\u6587\u4ef6\u200b\uff1a \"id_map.pkl\" \u200b\u4fdd\u5b58\u200b\u4e86\u200b\u56fe\u50cf\u200bID\u200b\u4e0e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\u4e4b\u95f4\u200b\u7684\u200b\u6620\u5c04\u200b\u5173\u7cfb\u200b\uff1b \u201cvector.index\u201d\u200b\u5b58\u50a8\u200b\u4e86\u200b\u6bcf\u5f20\u200b\u56fe\u50cf\u200b\u7684\u200b\u7279\u5f81\u5411\u91cf\u200b str \u200b\u65e0\u200b

\uff083\uff09\u200b\u8c03\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200binput\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\u200b\u53e6\u5916\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u652f\u6301\u200b\u53c2\u6570\u200bindex_dir\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u68c0\u7d22\u200b\u5e93\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b index_dir \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u68c0\u7d22\u200b\u5e93\u200b\u6587\u4ef6\u200b\u6240\u5728\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5728\u200bcreate_pipeline()\u200b\u4e2d\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200bindex_dir\u200b\u6307\u5b9a\u200b\u7684\u200b\u68c0\u7d22\u200b\u5e93\u200b\u3002

\uff084\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u3002

\uff085\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/face_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/face_recognition.yaml\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#223","title":"2.2.3 \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6dfb\u52a0\u200b\u548c\u200b\u5220\u9664\u200b\u64cd\u4f5c","text":"

\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u5c06\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u6dfb\u52a0\u200b\u5230\u200b\u7279\u5f81\u200b\u5e93\u4e2d\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b append_index \u200b\u65b9\u6cd5\u200b\uff1b\u200b\u5220\u9664\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b remove_index \u200b\u65b9\u6cd5\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\npipeline.buile_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\", index_type=\"IVF\")\npipeline.append_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\", index_type=\"IVF\")\npipeline.remove_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\", index_type=\"IVF\")\n

\u200b\u4e0a\u8ff0\u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b data_root \u200b\u8981\u200b\u6dfb\u52a0\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6839\u76ee\u5f55\u200b\u3002\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u4e0e\u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u65f6\u200b\u76f8\u540c\u200b\uff0c\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b index_dir \u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u5b58\u50a8\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5728\u200b append_index \u200b\u548c\u200b remove_index \u200b\u4e2d\u200b\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u662f\u200b\u88ab\u200b\u4fee\u6539\u200b\uff08\u200b\u6216\u200b\u5220\u9664\u200b\uff09\u200b\u7684\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u8def\u5f84\u200b\uff0c str \u200b\u65e0\u200b index_type \u200b\u652f\u6301\u200b HNSW32\u3001IVF\u3001Flat\u3002\u200b\u5176\u4e2d\u200b\uff0cHNSW32 \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u4e14\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u4f46\u200b\u4e0d\u200b\u652f\u6301\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bIVF \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u4f46\u200b\u7cbe\u5ea6\u200b\u76f8\u5bf9\u200b\u8f83\u200b\u4f4e\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bFlat \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u4f4e\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\u3002 str HNSW32 metric_type \u200b\u652f\u6301\u200b\uff1aIP\uff0c\u200b\u5185\u79ef\u200b\uff08Inner Product\uff09\uff1bL2\uff0c\u200b\u6b27\u51e0\u91cc\u5f97\u200b\u8ddd\u79bb\u200b\uff08Euclidean Distance\uff09\u3002 str IP"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#23","title":"2.3 \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f","text":"

PaddleX\u200b\u7684\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u793a\u4f8b\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u597d\u200b\u7684\u200b\u7279\u5f81\u200b\u5e93\u200b\u8fdb\u884c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u68c0\u7d22\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u7ec4\u7ec7\u200b\u6570\u636e\u200b\uff1a

data_root             # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images            # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u2502   \u251c\u2500\u2500 ID0           # \u200b\u8eab\u4efd\u200bID\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u6bd4\u5982\u200b\u4eba\u200b\u540d\u200b\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n\u2502   \u2502       ...\n\u2502   \u251c\u2500\u2500 ID1           # \u200b\u8eab\u4efd\u200bID\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u6bd4\u5982\u200b\u4eba\u200b\u540d\u200b\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # \u200b\u7279\u5f81\u200b\u5e93\u200b\u6570\u636e\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u5f85\u200b\u68c0\u7d22\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/Chandler/Chandler00037.jpg Chandler\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u56fe\u50cf\u200bOCR\u200b\u7ed3\u679c\u200b\u3002

POST /ocr

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 image string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6807\u6ce8\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"\u200b\u5317\u4eac\u200b\u5357\u7ad9\u200b\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"\u200b\u5929\u6d25\u7ad9\u200b\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b \u200b\u4eba\u8138\u8bc6\u522b\u200b \u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u548c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4eba\u8138\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u4eba\u8138\u200b\u51fa\u73b0\u200b\u5339\u914d\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  device: \"gpu:0\"\n  det_model: \"BlazeFace\"        #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  rec_model: \"MobileFaceNet\"    #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4e3a\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u548c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u8bbe\u7f6e\u200b\u5355\u72ec\u200b\u7684\u200bbatch_size\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u4f7f\u7528\u200bPython\u200b\u8fd0\u884c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u4ece\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u66f4\u200b\u6539\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b\u811a\u672c\u200b\u4e2d\u200b\u7684\u200b device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu \u200b\u5373\u53ef\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"face_recognition\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html","title":"\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#1","title":"1. \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u65e8\u5728\u200b\u89e3\u51b3\u200b\u5f00\u653e\u200b\u57df\u200b\u76ee\u6807\u200b\u5b9a\u4f4d\u200b\u53ca\u200b\u8bc6\u522b\u200b\u95ee\u9898\u200b\uff0c\u200b\u76ee\u524d\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b PP-ShiTuV2\u3002

PP-ShiTuV2 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u5b9e\u7528\u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u4e3b\u8981\u200b\u7531\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u7279\u5f81\u200b\u5b66\u4e60\u200b\u548c\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\u7ec4\u6210\u200b\u3002\u200b\u8be5\u200b\u7cfb\u7edf\u200b\u4ece\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\u9009\u62e9\u200b\u548c\u200b\u8c03\u6574\u200b\u3001\u200b\u635f\u5931\u200b\u51fd\u6570\u200b\u7684\u200b\u9009\u62e9\u200b\u3001\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u3001\u200b\u5b66\u4e60\u200b\u7387\u200b\u53d8\u6362\u200b\u7b56\u7565\u200b\u3001\u200b\u6b63\u5219\u200b\u5316\u200b\u53c2\u6570\u200b\u9009\u62e9\u200b\u3001\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4f7f\u7528\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u88c1\u526a\u200b\u91cf\u5316\u200b\u591a\u4e2a\u200b\u65b9\u9762\u200b\uff0c\u200b\u878d\u5408\u200b\u6539\u8fdb\u200b\u591a\u79cd\u200b\u7b56\u7565\u200b\uff0c\u200b\u5bf9\u200b\u5404\u4e2a\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\uff0c\u200b\u6700\u7ec8\u200b\u5728\u200b\u591a\u4e2a\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u7684\u200b\u68c0\u7d22\u200b\u6027\u80fd\u200b\u5747\u200b\u6709\u200b\u8f83\u200b\u597d\u200b\u6548\u679c\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff0c\u200b\u6709\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\u53ef\u200b\u4f9b\u9009\u62e9\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_det 41.5 62.0 33.7 537.0 27.54 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6a21\u578b\u200b\u53ef\u80fd\u200b\u4f1a\u200b\u540c\u65f6\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u591a\u4e2a\u200b\u5e38\u89c1\u200b\u4e3b\u4f53\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas \u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b recall@1 (%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2\u200b\u662f\u200b\u4e00\u4e2a\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7531\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u7279\u5f81\u63d0\u53d6\u200b\u3001\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\u6784\u6210\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u662f\u200b\u5176\u4e2d\u200b\u7684\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u7cfb\u7edf\u200b\u7684\u200b\u60c5\u51b5\u200b\u9009\u62e9\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u578b\u200b\u3002 PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u2757 \u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u8be5\u4ea7\u7ebf\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u547d\u4ee4\u884c\u200b\u4f53\u9a8c\u200b\u3002

\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5185\u7f6e\u200b\u7684\u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config PP-ShiTuV2\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b./my_path\uff09\uff1a

paddlex --get_pipeline_config PP-ShiTuV2 --save_path ./my_path\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"
  • \u200b\u5728\u200b\u8be5\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8fd0\u884c\u200b\u793a\u4f8b\u200b\u4e2d\u200b\u9700\u8981\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4e0b\u8f7d\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b\u996e\u6599\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u6570\u636e\u200b\u96c6\u200bdrink_dataset_v2.0 \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u3002\u200b\u4e4b\u540e\u200b\u901a\u8fc7\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5efa\u7acb\u200b\u7d22\u5f15\u200b\u5e93\u200b\u548c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u3002
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"PP-ShiTuV2\")\n\nindex_data = pipeline.build_index(gallery_imgs=\"drink_dataset_v2.0/\", gallery_label=\"drink_dataset_v2.0/gallery.txt\")\nindex_data.save(\"drink_index\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\", index=index_data)\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b \u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b index \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u76ee\u5f55\u200b\uff08\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u8981\u200b\u5305\u542b\u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200bvector.index\u200b\u548c\u200bindex_info.yaml\uff09\uff1b2. IndexData\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5728\u200bpredict()\u200b\u4e2d\u200b\u6307\u5b9a\u200bindex\u3002 str None device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b build_index \u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u4e3a\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b gallery_imgs \u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b gallery_label \u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b

\u200b\u7d22\u5f15\u200b\u5e93\u200b\u5bf9\u8c61\u200b index \u200b\u652f\u6301\u200b save \u200b\u65b9\u6cd5\u200b\uff0c\u200b\u7528\u4e8e\u200b\u5c06\u200b\u7d22\u5f15\u200b\u5e93\u200b\u4fdd\u5b58\u200b\u5230\u200b\u78c1\u76d8\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b save_path \u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200bdrink_index\u3002 str \u200b\u65e0\u200b

\uff083\uff09\u200b\u8c03\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200b input\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\u200b\u53e6\u5916\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u652f\u6301\u200b\u53c2\u6570\u200bindex\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b index \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u76ee\u5f55\u200b\uff08\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u8981\u200b\u5305\u542b\u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200bvector.index\u200b\u548c\u200bindex_info.yaml\uff09\uff1b2. IndexData\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5728\u200bcreate_pipeline()\u200b\u4e2d\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200bindex\u200b\u6307\u5b9a\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002

\uff084\uff09\u200b\u8c03\u7528\u200b predict \u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200b generator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict \u200b\u5c06\u200b\u65b9\u6cd5\u200b\u4ee5\u200b batch \u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u3002

\uff085\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200b dict \u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/PP-ShiTuV2.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/PP-ShiTuV2.yaml\", index=\"drink_index\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#223","title":"2.2.3 \u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6dfb\u52a0\u200b\u548c\u200b\u5220\u9664\u200b\u64cd\u4f5c","text":"

\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u5c06\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6dfb\u52a0\u200b\u5230\u200b\u7d22\u5f15\u200b\u5e93\u4e2d\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b append_index \u200b\u65b9\u6cd5\u200b\uff1b\u200b\u5220\u9664\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b remove_index \u200b\u65b9\u6cd5\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(\"PP-ShiTuV2\")\nindex_data = pipeline.build_index(gallery_imgs=\"drink_dataset_v2.0/\", gallery_label=\"drink_dataset_v2.0/gallery.txt\", index_type=\"IVF\", metric_type=\"IP\")\nindex_data = pipeline.append_index(gallery_imgs=\"drink_dataset_v2.0/\", gallery_label=\"drink_dataset_v2.0/gallery.txt\", index=index_data)\nindex_data = pipeline.remove_index(remove_ids=\"drink_dataset_v2.0/remove_ids.txt\", index=index_data)\nindex_data.save(\"drink_index\")\n

\u200b\u4e0a\u8ff0\u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b gallery_imgs \u200b\u8981\u200b\u6dfb\u52a0\u200b\u7684\u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u7247\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u4e0e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u65f6\u200b\u76f8\u540c\u200b\uff0c\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\uff1b2. [numpy.ndarray, numpy.ndarray, ..]\u200b\u7c7b\u578b\u200b\u7684\u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\u6570\u636e\u200b\u3002 str|list \u200b\u65e0\u200b gallery_label \u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u4fe1\u606f\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u8def\u5f84\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u4e0e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u65f6\u200b\u76f8\u540c\u200b\uff0c\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\uff1b2. [str, str, ..]\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\u6807\u6ce8\u200b\u3002 str|list \u200b\u65e0\u200b remove_ids \u200b\u5f85\u200b\u5220\u9664\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e8f\u53f7\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200btxt\u200b\u6587\u4ef6\u200b\u7684\u200b\u8def\u5f84\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3a\u200b\u5f85\u200b\u5220\u9664\u200b\u7684\u200b\u7d22\u5f15\u200bid\uff0c\u200b\u6bcf\u884c\u200b\u4e00\u4e2a\u200b\u201cid\u201d\uff1b2. [int, int, ..]\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5f85\u200b\u5220\u9664\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e8f\u53f7\u200b\u3002\u200b\u4ec5\u200b\u5728\u200b remove_index \u200b\u4e2d\u200b\u6709\u6548\u200b\u3002 str|list \u200b\u65e0\u200b index \u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. \u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\uff08vector.index\u200b\u548c\u200bindex_info.yaml\uff09\u200b\u6240\u5728\u200b\u76ee\u5f55\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b2. IndexData\u200b\u7c7b\u578b\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u5bf9\u8c61\u200b\uff0c\u200b\u4ec5\u200b\u5728\u200b append_index \u200b\u548c\u200b remove_index \u200b\u4e2d\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200b\u5f85\u200b\u4fee\u6539\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002 str|IndexData \u200b\u65e0\u200b index_type \u200b\u652f\u6301\u200b HNSW32\u3001IVF\u3001Flat\u3002\u200b\u5176\u4e2d\u200b\uff0cHNSW32 \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u4e14\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u4f46\u200b\u4e0d\u200b\u652f\u6301\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bIVF \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u4f46\u200b\u7cbe\u5ea6\u200b\u76f8\u5bf9\u200b\u8f83\u200b\u4f4e\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bFlat \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u4f4e\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\u3002 str HNSW32 metric_type \u200b\u652f\u6301\u200b\uff1aIP\uff0c\u200b\u5185\u79ef\u200b\uff08Inner Product\uff09\uff1bL2\uff0c\u200b\u6b27\u51e0\u91cc\u5f97\u200b\u8ddd\u79bb\u200b\uff08Euclidean Distance\uff09\u3002 str IP"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#23","title":"2.3 \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f","text":"

PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u793a\u4f8b\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u597d\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u8fdb\u884c\u200b\u7279\u5f81\u200b\u68c0\u7d22\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u7ec4\u7ec7\u200b\u6570\u636e\u200b\uff1a

data_root             # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images            # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # \u200b\u7d22\u5f15\u200b\u5e93\u200b\u6570\u636e\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u5f85\u200b\u68c0\u7d22\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a \u201c0/0.jpg \u200b\u8109\u52a8\u200b\u201d\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • buildIndex

\u200b\u6784\u5efa\u200b\u7279\u5f81\u5411\u91cf\u200b\u7d22\u5f15\u200b\u3002

POST /shitu-index-build

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b imageLabelPairs array \u200b\u7528\u4e8e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u7684\u200b\u56fe\u50cf\u200b-\u200b\u6807\u7b7e\u200b\u5bf9\u200b\u3002 \u200b\u662f\u200b

imageLabelPairs\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 label string \u200b\u6807\u7b7e\u200b\u3002
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\uff0c\u200b\u7528\u4e8e\u200b\u6807\u8bc6\u200b\u5efa\u7acb\u200b\u7684\u200b\u7d22\u5f15\u200b\u3002\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002 idMap object \u200b\u5411\u91cf\u200bID\u200b\u5230\u200b\u6807\u7b7e\u200b\u7684\u200b\u6620\u5c04\u200b\u3002
  • addImagesToIndex

\u200b\u5c06\u200b\u56fe\u50cf\u200b\uff08\u200b\u5bf9\u5e94\u200b\u7684\u200b\u7279\u5f81\u5411\u91cf\u200b\uff09\u200b\u52a0\u5165\u200b\u7d22\u5f15\u200b\u3002

POST /shitu-index-add

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b imageLabelPairs array \u200b\u7528\u4e8e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u7684\u200b\u56fe\u50cf\u200b-\u200b\u6807\u7b7e\u200b\u5bf9\u200b\u3002 \u200b\u662f\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\u3002\u200b\u7531\u200bbuildIndex\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b

imageLabelPairs\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 label string \u200b\u6807\u7b7e\u200b\u3002
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b idMap object \u200b\u5411\u91cf\u200bID\u200b\u5230\u200b\u6807\u7b7e\u200b\u7684\u200b\u6620\u5c04\u200b\u3002
  • removeImagesFromIndex

\u200b\u4ece\u200b\u7d22\u5f15\u200b\u4e2d\u200b\u79fb\u9664\u200b\u56fe\u50cf\u200b\uff08\u200b\u5bf9\u5e94\u200b\u7684\u200b\u7279\u5f81\u5411\u91cf\u200b\uff09\u3002

POST /shitu-index-remove

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b ids array \u200b\u9700\u8981\u200b\u4ece\u200b\u7d22\u5f15\u200b\u4e2d\u200b\u79fb\u9664\u200b\u7684\u200b\u5411\u91cf\u200b\u7684\u200bID\u3002 \u200b\u662f\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\u3002\u200b\u7531\u200bbuildIndex\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b idMap object \u200b\u5411\u91cf\u200bID\u200b\u5230\u200b\u6807\u7b7e\u200b\u7684\u200b\u6620\u5c04\u200b\u3002
  • infer

\u200b\u8fdb\u884c\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u3002

POST /shitu-infer

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\u3002\u200b\u7531\u200bbuildIndex\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b detectedObjects array \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u76ee\u6807\u200b\u7684\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

detectedObjects\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u76ee\u6807\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 recResults array \u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002 score number \u200b\u68c0\u6d4b\u200b\u5f97\u5206\u200b\u3002

recResults\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\n\nbase_image_label_pairs = [\n    {\"image\": \"./demo0.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo1.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo2.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nimage_label_pairs_to_add = [\n    {\"image\": \"./demo3.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nids_to_remove = [1]\ninfer_image_path = \"./demo4.jpg\"\noutput_image_path = \"./out.jpg\"\n\nfor pair in base_image_label_pairs:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": base_image_label_pairs}\nresp_index_build = requests.post(f\"{API_BASE_URL}/shitu-index-build\", json=payload)\nif resp_index_build.status_code != 200:\n    print(f\"Request to shitu-index-build failed with status code {resp_index_build}.\")\n    pprint.pp(resp_index_build.json())\n    sys.exit(1)\nresult_index_build = resp_index_build.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_build['idMap'])}\")\n\nfor pair in image_label_pairs_to_add:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": image_label_pairs_to_add, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_add = requests.post(f\"{API_BASE_URL}/shitu-index-add\", json=payload)\nif resp_index_add.status_code != 200:\n    print(f\"Request to shitu-index-add failed with status code {resp_index_add}.\")\n    pprint.pp(resp_index_add.json())\n    sys.exit(1)\nresult_index_add = resp_index_add.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_add['idMap'])}\")\n\npayload = {\"ids\": ids_to_remove, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_remove = requests.post(f\"{API_BASE_URL}/shitu-index-remove\", json=payload)\nif resp_index_remove.status_code != 200:\n    print(f\"Request to shitu-index-remove failed with status code {resp_index_remove}.\")\n    pprint.pp(resp_index_remove.json())\n    sys.exit(1)\nresult_index_remove = resp_index_remove.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_remove['idMap'])}\")\n\nwith open(infer_image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_infer = requests.post(f\"{API_BASE_URL}/shitu-infer\", json=payload)\nif resp_infer.status_code != 200:\n    print(f\"Request to shitu-infer failed with status code {resp_infer}.\")\n    pprint.pp(resp_infer.json())\n    sys.exit(1)\nresult_infer = resp_infer.json()[\"result\"]\n\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result_infer[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\npprint.pp(result_infer[\"detectedObjects\"])\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4e3b\u4f53\u200b\u76ee\u6807\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u4e3b\u4f53\u200b\u51fa\u73b0\u200b\u5339\u914d\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

Pipeline:\n  device: \"gpu:0\"\n  det_model: \"./PP-ShiTuV2_det_infer/\"        #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  rec_model: \"./PP-ShiTuV2_rec_infer/\"        #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u4f7f\u7528\u200bPython\u200b\u8fd0\u884c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u4ece\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u66f4\u200b\u6539\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b\u811a\u672c\u200b\u4e2d\u200b\u7684\u200b device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu \u200b\u5373\u53ef\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ShiTuV2\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n

\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html","title":"\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#1","title":"1. \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\uff0c\u200b\u6765\u200b\u8bc6\u522b\u200b\u4e0e\u4f17\u4e0d\u540c\u200b\u6216\u200b\u4e0d\u200b\u7b26\u5408\u200b\u6b63\u5e38\u200b\u6a21\u5f0f\u200b\u7684\u200b\u56fe\u50cf\u5904\u7406\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5de5\u4e1a\u200b\u8d28\u91cf\u200b\u68c0\u6d4b\u200b\u3001\u200b\u533b\u7597\u200b\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u5b89\u5168\u76d1\u63a7\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6f5c\u5728\u200b\u7684\u200b\u7f3a\u9677\u200b\u3001\u200b\u5f02\u5e38\u200b\u6216\u200b\u5f02\u5e38\u200b\u884c\u4e3a\u200b\uff0c\u200b\u4ece\u800c\u200b\u5e2e\u52a9\u200b\u6211\u4eec\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u95ee\u9898\u200b\u5e76\u200b\u91c7\u53d6\u76f8\u5e94\u200b\u63aa\u65bd\u200b\u3002\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7cfb\u7edf\u200b\u88ab\u200b\u8bbe\u8ba1\u200b\u7528\u4e8e\u200b\u81ea\u52a8\u68c0\u6d4b\u200b\u548c\u200b\u6807\u8bb0\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u9ad8\u200b\u5de5\u4f5c\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) STFPM\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.2 21.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config anomaly_detection\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config anomaly_detection --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./anomaly_detection.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./anomaly_detection.yaml --input uad_grid.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'uad_grid.png'}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"anomaly_detection\")\n\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/*anomaly_detection.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/anomaly_detection.yaml\")\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3002

POST /anomaly-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b labelMap array \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u3002\u200b\u5176\u4e2d\u200b255\u200b\u8868\u793a\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c0\u200b\u8868\u793a\u200b\u975e\u200b\u5f02\u5e38\u200b\u70b9\u200b\u3002 size array \u200b\u56fe\u50cf\u200b\u5f62\u72b6\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u7684\u200b\u9ad8\u5ea6\u200b\u548c\u200b\u5bbd\u5ea6\u200b\u3002 image string \u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"labelMap\": [\n0,\n0,\n255,\n0\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-anomaly-detection\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n# result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/image-anomaly-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n            // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-anomaly-detection\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-anomaly-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-anomaly-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-anomaly-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-anomaly-detection\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n// result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65e0\u200b\u76d1\u7763\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: STFPM   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline anomaly_detection --input uad_grid.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html","title":"\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#1","title":"1. \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b9\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b80\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M CLIP\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u89c6\u89c9\u200b\u548c\u200b\u8bed\u8a00\u200b\u76f8\u5173\u8054\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u91c7\u7528\u200b\u5bf9\u6bd4\u200b\u5b66\u4e60\u200b\u548c\u200b\u9884\u200b\u8bad\u7ec3\u65b9\u6cd5\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u65e0\u200b\u76d1\u7763\u200b\u6216\u5f31\u200b\u76d1\u7763\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u5c24\u5176\u200b\u9002\u7528\u200b\u4e8e\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u5c06\u200b\u56fe\u50cf\u200b\u548c\u200b\u6587\u672c\u200b\u6620\u5c04\u200b\u5230\u200b\u540c\u4e00\u200b\u8868\u793a\u200b\u7a7a\u95f4\u200b\uff0c\u200b\u5b66\u4e60\u200b\u5230\u200b\u901a\u7528\u200b\u7279\u5f81\u200b\uff0c\u200b\u5177\u6709\u200b\u826f\u597d\u200b\u7684\u200b\u6cdb\u5316\u200b\u80fd\u529b\u200b\u548c\u200b\u89e3\u91ca\u6027\u200b\u3002\u200b\u5176\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8bad\u7ec3\u200b\u8bef\u5dee\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 CLIP_vit_large_patch14_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.84 12.8473 1513.87 313.9 M ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200bMeta\u200b\u5728\u200b2022\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u57fa\u4e8e\u200bCNN\u200b\u67b6\u6784\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200bResNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u901a\u8fc7\u200b\u501f\u9274\u200bSwinTransformer\u200b\u7684\u200b\u4f18\u70b9\u200b\u8bbe\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u8bad\u7ec3\u200b\u7b56\u7565\u200b\u548c\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7684\u200b\u4f18\u5316\u200b\u601d\u8def\u200b\uff0c\u200b\u4ece\u800c\u200b\u6539\u8fdb\u200b\u7684\u200b\u7eaf\u200bCNN\u200b\u67b6\u6784\u200b\u7f51\u7edc\u200b\uff0c\u200b\u63a2\u7d22\u200b\u4e86\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u6027\u80fd\u200b\u4e0a\u9650\u200b\u3002ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u5177\u5907\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u8bf8\u591a\u200b\u4f18\u70b9\u200b\uff0c\u200b\u5305\u62ec\u200b\u63a8\u7406\u200b\u6548\u7387\u9ad8\u200b\u548c\u200b\u6613\u4e8e\u200b\u8fc1\u79fb\u200b\u5230\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u7b49\u200b\u3002 ConvNeXt_base_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.27 66.4058 6598.92 700.7 M ConvNeXt_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.13 9.74075 1127.6 178.0 M ConvNeXt_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.03 5.48923 672.559 104.1 M FasterNet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.5 23.4415 - 357.1 M FasterNet\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e8\u5728\u200b\u63d0\u9ad8\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u7684\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u6539\u8fdb\u200b\u70b9\u200b\u4e3b\u8981\u200b\u5982\u4e0b\u200b\uff1a 1.\u200b\u91cd\u65b0\u200b\u5ba1\u89c6\u200b\u4e86\u200b\u6d41\u884c\u200b\u7684\u200b\u8fd0\u7b97\u7b26\u200b\uff0c\u200b\u53d1\u73b0\u200b\u4f4e\u200bFLOPS\u200b\u4e3b\u8981\u200b\u6765\u81ea\u200b\u4e8e\u200b\u8fd0\u7b97\u200b\u9891\u7e41\u200b\u7684\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\uff0c\u200b\u7279\u522b\u200b\u662f\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff1b 2.\u200b\u63d0\u51fa\u200b\u4e86\u200b\u90e8\u5206\u200b\u5377\u79ef\u200b(PConv)\uff0c\u200b\u901a\u8fc7\u200b\u51cf\u5c11\u200b\u5197\u4f59\u200b\u8ba1\u7b97\u200b\u548c\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\u6765\u200b\u66f4\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff1b 3.\u200b\u57fa\u4e8e\u200bPConv\u200b\u63a8\u51fa\u200b\u4e86\u200bFasterNet\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u8bbe\u8ba1\u65b9\u6848\u200b\uff0c\u200b\u5728\u200b\u4e0d\u200b\u5f71\u54cd\u200b\u6a21\u578b\u200b\u4efb\u52a1\u200b\u6027\u80fd\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5728\u200b\u5404\u79cd\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u663e\u8457\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u3002 FasterNet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.0 21.8936 - 204.6 M FasterNet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.3 13.0409 - 119.3 M FasterNet-T0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.9 12.2432 - 15.1 M FasterNet-T1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.9 11.3562 - 29.2 M FasterNet-T2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.703 - 57.4 M MobileNetV1_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.5 1.86754 7.48297 4.8 M MobileNetV1\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2017\u200b\u5e74\u200b\u53d1\u5e03\u200b\u7684\u200b\u7528\u4e8e\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u200b\u6216\u200b\u5d4c\u5165\u5f0f\u200b\u8bbe\u5907\u200b\u4e2d\u200b\u7684\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5c06\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u64cd\u4f5c\u200b\u62c6\u89e3\u200b\u6210\u200b\u6df1\u5ea6\u200b\u53ef\u200b\u5206\u79bb\u200b\u5377\u79ef\u200b\uff0c\u200b\u5373\u200bDepthwise\u200b\u5377\u79ef\u200b\u548c\u200bPointwise\u200b\u5377\u79ef\u200b\u7684\u200b\u7ec4\u5408\u200b\u3002\u200b\u76f8\u6bd4\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7ec4\u5408\u200b\u53ef\u4ee5\u200b\u5927\u5927\u200b\u8282\u7701\u200b\u53c2\u200b\u6570\u91cf\u200b\u548c\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u3002\u200b\u540c\u65f6\u200b\u8be5\u200b\u7f51\u7edc\u200b\u53ef\u4ee5\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7b49\u200b\u5176\u4ed6\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u3002 MobileNetV1_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.0 4.94234 11.1629 7.1 M MobileNetV2\u200b\u662f\u200bGoogle\u200b\u7ee7\u200bMobileNetV1\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u76f8\u6bd4\u200bMobileNetV1\uff0cMobileNetV2\u200b\u63d0\u51fa\u200b\u4e86\u200bLinear bottlenecks\u200b\u4e0e\u200bInverted residual block\u200b\u4f5c\u4e3a\u200b\u7f51\u7edc\u200b\u57fa\u672c\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u91cf\u200b\u5730\u200b\u5806\u53e0\u200b\u8fd9\u4e9b\u200b\u57fa\u672c\u200b\u6a21\u5757\u200b\uff0c\u200b\u6784\u6210\u200b\u4e86\u200bMobileNetV2\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u3002\u200b\u6700\u540e\u200b\uff0c\u200b\u5728\u200bFLOPs\u200b\u53ea\u6709\u200bMobileNetV1\u200b\u7684\u200b\u4e00\u534a\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\u53d6\u5f97\u200b\u4e86\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u5206\u7c7b\u200b\u7cbe\u5ea6\u200b\u3002 MobileNetV2_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 69.2 6.31302 14.5588 9.6 M MobileNetV3\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2019\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bNAS\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u4e3a\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\uff0c\u200b\u5c06\u200brelu\u200b\u548c\u200bsigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\u5206\u522b\u200b\u66ff\u6362\u200b\u4e3a\u200bhard_swish\u200b\u4e0e\u200bhard_sigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\uff0c\u200b\u540c\u65f6\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u4e9b\u200b\u4e13\u95e8\u200b\u4e3a\u200b\u51cf\u5c11\u200b\u7f51\u7edc\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u7684\u200b\u6539\u8fdb\u200b\u7b56\u7565\u200b\u3002 MobileNetV3_large_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.4 12.5485 51.6453 125.2 M MobileNetV4\u200b\u662f\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u8bbe\u8ba1\u200b\u7684\u200b\u9ad8\u6548\u200b\u67b6\u6784\u200b\u3002\u200b\u5176\u200b\u6838\u5fc3\u200b\u5728\u4e8e\u200b\u5f15\u5165\u200b\u4e86\u200bUIB\uff08Universal Inverted Bottleneck\uff09\u200b\u6a21\u5757\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u7edf\u4e00\u200b\u4e14\u200b\u7075\u6d3b\u200b\u7684\u200b\u7ed3\u6784\u200b\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bIB\uff08Inverted Bottleneck\uff09\u3001ConvNeXt\u3001FFN\uff08Feed Forward Network\uff09\u200b\u4ee5\u53ca\u200b\u6700\u65b0\u200b\u7684\u200bExtraDW\uff08Extra Depthwise\uff09\u200b\u6a21\u5757\u200b\u3002\u200b\u4e0e\u200bUIB\u200b\u540c\u65f6\u200b\u63a8\u51fa\u200b\u7684\u200b\u8fd8\u6709\u200bMobile MQA\uff0c\u200b\u8fd9\u200b\u662f\u200b\u79cd\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u52a0\u901f\u5668\u200b\u5b9a\u5236\u200b\u7684\u200b\u6ce8\u610f\u529b\u200b\u5757\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b\u9ad8\u200b\u8fbe\u200b39%\u200b\u7684\u200b\u663e\u8457\u200b\u52a0\u901f\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cMobileNetV4\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u795e\u7ecf\u200b\u67b6\u6784\u200b\u641c\u7d22\u200b\uff08Neural Architecture Search, NAS\uff09\u200b\u65b9\u6848\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u641c\u7d22\u200b\u7684\u200b\u6709\u6548\u6027\u200b\u3002 MobileNetV4_conv_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.5 19.7543 62.2624 42.9 M PP-HGNet_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.0 14.2969 327.114 249.4 M PP-HGNet\uff08High Performance GPU Net\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u9002\u7528\u200b\u4e8e\u200bGPU\u200b\u5e73\u53f0\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u7ed3\u5408\u200bVOVNet\u200b\u7684\u200b\u57fa\u7840\u200b\u51fa\u200b\u4f7f\u7528\u200b\u4e86\u200b\u53ef\u200b\u5b66\u4e60\u200b\u7684\u200b\u4e0b\u200b\u91c7\u6837\u200b\u5c42\u200b\uff08LDS Layer\uff09\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bResNet_vd\u3001PPHGNet\u200b\u7b49\u200b\u6a21\u578b\u200b\u7684\u200b\u4f18\u70b9\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200bGPU\u200b\u5e73\u53f0\u200b\u4e0a\u200b\u4e0e\u200b\u5176\u4ed6\u200bSOTA\u200b\u6a21\u578b\u200b\u5728\u200b\u76f8\u540c\u200b\u7684\u200b\u901f\u5ea6\u200b\u4e0b\u200b\u6709\u7740\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u5728\u200b\u540c\u7b49\u200b\u901f\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u9ad8\u4e8e\u200bResNet34-0\u200b\u6a21\u578b\u200b3.8\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u9ad8\u4e8e\u200bResNet50-0\u200b\u6a21\u578b\u200b2.4\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u5728\u200b\u4f7f\u7528\u200b\u76f8\u540c\u200b\u7684\u200bSLSD\u200b\u6761\u6b3e\u200b\u4e0b\u200b\uff0c\u200b\u6700\u7ec8\u200b\u8d85\u8d8a\u200b\u4e86\u200bResNet50-D\u200b\u6a21\u578b\u200b4.7\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\u3002\u200b\u4e0e\u6b64\u540c\u65f6\u200b\uff0c\u200b\u5728\u200b\u76f8\u540c\u200b\u7cbe\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u5176\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e5f\u200b\u8fdc\u8d85\u200b\u4e3b\u6d41\u200bVisionTransformer\u200b\u7684\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNet_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2\uff08High Performance GPU Network V2\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7684\u200bPP-HGNet\u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPP-HGNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u5176\u200b\u5728\u200bNVIDIA\u200b\u53d1\u5e03\u200b\u7684\u200b\u201cAccuracy-Latency Balance\u201d\u200b\u505a\u5230\u200b\u4e86\u200b\u6781\u81f4\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u4e86\u200b\u5176\u4ed6\u200b\u540c\u6837\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u6bcf\u79cd\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8003\u6807\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u5f3a\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 PP-HGNetV2-B1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.14 3.67722 6.66857 6.7 M PP-LCNet\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u5b83\u200b\u80fd\u200b\u5728\u200b\u4e0d\u200b\u589e\u52a0\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\uff0c\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u5176\u4ed6\u200b\u8f7b\u91cf\u7ea7\u200bSOTA\u200b\u6a21\u578b\u200b\u3002 PP-LCNet_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.05 5.23428 19.6005 23.7 M PP-LCNetV2 \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b PP-LCNet \u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200b PP-LCNet \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u4e3b\u8981\u200b\u4f7f\u7528\u200b\u91cd\u200b\u53c2\u6570\u200b\u5316\u200b\u7b56\u7565\u200b\u7ec4\u5408\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5927\u5c0f\u200b\u5377\u79ef\u200b\u6838\u200b\u7684\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff0c\u200b\u5e76\u200b\u4f18\u5316\u200b\u4e86\u200b\u70b9\u200b\u5377\u79ef\u200b\u3001Shortcut\u200b\u7b49\u200b\u3002\u200b\u5728\u200b\u4e0d\u200b\u4f7f\u7528\u200b\u989d\u5916\u200b\u6570\u636e\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0cPPLCNetV2_base \u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b ImageNet \u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u80fd\u591f\u200b\u53d6\u5f97\u200b\u8d85\u8fc7\u200b 77% \u200b\u7684\u200b Top1 Acc\uff0c\u200b\u540c\u65f6\u200b\u5728\u200b Intel CPU \u200b\u5e73\u53f0\u200b\u7684\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u5728\u200b 4.4 ms \u200b\u4ee5\u4e0b\u200b PP-LCNetV2_large \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.97 3.89762 13.0273 14.6 M ResNet18_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.3 3.53048 31.3014 41.5 M ResNet \u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200b 2015 \u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\uff0c\u200b\u4e00\u4e3e\u200b\u5728\u200b ILSVRC2015 \u200b\u6bd4\u8d5b\u200b\u4e2d\u200b\u53d6\u5f97\u200b\u51a0\u519b\u200b\uff0ctop5 \u200b\u9519\u8bef\u7387\u200b\u4e3a\u200b 3.57%\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u521b\u65b0\u6027\u200b\u7684\u200b\u63d0\u51fa\u200b\u4e86\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5806\u53e0\u200b\u591a\u4e2a\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\u4ece\u800c\u200b\u6784\u5efa\u200b\u4e86\u200b ResNet \u200b\u7f51\u7edc\u200b\u3002\u200b\u5b9e\u9a8c\u200b\u8868\u660e\u200b\u4f7f\u7528\u200b\u6b8b\u5dee\u200b\u5757\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u5730\u200b\u63d0\u5347\u200b\u6536\u655b\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u3002 ResNet18 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.4868 27.4601 41.5 M ResNet34_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.0 5.60675 56.0653 77.3 M ResNet34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 4.16902 51.925 77.3 M ResNet50_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.1885 68.446 90.8 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M ResNet101_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.2 20.0563 124.85 158.4 M ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.6 19.2297 121.006 158.4 M ResNet152_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.6 29.6439 181.678 214.3 M ResNet152\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.3 30.0461 177.707 214.2 M ResNet200_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.9 39.1628 235.185 266.0 M StarNet-S1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.6 9.895 23.0465 11.2 M StarNet \u200b\u805a\u7126\u200b\u4e8e\u200b\u7814\u7a76\u200b\u7f51\u7edc\u200b\u8bbe\u8ba1\u200b\u4e2d\u200b\u201c\u200b\u661f\u200b\u64cd\u4f5c\u200b\u201d\uff08\u200b\u5373\u200b\u5143\u7d20\u200b\u7ea7\u200b\u4e58\u6cd5\u200b\uff09\u200b\u7684\u200b\u672a\u200b\u5f00\u53d1\u200b\u6f5c\u529b\u200b\u3002\u200b\u63ed\u793a\u200b\u661f\u200b\u64cd\u4f5c\u200b\u80fd\u591f\u200b\u5c06\u200b\u8f93\u5165\u200b\u6620\u5c04\u200b\u5230\u200b\u9ad8\u7ef4\u200b\u3001\u200b\u975e\u7ebf\u6027\u200b\u7279\u5f81\u200b\u7a7a\u95f4\u200b\u7684\u200b\u80fd\u529b\u200b\uff0c\u200b\u8fd9\u4e00\u200b\u8fc7\u7a0b\u200b\u7c7b\u4f3c\u200b\u4e8e\u200b\u6838\u200b\u6280\u5de7\u200b\uff0c\u200b\u4f46\u200b\u65e0\u9700\u200b\u6269\u5927\u200b\u7f51\u7edc\u200b\u89c4\u6a21\u200b\u3002\u200b\u56e0\u6b64\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u51fa\u200b\u4e86\u200b StarNet\uff0c\u200b\u4e00\u4e2a\u200b\u7b80\u5355\u200b\u800c\u200b\u5f3a\u5927\u200b\u7684\u200b\u539f\u578b\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5728\u200b\u7d27\u51d1\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u548c\u200b\u6709\u9650\u200b\u7684\u200b\u8ba1\u7b97\u8d44\u6e90\u200b\u4e0b\u200b\uff0c\u200b\u5c55\u73b0\u51fa\u200b\u4e86\u200b\u5353\u8d8a\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u4f4e\u200b\u5ef6\u8fdf\u200b\u3002 StarNet-S2 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.8 7.91279 21.9571 14.3 M StarNet-S3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.0 10.7531 30.7656 22.2 M StarNet-S4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.37 16.9848 383.83 310.5 M SwinTransformer \u200b\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u89c6\u89c9\u200b Transformer \u200b\u7f51\u7edc\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u7528\u4f5c\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u901a\u7528\u200b\u9aa8\u5e72\u7f51\u200b\u8def\u200b\u3002SwinTransformer \u200b\u7531\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\uff08shifted windows\uff09\u200b\u8868\u793a\u200b\u7684\u200b\u5c42\u6b21\u200b Transformer \u200b\u7ed3\u6784\u200b\u7ec4\u6210\u200b\u3002\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\u5c06\u200b\u81ea\u200b\u6ce8\u610f\u200b\u8ba1\u7b97\u200b\u9650\u5236\u200b\u5728\u200b\u975e\u200b\u91cd\u53e0\u200b\u7684\u200b\u5c40\u90e8\u200b\u7a97\u53e3\u200b\u4e0a\u200b\uff0c\u200b\u540c\u65f6\u200b\u5141\u8bb8\u200b\u8de8\u200b\u7a97\u53e3\u200b\u8fde\u63a5\u200b\uff0c\u200b\u4ece\u800c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u7f51\u7edc\u200b\u6027\u80fd\u200b\u3002 SwinTransformer_base_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config image_classification\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config image_classification --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./image_classification.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': [0.62736, 0.03752, 0.03256, 0.0323, 0.03194], 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/image_classification*.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002

POST /image-classification

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b topK integer \u200b\u7ed3\u679c\u200b\u4e2d\u5c06\u200b\u53ea\u200b\u4fdd\u7559\u200b\u5f97\u5206\u200b\u6700\u9ad8\u200b\u7684\u200btopK\u200b\u4e2a\u200b\u7c7b\u522b\u200b\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b categories array \u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

categories\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b id integer \u200b\u7c7b\u522b\u200bID\u3002 name string \u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u3002 score number \u200b\u7c7b\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"\u200b\u5154\u5b50\u200b\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-classification\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/image-classification\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-classification\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-classification\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PP-LCNet_x1_0  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html","title":"\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#1","title":"1. \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u4e00\u5f20\u200b\u56fe\u50cf\u200b\u540c\u65f6\u200b\u5206\u914d\u200b\u5230\u200b\u591a\u4e2a\u200b\u76f8\u5173\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u3001\u200b\u5185\u5bb9\u200b\u63a8\u8350\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b58\u5728\u200b\u7684\u200b\u591a\u4e2a\u200b\u7269\u4f53\u200b\u6216\u200b\u7279\u5f81\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u4e2d\u200b\u540c\u65f6\u200b\u5305\u542b\u200b\u201c\u200b\u72d7\u200b\u201d\u200b\u548c\u200b\u201c\u200b\u6237\u5916\u200b\u201d\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u6807\u7b7e\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u66f4\u52a0\u200b\u5168\u9762\u200b\u7684\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u641c\u7d22\u5f15\u64ce\u200b\u548c\u200b\u81ea\u52a8\u200b\u5185\u5bb9\u200b\u751f\u6210\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u200b\u5177\u6709\u200b\u91cd\u8981\u200b\u610f\u4e49\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) CLIP_vit_base_patch16_448_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.15 - PP-HGNetV2-B0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.98 39.6 PP-HGNetV2-B4_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.96 88.5 PP-HGNetV2-B6_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.25 286.5 PP-LCNet_x1_0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.96 29.4 ResNet50_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.50 108.9

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u652f\u6301\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline multi_label_image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b \u200b\u547d\u4ee4\u200b\u884c\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config multi_label_image_classification\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config multi_label_image_classification --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./multi_label_image_classification.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./multi_label_image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [21, 0, 30, 24], 'scores': [0.99257, 0.70596, 0.63001, 0.57852], 'label_names': ['bear', 'person', 'skis', 'backpack']}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"multi_label_image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/multi_label_image_classification.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/multi_label_image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002

POST /multilabel-image-classification

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b topK integer \u200b\u7ed3\u679c\u200b\u4e2d\u5c06\u200b\u53ea\u200b\u4fdd\u7559\u200b\u5f97\u5206\u200b\u6700\u9ad8\u200b\u7684\u200btopK\u200b\u4e2a\u200b\u7c7b\u522b\u200b\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b categories array \u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

categories\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b id integer \u200b\u7c7b\u522b\u200bID\u3002 name string \u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u3002 score number \u200b\u7c7b\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"\u200b\u5154\u5b50\u200b\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/multilabel-image-classification\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/multilabel-image-classification\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/multilabel-image-classification\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/multilabel-image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/multilabel-image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/multilabel-image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/multilabel-image-classification\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  model: PP-LCNet_x1_0_ML   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline multi_label_image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline multi_label_image_classification --input general_image_classification_001.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html","title":"\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#1","title":"1. \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5b83\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u533a\u5206\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u4e0d\u540c\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u7684\u200b\u7cbe\u786e\u200b\u5206\u5272\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5728\u200b\u540c\u4e00\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5206\u522b\u200b\u6807\u8bb0\u200b\u51fa\u200b\u6bcf\u200b\u4e00\u8f86\u8f66\u200b\u3001\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u4eba\u200b\u6216\u200b\u6bcf\u200b\u4e00\u53ea\u200b\u52a8\u7269\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5b83\u4eec\u200b\u5728\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u4e0a\u200b\u88ab\u200b\u72ec\u7acb\u200b\u5904\u7406\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u5305\u542b\u200b\u591a\u8f86\u200b\u8f66\u200b\u548c\u200b\u884c\u4eba\u200b\u7684\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u80fd\u591f\u200b\u5c06\u200b\u6bcf\u8f86\u8f66\u200b\u548c\u200b\u6bcf\u4e2a\u200b\u4eba\u200b\u7684\u200b\u8f6e\u5ed3\u200b\u6e05\u6670\u200b\u5730\u200b\u5206\u5f00\u200b\uff0c\u200b\u5f62\u6210\u200b\u591a\u4e2a\u200b\u72ec\u7acb\u200b\u7684\u200b\u533a\u57df\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u548c\u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bMask R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6765\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u7684\u200b\u50cf\u7d20\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u533a\u5206\u200b\uff0c\u200b\u4e3a\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u7684\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u652f\u6301\u200b\u3002

\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b15\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Cascade-MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.3 - - 254.8 M Cascade-MaskRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bMask RCNN\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ea7\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIOU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u68c0\u6d4b\u200b\u4e0e\u200b\u63a8\u7406\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 - - 254.7 M Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 36.8329 - 66.6 M Mask-RT-DETR-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.0 33.5007 - 51.8 M Mask-RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.6 - - 157.5 M Mask R-CNN\u200b\u662f\u200b\u7531\u200b\u534e\u76db\u987f\u200b\u9996\u4f8b\u200b\u5373\u73b0\u200b\u6295\u5f71\u200b\u5361\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5168\u200b\u4efb\u52a1\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u6a21\u578b\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u56fe\u7247\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9a\u4f4d\u200b\uff0c\u200b\u5e76\u200b\u7ed3\u5408\u200b\u56fe\u50cf\u200b\u7ea7\u200b\u7684\u200b\u906e\u7f69\u200b\uff08Mask\uff09\u200b\u6765\u200b\u5b8c\u6210\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u3002 MaskRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.4 - - 157.5 M MaskRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.8 - - 128.7 M MaskRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 370.0 M PP-YOLOE_seg-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.5 - - 31.5 M PP-YOLOE_seg \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u6cbf\u7528\u200b\u4e86\u200bPP-YOLOE\u200b\u7684\u200bbackbone\u200b\u548c\u200bhead\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bPP-YOLOE\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u5934\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SOLOv2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.5 - - 179.1 M SOLOv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u6309\u200b\u4f4d\u7f6e\u200b\u5206\u5272\u200b\u7269\u4f53\u200b\u7684\u200b\u5b9e\u65f6\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7b97\u6cd5\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u662f\u200bSOLO\u200b\u7684\u200b\u6539\u8fdb\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u63a9\u7801\u200b\u5b66\u4e60\u200b\u548c\u200b\u63a9\u7801\u200bNMS\uff0c\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u901f\u5ea6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u826f\u597d\u200b\u5e73\u8861\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config instance_segmentation\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config instance_segmentation --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./instance_segmentation.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./instance_segmentation.yaml --input general_instance_segmentation_004.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_instance_segmentation_004.png', 'boxes': [{'cls_id': 0, 'label': 'person', 'score': 0.8698326945304871, 'coordinate': [339, 0, 639, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8571141362190247, 'coordinate': [0, 0, 195, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8202633857727051, 'coordinate': [88, 113, 401, 574]}, {'cls_id': 0, 'label': 'person', 'score': 0.7108577489852905, 'coordinate': [522, 21, 767, 574]}, {'cls_id': 27, 'label': 'tie', 'score': 0.554280698299408, 'coordinate': [247, 311, 355, 574]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"instance_segmentation\")\n\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/instance_segmentation.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/instance_segmentation.yaml\")\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u3002

POST /instance-segmentation

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b instances array \u200b\u5b9e\u4f8b\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u7c7b\u522b\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

instances\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u5b9e\u4f8b\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 categoryId integer \u200b\u5b9e\u4f8b\u200b\u7c7b\u522b\u200bID\u3002 score number \u200b\u5b9e\u4f8b\u200b\u5f97\u5206\u200b\u3002 mask object \u200b\u5b9e\u4f8b\u200b\u7684\u200b\u5206\u5272\u200b\u63a9\u819c\u200b\u3002

mask\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b rleResult str \u200b\u63a9\u819c\u200b\u7684\u200b\u6e38\u7a0b\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 size array \u200b\u63a9\u819c\u200b\u7684\u200b\u5f62\u72b6\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u63a9\u819c\u200b\u7684\u200b\u9ad8\u5ea6\u200b\u548c\u200b\u5bbd\u5ea6\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"instances\": [\n{\n\"bbox\": [\n162.39381408691406,\n83.88176727294922,\n624.0797119140625,\n343.4986877441406\n],\n\"categoryId\": 33,\n\"score\": 0.8691174983978271,\n\"mask\": {\n\"rleResult\": \"xxxxxx\",\n\"size\": [\n259,\n462\n]\n}\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/instance-segmentation\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nInstances:\")\nprint(result[\"instances\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/instance-segmentation\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto instances = result[\"instances\"];\n        std::cout << \"\\nInstances:\" << std::endl;\n        for (const auto& inst : instances) {\n            std::cout << inst << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/instance-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode instances = result.get(\"instances\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nInstances: \" + instances.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/instance-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Instances []map[string]interface{} `json:\"instances\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nInstances:\")\n    for _, inst := range respData.Result.Instances {\n        fmt.Println(inst)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/instance-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nInstances:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"instances\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/instance-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nInstances:\");\n    console.log(result[\"instances\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/instance-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nInstances:\\n\";\nprint_r($result[\"instances\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: Mask-RT-DETR-S  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html","title":"\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#1","title":"1. \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002

\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b6\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b37\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b Cascade-FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.1 - - 245.4 M Cascade-FasterRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bFaster R-CNN\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8026\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIoU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u8bad\u7ec3\u200b\u548c\u200b\u9884\u6d4b\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.0 - - 246.2 M CenterNet-DLA-34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.6 - - 75.4 M CenterNet\u200b\u662f\u200b\u4e00\u79cd\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u628a\u200b\u5f85\u200b\u68c0\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u5173\u952e\u70b9\u200b\u89c6\u4e3a\u200b\u5355\u200b\u4e00\u70b9\u200b-\u200b\u5373\u200b\u5176\u200b\u8fb9\u754c\u200b\u6846\u200b\u7684\u200b\u4e2d\u5fc3\u70b9\u200b\uff0c\u200b\u5e76\u200b\u901a\u8fc7\u200b\u5173\u952e\u70b9\u200b\u8fdb\u884c\u200b\u56de\u5f52\u200b\u3002 CenterNet-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.9 - - 319.7 M DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.3 59.2132 5334.52 159.3 M DETR \u200b\u662f\u200bFacebook\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200btransformer\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200b\u4e0d\u200b\u9700\u8981\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u5148\u9a8c\u200b\u6846\u200banchor\u200b\u548c\u200bNMS\u200b\u7684\u200b\u540e\u5904\u7406\u200b\u7b56\u7565\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002 FasterRCNN-ResNet34-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.8 - - 137.5 M Faster R-CNN\u200b\u662f\u200b\u5178\u578b\u200b\u7684\u200btwo-stage\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5373\u200b\u5148\u751f\u200b\u6210\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff08Region Proposal\uff09\uff0c\u200b\u7136\u540e\u200b\u5728\u200b\u751f\u6210\u200b\u7684\u200bRegion Proposal\u200b\u4e0a\u200b\u505a\u200b\u5206\u7c7b\u200b\u548c\u200b\u56de\u5f52\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200b\u524d\u4ee3\u200bR-CNN\u200b\u548c\u200bFast R-CNN\uff0cFaster R-CNN\u200b\u7684\u200b\u6539\u8fdb\u200b\u4e3b\u8981\u200b\u5728\u4e8e\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u65b9\u9762\u200b\uff0c\u200b\u4f7f\u7528\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7f51\u7edc\u200b\uff08Region Proposal Network, RPN\uff09\u200b\u63d0\u4f9b\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff0c\u200b\u4ee5\u200b\u53d6\u4ee3\u200b\u4f20\u7edf\u200b\u9009\u62e9\u6027\u200b\u641c\u7d22\u200b\u3002RPN\u200b\u662f\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5e76\u200b\u4e0e\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u5171\u4eab\u200b\u56fe\u50cf\u200b\u7684\u200b\u5377\u79ef\u200b\u7279\u5f81\u200b\uff0c\u200b\u51cf\u5c11\u200b\u4e86\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7684\u200b\u8ba1\u7b97\u200b\u5f00\u9500\u200b\u3002 FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 148.1 M FasterRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.7 - - 120.2 M FasterRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 216.3 M FasterRCNN-ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 - - 159.8 M FCOS-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.6 103.367 3424.91 124.2 M FCOS\u200b\u662f\u200b\u4e00\u79cd\u200b\u5bc6\u96c6\u200b\u9884\u6d4b\u200b\u7684\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u4f7f\u7528\u200bRetinaNet\u200b\u7684\u200b\u9aa8\u67b6\u200b\uff0c\u200b\u76f4\u63a5\u200b\u5728\u200bfeature map\u200b\u4e0a\u200b\u56de\u5f52\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u957f\u5bbd\u200b\uff0c\u200b\u5e76\u200b\u9884\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u7c7b\u522b\u200b\u4ee5\u53ca\u200bcenterness\uff08feature map\u200b\u4e0a\u200b\u50cf\u7d20\u70b9\u200b\u79bb\u200b\u7269\u4f53\u200b\u4e2d\u5fc3\u200b\u7684\u200b\u504f\u79fb\u200b\u7a0b\u5ea6\u200b\uff09\uff0ccenterness\u200b\u6700\u7ec8\u200b\u4f1a\u200b\u4f5c\u4e3a\u200b\u6743\u91cd\u200b\u6765\u200b\u8c03\u6574\u200b\u7269\u4f53\u200b\u5f97\u5206\u200b\u3002 PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.5 16.2311 71.7257 16.8 M PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PicoDet-XS\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.7 57.8995 1439.93 349.4 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M RT-DETR-R18\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.5 19.89 784.824 70.7 M RT-DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.1 41.9327 1625.95 149.1 M RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 40.1055 883.041 219.7 M YOLOv3\u200b\u662f\u200b\u4e00\u79cd\u200b\u5b9e\u65f6\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u5b83\u200b\u4f7f\u7528\u200b\u4e00\u4e2a\u200b\u72ec\u7279\u200b\u7684\u200b\u5355\u4e2a\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c06\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u95ee\u9898\u200b\u5206\u89e3\u200b\u4e3a\u200b\u4e00\u4e2a\u200b\u56de\u5f52\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5b9e\u65f6\u200b\u7684\u200b\u68c0\u6d4b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u91c7\u7528\u200b\u4e86\u200b\u591a\u4e2a\u200b\u5c3a\u5ea6\u200b\u7684\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5c3a\u5ea6\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOv3-MobileNetV3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.6 31.6276 856.047 163.0 M YOLOX-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.1 185.691 1250.58 192.5 M YOLOX\u200b\u6a21\u578b\u200b\u4ee5\u200bYOLOv3\u200b\u4f5c\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u200b\u7684\u200b\u6846\u67b6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bDecoupled Head\u3001Data Aug\u3001Anchor Free\u200b\u4ee5\u53ca\u200bSimOTA\u200b\u7ec4\u4ef6\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u5404\u79cd\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOX-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.9 123.324 688.071 90.0 M YOLOX-N\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.1 79.1665 155.59 3.4 M YOLOX-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.4 184.828 474.446 32.0 M YOLOX-T\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.9 102.748 212.52 18.1 M YOLOX-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.8 227.361 2067.84 351.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config object_detection\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config object_detection --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./object_detection.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./object_detection.yaml --input general_object_detection_002.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_object_detection_002.png', 'boxes': [{'cls_id': 49, 'label': 'orange', 'score': 0.8188097476959229, 'coordinate': [661, 93, 870, 305]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7743489146232605, 'coordinate': [76, 274, 330, 520]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7270504236221313, 'coordinate': [285, 94, 469, 297]}, {'cls_id': 46, 'label': 'banana', 'score': 0.5570532083511353, 'coordinate': [310, 361, 685, 712]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5484835505485535, 'coordinate': [764, 285, 924, 440]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5160726308822632, 'coordinate': [853, 169, 987, 303]}, {'cls_id': 60, 'label': 'dining table', 'score': 0.5142655968666077, 'coordinate': [0, 0, 1072, 720]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5101479291915894, 'coordinate': [57, 23, 213, 176]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"object_detection\")\n\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu enable_hpi \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/object_detection.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/object_detection.yaml\")\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002

POST /object-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b detectedObjects array \u200b\u76ee\u6807\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u7c7b\u522b\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

detectedObjects\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u76ee\u6807\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 categoryId integer \u200b\u76ee\u6807\u200b\u7c7b\u522b\u200bID\u3002 score number \u200b\u76ee\u6807\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/object-detection\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/object-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/object-detection\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/object-detection\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PicoDet-S  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline object_detection --input general_object_detection_002.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html","title":"\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#1","title":"1. \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u529f\u80fd\u200b\uff0c\u200b\u7528\u4e8e\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u6807\u8bb0\u200b\u884c\u4eba\u200b\u7684\u200b\u7279\u5b9a\u200b\u7279\u5f81\u200b\uff0c\u200b\u5982\u200b\u6027\u522b\u200b\u3001\u200b\u5e74\u9f84\u200b\u3001\u200b\u8863\u7269\u200b\u989c\u8272\u200b\u548c\u200b\u6b3e\u5f0f\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u4efb\u52a1\u200b\u4e0d\u4ec5\u200b\u8981\u6c42\u200b\u51c6\u786e\u200b\u68c0\u6d4b\u200b\u51fa\u884c\u200b\u4eba\u200b\uff0c\u200b\u8fd8\u200b\u9700\u200b\u8bc6\u522b\u200b\u6bcf\u4e2a\u200b\u884c\u4eba\u200b\u7684\u200b\u8be6\u7ec6\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\u3002\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u8bc6\u522b\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u667a\u6167\u200b\u57ce\u5e02\u200b\u548c\u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u53ef\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u7cfb\u7edf\u200b\u7684\u200b\u667a\u80fd\u5316\u200b\u6c34\u5e73\u200b\u548c\u200b\u7ba1\u7406\u6548\u7387\u200b\u3002

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-L_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 48.0 81.9 32.8 777.7 196.02 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-S_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.5 77.9 15.0 179.3 28.79

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCrowdHuman\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_pedestrian_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b26\u200b\u4e2a\u200b\u7c7b\u522b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b mA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config pedestrian_attribute_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config pedestrian_attribute_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./pedestrian_attribute_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./pedestrian_attribute_recognition.yaml --input pedestrian_attribute_002.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"pedestrian_attribute_recognition\")\n\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/pedestrian_attribute_recognition*.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/pedestrian_attribute_recognition.yaml\")\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /pedestrian-attribute-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b pedestrians array \u200b\u884c\u4eba\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u53ca\u200b\u5c5e\u6027\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

pedestrians\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u884c\u4eba\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 attributes array \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u3002 score number \u200b\u68c0\u6d4b\u200b\u5f97\u5206\u200b\u3002

attributes\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u5c5e\u6027\u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u5206\u7c7b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/pedestrian-attribute-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected pedestrians:\")\nprint(result[\"pedestrians\"])\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u548c\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4e3b\u4f53\u200b\u76ee\u6807\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\u7684\u200b\u4e3b\u4f53\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  det_model: PP-YOLOE-L_human\n  cls_model: PP-LCNet_x1_0_pedestrian_attribute  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html","title":"\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#1","title":"1. \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bSegFormer\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6216\u200b\u89c6\u89c9\u200b\u53d8\u6362\u5668\u200b\uff08Transformer\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002

\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b18\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

\u200b\u4ee5\u4e0a\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

SeaFormer\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bADE20k\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config semantic_segmentation\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./semantic_segmentation.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./semantic_segmentation.yaml --input makassaridn-road_demo.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_object_detection_002.png'}\n
\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"semantic_segmentation\")\n\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu enable_hpi \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/semantic_segmentation.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3002

POST /semantic-segmentation

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b labelMap array \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u3002 size array \u200b\u56fe\u50cf\u200b\u5f62\u72b6\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u7684\u200b\u9ad8\u5ea6\u200b\u548c\u200b\u5bbd\u5ea6\u200b\u3002 image string \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"labelMap\": [\n0,\n0,\n1,\n2\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/semantic-segmentation\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n# result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/semantic-segmentation\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n            // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/semantic-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/semantic-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/semantic-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/semantic-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/semantic-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n// result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff08github\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u94fe\u63a5\u200b\u6807\u9898\u200b\uff09\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PP-LiteSeg-T  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#_2","title":"\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline semantic_segmentation --input semantic_segmentation/makassaridn-road_demo.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline semantic_segmentation --input semantic_segmentation/makassaridn-road_demo.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#1","title":"1. \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u4e13\u95e8\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u4f53\u79ef\u200b\u8f83\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u76d1\u63a7\u200b\u3001\u200b\u65e0\u4eba\u9a7e\u9a76\u200b\u548c\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u4ece\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e2d\u200b\u51c6\u786e\u200b\u627e\u5230\u200b\u5e76\u200b\u5206\u7c7b\u200b\u50cf\u200b\u884c\u4eba\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u6216\u200b\u5c0f\u200b\u52a8\u7269\u200b\u7b49\u200b\u5c0f\u200b\u5c3a\u5bf8\u200b\u7269\u4f53\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u63d0\u5347\u200b\u5bf9\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5728\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4e2d\u200b\u4e0d\u200b\u9057\u6f0f\u200b\u91cd\u8981\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u63d0\u9ad8\u200b\u5b89\u5168\u6027\u200b\u548c\u200b\u81ea\u52a8\u5316\u200b\u6c34\u5e73\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) PP-YOLOE_plus_SOD-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-largesize-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 458.521 11172.7 340.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u652f\u6301\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline small_object_detection --input small_object_detection.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config small_object_detection\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config small_object_detection --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./small_object_detection.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./small_object_detection.yaml --input small_object_detection.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'small_object_detection.jpg', 'boxes': [{'cls_id': 3, 'label': 'car', 'score': 0.9243856072425842, 'coordinate': [624, 638, 682, 741]}, {'cls_id': 3, 'label': 'car', 'score': 0.9206348061561584, 'coordinate': [242, 561, 356, 613]}, {'cls_id': 3, 'label': 'car', 'score': 0.9194547533988953, 'coordinate': [670, 367, 705, 400]}, {'cls_id': 3, 'label': 'car', 'score': 0.9162291288375854, 'coordinate': [459, 259, 523, 283]}, {'cls_id': 4, 'label': 'van', 'score': 0.9075379371643066, 'coordinate': [467, 213, 498, 242]}, {'cls_id': 4, 'label': 'van', 'score': 0.9066920876502991, 'coordinate': [547, 351, 577, 397]}, {'cls_id': 3, 'label': 'car', 'score': 0.9041045308113098, 'coordinate': [502, 632, 562, 736]}, {'cls_id': 3, 'label': 'car', 'score': 0.8934890627861023, 'coordinate': [613, 383, 647, 427]}, {'cls_id': 3, 'label': 'car', 'score': 0.8803309202194214, 'coordinate': [640, 280, 671, 309]}, {'cls_id': 3, 'label': 'car', 'score': 0.8727016448974609, 'coordinate': [1199, 256, 1259, 281]}, {'cls_id': 3, 'label': 'car', 'score': 0.8705748915672302, 'coordinate': [534, 410, 570, 461]}, {'cls_id': 3, 'label': 'car', 'score': 0.8654043078422546, 'coordinate': [669, 248, 702, 271]}, {'cls_id': 3, 'label': 'car', 'score': 0.8555219769477844, 'coordinate': [525, 243, 550, 270]}, {'cls_id': 3, 'label': 'car', 'score': 0.8522038459777832, 'coordinate': [526, 220, 553, 243]}, {'cls_id': 3, 'label': 'car', 'score': 0.8392605185508728, 'coordinate': [557, 141, 575, 158]}, {'cls_id': 3, 'label': 'car', 'score': 0.8353804349899292, 'coordinate': [537, 120, 553, 133]}, {'cls_id': 3, 'label': 'car', 'score': 0.8322211503982544, 'coordinate': [585, 132, 603, 147]}, {'cls_id': 3, 'label': 'car', 'score': 0.8298957943916321, 'coordinate': [701, 283, 736, 313]}, {'cls_id': 3, 'label': 'car', 'score': 0.8217393159866333, 'coordinate': [885, 347, 943, 377]}, {'cls_id': 3, 'label': 'car', 'score': 0.820313572883606, 'coordinate': [493, 150, 511, 168]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.8183429837226868, 'coordinate': [203, 701, 224, 743]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.815082848072052, 'coordinate': [185, 710, 201, 744]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7892289757728577, 'coordinate': [311, 371, 344, 407]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7812919020652771, 'coordinate': [345, 380, 388, 405]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7748346328735352, 'coordinate': [295, 500, 309, 532]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7688500285148621, 'coordinate': [851, 436, 863, 466]}, {'cls_id': 3, 'label': 'car', 'score': 0.7466475367546082, 'coordinate': [565, 114, 580, 128]}, {'cls_id': 3, 'label': 'car', 'score': 0.7156463265419006, 'coordinate': [483, 66, 495, 78]}, {'cls_id': 3, 'label': 'car', 'score': 0.704211950302124, 'coordinate': [607, 138, 642, 152]}, {'cls_id': 3, 'label': 'car', 'score': 0.7021926045417786, 'coordinate': [505, 72, 518, 83]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6897469162940979, 'coordinate': [802, 460, 815, 488]}, {'cls_id': 3, 'label': 'car', 'score': 0.671891450881958, 'coordinate': [574, 123, 593, 136]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.6712754368782043, 'coordinate': [445, 317, 472, 334]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6695684790611267, 'coordinate': [479, 309, 489, 332]}, {'cls_id': 3, 'label': 'car', 'score': 0.6273623704910278, 'coordinate': [654, 210, 677, 234]}, {'cls_id': 3, 'label': 'car', 'score': 0.6070230603218079, 'coordinate': [640, 166, 667, 185]}, {'cls_id': 3, 'label': 'car', 'score': 0.6064521670341492, 'coordinate': [461, 59, 476, 71]}, {'cls_id': 3, 'label': 'car', 'score': 0.5860581398010254, 'coordinate': [464, 87, 484, 100]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.5792551636695862, 'coordinate': [390, 390, 419, 408]}, {'cls_id': 3, 'label': 'car', 'score': 0.5559225678443909, 'coordinate': [481, 125, 496, 140]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5531904697418213, 'coordinate': [869, 306, 880, 331]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5468509793281555, 'coordinate': [895, 294, 904, 319]}, {'cls_id': 3, 'label': 'car', 'score': 0.5451828241348267, 'coordinate': [505, 94, 518, 108]}, {'cls_id': 3, 'label': 'car', 'score': 0.5398445725440979, 'coordinate': [657, 188, 681, 208]}, {'cls_id': 4, 'label': 'van', 'score': 0.5318890810012817, 'coordinate': [518, 88, 534, 102]}, {'cls_id': 3, 'label': 'car', 'score': 0.5296525359153748, 'coordinate': [527, 71, 540, 81]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.5168400406837463, 'coordinate': [528, 320, 563, 346]}, {'cls_id': 3, 'label': 'car', 'score': 0.5088561177253723, 'coordinate': [511, 84, 530, 95]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.502006471157074, 'coordinate': [841, 266, 850, 283]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"small_object_detection\")\n\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/small_object_detection.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/small_object_detection.yaml\")\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002

POST /small-object-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b detectedObjects array \u200b\u76ee\u6807\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u7c7b\u522b\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

detectedObjects\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u76ee\u6807\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 categoryId integer \u200b\u76ee\u6807\u200b\u7c7b\u522b\u200bID\u3002 score number \u200b\u76ee\u6807\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/small-object-detection\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/small-object-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& category : detectedObjects) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/small-object-detection\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/small-object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, category := range respData.Result.DetectedObjects {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/small-object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/small-object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/small-object-detection\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PP-YOLOE_plus_SOD-L  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#_2","title":"\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html","title":"\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#1","title":"1. \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u5176\u200b\u4e3b\u8981\u200b\u4efb\u52a1\u200b\u662f\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u6807\u8bb0\u200b\u51fa\u200b\u8f66\u8f86\u200b\u7684\u200b\u7279\u5b9a\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5982\u200b\u8f66\u8f86\u200b\u7c7b\u578b\u200b\u3001\u200b\u989c\u8272\u200b\u3001\u200b\u8f66\u724c\u53f7\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u4efb\u52a1\u200b\u4e0d\u4ec5\u200b\u8981\u6c42\u200b\u51c6\u786e\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u8f66\u8f86\u200b\uff0c\u200b\u8fd8\u200b\u9700\u200b\u8bc6\u522b\u200b\u6bcf\u8f86\u8f66\u200b\u7684\u200b\u8be6\u7ec6\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\u3002\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u8bc6\u522b\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u4ea4\u901a\u7ba1\u7406\u200b\u3001\u200b\u667a\u80fd\u200b\u505c\u8f66\u200b\u3001\u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u3001\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u7cfb\u7edf\u200b\u6548\u7387\u200b\u548c\u200b\u667a\u80fd\u5316\u200b\u6c34\u5e73\u200b\uff0c\u200b\u5e76\u200b\u63a8\u52a8\u200b\u4e86\u200b\u76f8\u5173\u200b\u884c\u4e1a\u200b\u7684\u200b\u53d1\u5c55\u200b\u4e0e\u200b\u521b\u65b0\u200b\u3002

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP 0.5:0.95 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-S_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 61.3 15.4 178.4 28.79 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-L_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.9 32.6 775.6 196.02

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bPPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_vehicle_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VeRi \u200b\u6570\u636e\u200b\u96c6\u200bmA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config vehicle_attribute_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config vehicle_attribute_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./vehicle_attribute_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./vehicle_attribute_recognition.yaml --input vehicle_attribute_002.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"vehicle_attribute_recognition\")\n\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/vehicle_attribute_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/vehicle_attribute_recognition.yaml\")\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /vehicle-attribute-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b vehicles array \u200b\u8f66\u8f86\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u53ca\u200b\u5c5e\u6027\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

vehicles\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u8f66\u8f86\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 attributes array \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u3002 score number \u200b\u68c0\u6d4b\u200b\u5f97\u5206\u200b\u3002

attributes\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u5c5e\u6027\u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u5206\u7c7b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/vehicle-attribute-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected vehicles:\")\nprint(result[\"vehicles\"])\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u548c\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4e3b\u4f53\u200b\u76ee\u6807\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\u7684\u200b\u4e3b\u4f53\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  det_model: PP-YOLOE-L_vehicle\n  cls_model: PP-LCNet_x1_0_vehicle_attribute  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html","title":"\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#1-v3","title":"1. \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u6587\u6863\u200b\u548c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u8bc6\u522b\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002

\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M SLANet_plus \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bSLANet\u200b\u7684\u200b\u589e\u5f3a\u7248\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200bSLANet\uff0cSLANet_plus \u200b\u5bf9\u200b\u65e0\u7ebf\u200b\u8868\u200b\u3001\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\u5f97\u5230\u200b\u4e86\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\uff0c\u200b\u5e76\u200b\u964d\u4f4e\u200b\u4e86\u200b\u6a21\u578b\u200b\u5bf9\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51c6\u786e\u6027\u200b\u7684\u200b\u654f\u611f\u5ea6\u200b\uff0c\u200b\u5373\u4f7f\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51fa\u73b0\u200b\u504f\u79fb\u200b\uff0c\u200b\u4e5f\u200b\u80fd\u591f\u200b\u8f83\u200b\u51c6\u786e\u200b\u5730\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MS-SSIM \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b UVDoc\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.40 30.3 M \u200b\u9ad8\u7cbe\u5ea6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u578b\u200b

\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b DocUNet benchmark\u3002

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_doc_ori\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 99.06 3.84845 9.23735 7 \u200b\u57fa\u4e8e\u200bPP-LCNet_x1_0\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u542b\u6709\u200b\u56db\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5373\u200b0\u200b\u5ea6\u200b\uff0c90\u200b\u5ea6\u200b\uff0c180\u200b\u5ea6\u200b\uff0c270\u200b\u5ea6\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8bc1\u4ef6\u200b\u548c\u200b\u6587\u6863\u200b\u7b49\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5305\u542b\u200b 1000 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
\u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u4ec5\u200b\u652f\u6301\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\u6216\u8005\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\u200b\u4e0a\u200b\u83b7\u53d6\u200b\u76f8\u5173\u200b\u7684\u200b ak/sk(access_token)\u3002\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bAK\u200b\u548c\u200bSK\u200b\u9274\u6743\u200b\u8c03\u7528\u200bAPI\u200b\u6d41\u7a0b\u200b \u200b\u83b7\u53d6\u200bak/sk\uff0c\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio \u200b\u8bbf\u95ee\u200b\u4ee4\u724c\u200b\u4e2d\u200b\u83b7\u53d6\u200b access_token\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

{'chat_res': {'\u200b\u4e59\u65b9\u200b': '\u200b\u80a1\u4efd\u200b\u6d4b\u8bd5\u200b\u6709\u9650\u516c\u53f8\u200b', '\u200b\u624b\u673a\u53f7\u200b': '19331729920'}, 'prompt': ''}\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u56db\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u8c03\u7528\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b pipeline str \u200b\u65e0\u200b \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\uff1b llm_name str \"ernie-3.5\" \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\uff0c\u200b\u76ee\u524d\u200b\u652f\u6301\u200bernie-4.0\uff0cernie-3.5\uff0c\u200b\u66f4\u200b\u591a\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u4e2d\u200b; llm_params dict {} LLM\u200b\u76f8\u5173\u200bAPI\u200b\u914d\u7f6e\u200b\uff1b device str\u3001None None \u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\uff08None\u200b\u4e3a\u200b\u81ea\u52a8\u200b\u9002\u914d\u200b\uff09,\u200b\u652f\u6301\u200b\u4f20\u5165\u200b'cpu'\uff0c'gpu'\u200b\u6216\u200b'gpu:0'\u200b\u7b49\u200b\uff1b

\uff082\uff09\u200b\u8c03\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b visual_predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u89c6\u89c9\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b input Python Var \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\uff1b input str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\uff1b input str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200burl\uff0c\u200b\u5982\u200bhttps://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\uff1b input str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\uff1b input dict \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u8981\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4e3a\u200b\"img\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b\uff1a{\"img\": \"/root/data1\"}\uff1b input list \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]\uff0c[\"/root/data1\", \"/root/data2\"]\uff0c[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]\uff1b use_doc_image_ori_cls_model bool True \u200b\u662f\u5426\u200b\u4f7f\u7528\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff1b use_doc_image_unwarp_model bool True \u200b\u662f\u5426\u200b\u4f7f\u7528\u200b\u7248\u9762\u200b\u77eb\u6b63\u200b\u4ea7\u7ebf\u200b\uff1b use_seal_text_det_model bool True \u200b\u662f\u5426\u200b\u4f7f\u7528\u200b\u5f2f\u66f2\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff1b

\uff083\uff09\u200b\u8c03\u7528\u200b\u89c6\u89c9\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5bf9\u8c61\u200b\u7684\u200b\u76f8\u5173\u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u89c6\u89c9\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5177\u4f53\u65b9\u6cd5\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u53c2\u6570\u200b \u200b\u65b9\u6cd5\u200b\u8bf4\u660e\u200b save_to_img save_path \u200b\u5c06\u200bOCR\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3001\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u7247\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53c2\u6570\u200bsave_path\u200b\u7528\u4e8e\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b save_to_html save_path \u200b\u5c06\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53c2\u6570\u200bsave_path\u200b\u7528\u4e8e\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b save_to_xlsx save_path \u200b\u5c06\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bxlsx\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53c2\u6570\u200bsave_path\u200b\u7528\u4e8e\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b

\uff084\uff09\u200b\u8c03\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b chat \u200b\u65b9\u6cd5\u200b\u4e0e\u200b\u5927\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u4ea4\u4e92\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b key_list str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u67e5\u8be2\u200b\u7684\u200b\u5173\u952e\u5b57\u200b\uff08query\uff09\uff1b\u200b\u652f\u6301\u200b\u201c\uff0c\u201d\u200b\u6216\u200b\u201c,\u201d\u200b\u4f5c\u4e3a\u200b\u5206\u9694\u7b26\u200b\u7684\u200b\u591a\u4e2a\u200b\u5173\u952e\u5b57\u200b\u7ec4\u6210\u200b\u7684\u200b\u5b57\u7b26\u4e32\u200b\uff0c\u200b\u5982\u200b\u201c\u200b\u4e59\u65b9\u200b\uff0c\u200b\u624b\u673a\u53f7\u200b\u201d\uff1b key_list list \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u67e5\u8be2\u200b\u7684\u200b\u5173\u952e\u5b57\u200b\uff08query\uff09\uff0c\u200b\u652f\u6301\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u5173\u952e\u5b57\u200b\uff0c\u200b\u5176\u200b\u5143\u7d20\u200b\u4e3a\u200bstr\u200b\u7c7b\u578b\u200b\uff1b

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u5373\u53ef\u200b\u5bf9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff1a

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b\u914d\u7f6e\u200b\u4e2d\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4fee\u6539\u200b\u4ea7\u7ebf\u200b\u5404\u200b\u6a21\u5757\u200b\u52a0\u8f7d\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u4fee\u6539\u200b\u4f7f\u7528\u200b\u7684\u200b\u5927\u200b\u6a21\u578b\u200b\u3002\u200b\u5404\u200b\u6a21\u5757\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8bf7\u200b\u53c2\u8003\u200b\u6a21\u5757\u200b\u6587\u6863\u200b\uff0c\u200b\u5927\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5217\u8868\u200b\u4e3a\u200b\uff1aernie-4.0\u3001ernie-3.5\u3001ernie-3.5-8k\u3001ernie-lite\u3001ernie-tiny-8k\u3001ernie-speed\u3001ernie-speed-128k\u3001ernie-char-8k\u3002

\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5e94\u7528\u200b\u914d\u7f6e\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/PP-ChatOCRv3-doc.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • analyzeImages

\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u83b7\u5f97\u200bOCR\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002

POST /chatocr-vision

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b file string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u6216\u200bPDF\u200b\u6587\u4ef6\u200b\u7684\u200bURL\uff0c\u200b\u6216\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u8d85\u8fc7\u200b10\u200b\u9875\u200b\u7684\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53ea\u6709\u200b\u524d\u200b10\u200b\u9875\u200b\u7684\u200b\u5185\u5bb9\u200b\u4f1a\u200b\u88ab\u200b\u4f7f\u7528\u200b\u3002 \u200b\u662f\u200b fileType integer \u200b\u6587\u4ef6\u7c7b\u578b\u200b\u30020\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c1\u200b\u8868\u793a\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u3002\u200b\u82e5\u200b\u8bf7\u6c42\u200b\u4f53\u65e0\u6b64\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5219\u200b\u670d\u52a1\u200b\u5c06\u200b\u5c1d\u8bd5\u200b\u6839\u636e\u200bURL\u200b\u81ea\u52a8\u200b\u63a8\u65ad\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u3002 \u200b\u5426\u200b useImgOrientationCls boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useImgUnwrapping boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useSealTextDet boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b visionResults array \u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u5f97\u5230\u200b\u7684\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u3002\u200b\u6570\u7ec4\u200b\u957f\u5ea6\u200b\u4e3a\u200b1\uff08\u200b\u5bf9\u4e8e\u200b\u56fe\u50cf\u200b\u8f93\u5165\u200b\uff09\u200b\u6216\u200b\u6587\u6863\u200b\u9875\u6570\u200b\u4e0e\u200b10\u200b\u4e2d\u200b\u7684\u200b\u8f83\u200b\u5c0f\u8005\u200b\uff08\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff09\u3002\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff0c\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6bcf\u200b\u4e00\u9875\u200b\u7684\u200b\u5904\u7406\u7ed3\u679c\u200b\u3002 visionInfo object \u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\uff0c\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002

visionResults\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 tables array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5185\u5bb9\u200b\u3002 inputImage string \u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002

tables\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 html string HTML\u200b\u683c\u5f0f\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002
  • buildVectorStore

\u200b\u6784\u5efa\u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u3002

POST /chatocr-vector

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b visionInfo object \u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002\u200b\u7531\u200banalyzeImages\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b minChars integer \u200b\u542f\u7528\u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u7684\u200b\u6700\u5c0f\u200b\u6570\u636e\u200b\u957f\u5ea6\u200b\u3002 \u200b\u5426\u200b llmRequestInterval number \u200b\u8c03\u7528\u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u7684\u200b\u95f4\u9694\u65f6\u95f4\u200b\u3002 \u200b\u5426\u200b llmName string \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\u3002 \u200b\u5426\u200b llmParams object \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

\u200b\u5f53\u524d\u200b\uff0cllmParams \u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5982\u4e0b\u200b\u5f62\u5f0f\u200b\u4e4b\u4e00\u200b\uff1a

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\",\n\"secretKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{\u200b\u661f\u6cb3\u200b\u793e\u533a\u200baccess token}\"\n}\n
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b vectorStore string \u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u5e8f\u5217\u5316\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002
  • retrieveKnowledge

\u200b\u8fdb\u884c\u200b\u77e5\u8bc6\u200b\u68c0\u7d22\u200b\u3002

POST /chatocr-retrieval

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b keys array \u200b\u5173\u952e\u8bcd\u200b\u5217\u8868\u200b\u3002 \u200b\u662f\u200b vectorStore string \u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u5e8f\u5217\u5316\u200b\u7ed3\u679c\u200b\u3002\u200b\u7531\u200bbuildVectorStore\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b llmName string \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\u3002 \u200b\u5426\u200b llmParams object \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

\u200b\u5f53\u524d\u200b\uff0cllmParams \u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5982\u4e0b\u200b\u5f62\u5f0f\u200b\u4e4b\u4e00\u200b\uff1a

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\",\n\"secretKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{\u200b\u661f\u6cb3\u200b\u793e\u533a\u200baccess token}\"\n}\n
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b retrievalResult string \u200b\u77e5\u8bc6\u200b\u68c0\u7d22\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002
  • chat

\u200b\u4e0e\u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u4ea4\u4e92\u200b\uff0c\u200b\u5229\u7528\u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u63d0\u70bc\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002

POST /chatocr-chat

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b keys array \u200b\u5173\u952e\u8bcd\u200b\u5217\u8868\u200b\u3002 \u200b\u662f\u200b visionInfo object \u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002\u200b\u7531\u200banalyzeImages\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b vectorStore string \u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u5e8f\u5217\u5316\u200b\u7ed3\u679c\u200b\u3002\u200b\u7531\u200bbuildVectorStore\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u5426\u200b retrievalResult string \u200b\u77e5\u8bc6\u200b\u68c0\u7d22\u200b\u7ed3\u679c\u200b\u3002\u200b\u7531\u200bretrieveKnowledge\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u5426\u200b taskDescription string \u200b\u63d0\u793a\u200b\u8bcd\u200b\u4efb\u52a1\u200b\u3002 \u200b\u5426\u200b rules string \u200b\u63d0\u793a\u200b\u8bcd\u200b\u89c4\u5219\u200b\u3002\u200b\u7528\u4e8e\u200b\u81ea\u5b9a\u4e49\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u89c4\u5219\u200b\uff0c\u200b\u4f8b\u5982\u200b\u89c4\u8303\u200b\u8f93\u51fa\u200b\u683c\u5f0f\u200b\u3002 \u200b\u5426\u200b fewShot string \u200b\u63d0\u793a\u200b\u8bcd\u200b\u793a\u4f8b\u200b\u3002 \u200b\u5426\u200b llmName string \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\u3002 \u200b\u5426\u200b llmParams object \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b returnPrompts boolean \u200b\u662f\u5426\u200b\u8fd4\u56de\u200b\u4f7f\u7528\u200b\u7684\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u7981\u7528\u200b\u3002 \u200b\u5426\u200b

\u200b\u5f53\u524d\u200b\uff0cllmParams \u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5982\u4e0b\u200b\u5f62\u5f0f\u200b\u4e4b\u4e00\u200b\uff1a

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\",\n\"secretKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{\u200b\u661f\u6cb3\u200b\u793e\u533a\u200baccess token}\"\n}\n
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b chatResult object \u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7ed3\u679c\u200b\u3002 prompts object \u200b\u4f7f\u7528\u200b\u7684\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002

prompts\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b ocr string OCR\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002 table string \u200b\u8868\u683c\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002 html string HTML\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\nAPI_KEY = \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\"\nSECRET_KEY = \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\nLLM_NAME = \"ernie-3.5\"\nLLM_PARAMS = {\n    \"apiType\": \"qianfan\",\n    \"apiKey\": API_KEY,\n    \"secretKey\": SECRET_KEY,\n}\n\nfile_path = \"./demo.jpg\"\nkeys = [\"\u200b\u7535\u8bdd\u200b\"]\n\nwith open(file_path, \"rb\") as file:\n    file_bytes = file.read()\n    file_data = base64.b64encode(file_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": file_data,\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\nresp_vision = requests.post(url=f\"{API_BASE_URL}/chatocr-vision\", json=payload)\nif resp_vision.status_code != 200:\n    print(\n        f\"Request to chatocr-vision failed with status code {resp_vision.status_code}.\"\n    )\n    pprint.pp(resp_vision.json())\n    sys.exit(1)\nresult_vision = resp_vision.json()[\"result\"]\n\nfor i, res in enumerate(result_vision[\"visionResults\"]):\n    print(\"Texts:\")\n    pprint.pp(res[\"texts\"])\n    print(\"Tables:\")\n    pprint.pp(res[\"tables\"])\n    ocr_img_path = f\"ocr_{i}.jpg\"\n    with open(ocr_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"ocrImage\"]))\n    layout_img_path = f\"layout_{i}.jpg\"\n    with open(layout_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"layoutImage\"]))\n    print(f\"Output images saved at {ocr_img_path} and {layout_img_path}\")\n\npayload = {\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"minChars\": 200,\n    \"llmRequestInterval\": 1000,\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_vector = requests.post(url=f\"{API_BASE_URL}/chatocr-vector\", json=payload)\nif resp_vector.status_code != 200:\n    print(\n        f\"Request to chatocr-vector failed with status code {resp_vector.status_code}.\"\n    )\n    pprint.pp(resp_vector.json())\n    sys.exit(1)\nresult_vector = resp_vector.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_retrieval = requests.post(url=f\"{API_BASE_URL}/chatocr-retrieval\", json=payload)\nif resp_retrieval.status_code != 200:\n    print(\n        f\"Request to chatocr-retrieval failed with status code {resp_retrieval.status_code}.\"\n    )\n    pprint.pp(resp_retrieval.json())\n    sys.exit(1)\nresult_retrieval = resp_retrieval.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"retrievalResult\": result_retrieval[\"retrievalResult\"],\n    \"taskDescription\": \"\",\n    \"rules\": \"\",\n    \"fewShot\": \"\",\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n    \"returnPrompts\": True,\n}\nresp_chat = requests.post(url=f\"{API_BASE_URL}/chatocr-chat\", json=payload)\nif resp_chat.status_code != 200:\n    print(\n        f\"Request to chatocr-chat failed with status code {resp_chat.status_code}.\"\n    )\n    pprint.pp(resp_chat.json())\n    sys.exit(1)\nresult_chat = resp_chat.json()[\"result\"]\nprint(\"\\nPrompts:\")\npprint.pp(result_chat[\"prompts\"])\nprint(\"Final result:\")\nprint(result_chat[\"chatResult\"])\n
\u200b\u6ce8\u200b\uff1a\u200b\u8bf7\u200b\u5728\u200b `API_KEY`\u3001`SECRET_KEY` \u200b\u5904\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200b API key \u200b\u548c\u200b secret key\u3002

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u516d\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\uff09\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u9519\u8bef\u200b\uff08\u200b\u5982\u200b\u884c\u5217\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\u3001\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u7248\u9762\u200b\u4e2d\u200b\u5b58\u5728\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff08\u200b\u4f8b\u5982\u200b\u5bf9\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u542b\u200b\u6587\u5b57\u200b\u533a\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u6216\u200b\u8bc1\u4ef6\u200b\u7684\u200b\u65b9\u5411\u200b\u5b58\u5728\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  layout_model: RT-DETR-H_layout_3cls  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  table_model: SLANet_plus  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_server_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_server_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  seal_text_det_model: PP-OCRv4_server_seal_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_ori_cls_model: null   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_unwarp_model: null   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n......\n

\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU \u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u8bbe\u7f6e\u200b device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u4ece\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u66f4\u200b\u6539\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b\u811a\u672c\u200b\u4e2d\u200b\u7684\u200b device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu \u200b\u5373\u53ef\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"},\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html","title":"\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#1-ocr","title":"1. OCR\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002

\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002

\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72\u200b

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u4ece\u200b\u4e91\u7aef\u200b\u4e0b\u8f7d\u200b\u90e8\u7f72\u200b\u5305\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b2.2\u200b\u8282\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u3002\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u2757 \u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"
  • \u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200bOCR\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200bOCR\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200bPython\u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200bOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config OCR\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0cOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b./my_path\uff09\uff1a

paddlex --get_pipeline_config OCR --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./OCR.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./OCR.yaml --input general_ocr_002.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_ocr_002.png', 'dt_polys': [[[5, 12], [88, 10], [88, 29], [5, 31]], [[208, 14], [249, 14], [249, 22], [208, 22]], [[695, 15], [824, 15], [824, 60], [695, 60]], [[158, 27], [355, 23], [356, 70], [159, 73]], [[421, 25], [659, 19], [660, 59], [422, 64]], [[337, 104], [460, 102], [460, 127], [337, 129]], [[486, 103], [650, 100], [650, 125], [486, 128]], [[675, 98], [835, 94], [835, 119], [675, 124]], [[64, 114], [192, 110], [192, 131], [64, 134]], [[210, 108], [318, 106], [318, 128], [210, 130]], [[82, 140], [214, 138], [214, 163], [82, 165]], [[226, 136], [328, 136], [328, 161], [226, 161]], [[404, 134], [432, 134], [432, 161], [404, 161]], [[509, 131], [570, 131], [570, 158], [509, 158]], [[730, 138], [771, 138], [771, 154], [730, 154]], [[806, 136], [817, 136], [817, 146], [806, 146]], [[342, 175], [470, 173], [470, 197], [342, 199]], [[486, 173], [616, 171], [616, 196], [486, 198]], [[677, 169], [813, 166], [813, 191], [677, 194]], [[65, 181], [170, 177], [171, 202], [66, 205]], [[96, 208], [171, 205], [172, 230], [97, 232]], [[336, 220], [476, 215], [476, 237], [336, 242]], [[507, 217], [554, 217], [554, 236], [507, 236]], [[87, 229], [204, 227], [204, 251], [87, 254]], [[344, 240], [483, 236], [483, 258], [344, 262]], [[66, 252], [174, 249], [174, 271], [66, 273]], [[75, 279], [264, 272], [265, 297], [76, 303]], [[459, 297], [581, 295], [581, 320], [459, 322]], [[101, 314], [210, 311], [210, 337], [101, 339]], [[68, 344], [165, 340], [166, 365], [69, 368]], [[345, 350], [662, 346], [662, 368], [345, 371]], [[100, 459], [832, 444], [832, 465], [100, 480]]], 'dt_scores': [0.8183103704439653, 0.7609575621092027, 0.8662357274035412, 0.8619508290334809, 0.8495855993183273, 0.8676840017933314, 0.8807986687956436, 0.822308525056085, 0.8686617037621976, 0.8279022169854463, 0.952332847006758, 0.8742692553015098, 0.8477013022907575, 0.8528771493227294, 0.7622965906848765, 0.8492388224448705, 0.8344203789965632, 0.8078477124353284, 0.6300434587457232, 0.8359967356998494, 0.7618617265751318, 0.9481573079350023, 0.8712182945408912, 0.837416955846334, 0.8292475059403851, 0.7860382856406026, 0.7350527486717117, 0.8701022267947695, 0.87172526903969, 0.8779847108088126, 0.7020437651809734, 0.6611684983372949], 'rec_text': ['www.997', '151', 'PASS', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', '\u200b\u8231\u4f4d\u200b CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200bSEATNO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200bDATE', 'MU 2379', '03DEC', 'W', '035', 'F', '1', '\u200b\u59cb\u53d1\u5730\u200bFROM', '\u200b\u767b\u673a\u53e3\u200b GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO.', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO.', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE1OMINUTESBEFOREDEPARTURETIME'], 'rec_score': [0.9617719054222107, 0.4199012815952301, 0.9652514457702637, 0.9978302121162415, 0.9853208661079407, 0.9445787072181702, 0.9714463949203491, 0.9841841459274292, 0.9564052224159241, 0.9959094524383545, 0.9386572241783142, 0.9825271368026733, 0.9356589317321777, 0.9985442161560059, 0.3965512812137604, 0.15236201882362366, 0.9976775050163269, 0.9547433257102966, 0.9974752068519592, 0.9646636843681335, 0.9907559156417847, 0.9895358681678772, 0.9374122023582458, 0.9909093379974365, 0.9796401262283325, 0.9899340271949768, 0.992210865020752, 0.9478569626808167, 0.9982215762138367, 0.9924325942993164, 0.9941263794898987, 0.96443772315979]}\n......\n
\u200b\u5176\u4e2d\u200b\uff0cdt_polys\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u6846\u200b\u5750\u6807\u200b\uff0cdt_polys\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u6846\u200b\u5750\u6807\u200b\uff0cdt_scores\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u6587\u672c\u6846\u200b\u7684\u200b\u7f6e\u4fe1\u5ea6\u200b\uff0crec_text\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\uff0crec_score\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u6587\u672c\u200b\u7684\u200b\u7f6e\u4fe1\u5ea6\u200b

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a \u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"
  • \u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u2757 Python\u200b\u811a\u672c\u200b\u8fd0\u884c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b OCR \u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200bOCR\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/OCR.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/OCR.yaml\")\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u56fe\u50cf\u200bOCR\u200b\u7ed3\u679c\u200b\u3002

POST /ocr

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 image string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6807\u6ce8\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"\u200b\u5317\u4eac\u200b\u5357\u7ad9\u200b\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"\u200b\u5929\u6d25\u7ad9\u200b\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  text_det_model: PP-OCRv4_mobile_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_mobile_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4e3a\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8bbe\u7f6e\u200b\u5355\u72ec\u200b\u7684\u200bbatch_size\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline OCR --input general_ocr_002.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html","title":"\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#1","title":"1. \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200bLaTeX\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u5b66\u200b\u3001\u200b\u7269\u7406\u200b\u3001\u200b\u8ba1\u7b97\u673a\u79d1\u5b66\u200b\u7b49\u200b\u9886\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u7f16\u8f91\u200b\u548c\u200b\u6570\u636e\u5206\u6790\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6570\u5b66\u516c\u5f0f\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200bLaTeX\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002

\u200b\u901a\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.126 3827.25 470.2M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b BLEU score normed edit distance ExpRate \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b LaTeX_OCR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.8821 0.0823 40.01 - - 89.7 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u652f\u6301\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config formula_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config formula_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./formula_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./formula_recognition.yaml --input general_formula_recognition.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': 'general_formula_recognition.png', 'layout_result': {'input_path': 'general_formula_recognition.png', 'boxes': [{'cls_id': 3, 'label': 'number', 'score': 0.7580855488777161, 'coordinate': [1028.3635, 205.46213, 1038.953, 222.99033]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.8882032632827759, 'coordinate': [272.75305, 204.50894, 433.7473, 226.17996]}, {'cls_id': 2, 'label': 'text', 'score': 0.9685840606689453, 'coordinate': [272.75928, 282.17773, 1041.9316, 374.44687]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559416770935059, 'coordinate': [272.39056, 385.54114, 1044.1521, 443.8598]}, {'cls_id': 2, 'label': 'text', 'score': 0.9610629081726074, 'coordinate': [272.40817, 467.2738, 1045.1033, 563.4855]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8916195034980774, 'coordinate': [503.45743, 594.6236, 1040.6804, 619.73895]}, {'cls_id': 2, 'label': 'text', 'score': 0.973675549030304, 'coordinate': [272.32007, 648.8599, 1040.8702, 775.15686]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9038916230201721, 'coordinate': [554.2307, 803.5825, 1040.4657, 855.3159]}, {'cls_id': 2, 'label': 'text', 'score': 0.9025381803512573, 'coordinate': [272.535, 875.1402, 573.1086, 898.3587]}, {'cls_id': 2, 'label': 'text', 'score': 0.8336610794067383, 'coordinate': [317.48013, 909.60864, 966.8498, 933.7868]}, {'cls_id': 2, 'label': 'text', 'score': 0.8779091238975525, 'coordinate': [19.704018, 653.322, 72.433235, 1215.1992]}, {'cls_id': 2, 'label': 'text', 'score': 0.8832409977912903, 'coordinate': [272.13028, 958.50806, 1039.7928, 1019.476]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9088466167449951, 'coordinate': [517.1226, 1042.3978, 1040.2208, 1095.7457]}, {'cls_id': 2, 'label': 'text', 'score': 0.9587949514389038, 'coordinate': [272.03336, 1112.9269, 1041.0201, 1206.8417]}, {'cls_id': 2, 'label': 'text', 'score': 0.8885666131973267, 'coordinate': [271.7495, 1231.8752, 710.44495, 1255.7981]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8907185196876526, 'coordinate': [581.2295, 1287.4525, 1039.8014, 1312.772]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559596180915833, 'coordinate': [273.1827, 1341.421, 1041.0299, 1401.7255]}, {'cls_id': 2, 'label': 'text', 'score': 0.875311553478241, 'coordinate': [272.8338, 1427.3711, 789.7108, 1451.1359]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9152213931083679, 'coordinate': [524.9582, 1474.8136, 1041.6333, 1530.7142]}, {'cls_id': 2, 'label': 'text', 'score': 0.9584835767745972, 'coordinate': [272.81665, 1549.524, 1042.9962, 1608.7157]}]}, 'ocr_result': {}, 'table_result': [], 'dt_polys': [array([[ 503.45743,  594.6236 ],\n       [1040.6804 ,  594.6236 ],\n       [1040.6804 ,  619.73895],\n       [ 503.45743,  619.73895]], dtype=float32), array([[ 554.2307,  803.5825],\n       [1040.4657,  803.5825],\n       [1040.4657,  855.3159],\n       [ 554.2307,  855.3159]], dtype=float32), array([[ 517.1226, 1042.3978],\n       [1040.2208, 1042.3978],\n       [1040.2208, 1095.7457],\n       [ 517.1226, 1095.7457]], dtype=float32), array([[ 581.2295, 1287.4525],\n       [1039.8014, 1287.4525],\n       [1039.8014, 1312.772 ],\n       [ 581.2295, 1312.772 ]], dtype=float32), array([[ 524.9582, 1474.8136],\n       [1041.6333, 1474.8136],\n       [1041.6333, 1530.7142],\n       [ 524.9582, 1530.7142]], dtype=float32)], 'rec_formula': ['F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)', 'p(\\mathbf{x})=c(\\mathbf{u})\\prod_{i}p(x_{i}).\\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\quad~~\\quad~~~~~~~~~~~~~~~(2)', 'H_{c}({\\bf x})=-\\int_{{\\bf{u}}}c({\\bf{u}})\\log c({\\bf{u}})d{\\bf{u}}.~~~~~~~~~~~~~~~~~~~~~(3)', 'I({\\bf x})=-H_{c}({\\bf x}).\\qquad\\qquad\\qquad\\qquad(4)', 'H({\\bf x})=\\sum_{i}H(x_{i})+H_{c}({\\bf x}).\\eqno\\qquad\\qquad\\qquad(5)']}\n

\u200b\u5176\u4e2d\u200b\uff0cdt_polys\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u533a\u57df\u200b\u5750\u6807\u200b\uff0c rec_formula\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u3002

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u9700\u8981\u200b\u5355\u72ec\u200b\u914d\u7f6e\u200b\u73af\u5883\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u53c2\u8003\u200b2.3 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u89c6\u5316\u200b \u200b\u5bf9\u200bLaTeX\u200b\u6e32\u67d3\u200b\u5f15\u64ce\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n

\u2757 Python\u200b\u811a\u672c\u200b\u8fd0\u884c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/formula_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/formula_recognition.yaml\")\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#23","title":"2.3 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u89c6\u5316","text":"

\u200b\u5982\u679c\u200b\u60a8\u200b\u9700\u8981\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316\u200b\uff0c\u200b\u9700\u8981\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u6765\u200b\u5bf9\u200bLaTeX\u200b\u6e32\u67d3\u200b\u73af\u5883\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\uff1a

apt-get install sudo\nsudo apt-get update\nsudo apt-get install texlive\nsudo apt-get install texlive-latex-base\nsudo apt-get install texlive-latex-extra\n
\u200b\u4e4b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200b save_to_img \u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\u3002\u200b\u5177\u4f53\u200b\u547d\u4ee4\u200b\u5982\u4e0b\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
\u200b\u5907\u6ce8\u200b\uff1a \u200b\u7531\u4e8e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u9700\u8981\u200b\u5bf9\u200b\u6bcf\u5f20\u200b\u516c\u5f0f\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u6e32\u67d3\u200b\uff0c\u200b\u56e0\u6b64\u200b\u8017\u65f6\u200b\u8f83\u957f\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u8010\u5fc3\u200b\u7b49\u5f85\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u56fe\u50cf\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /formula-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b formulas array \u200b\u516c\u5f0f\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5185\u5bb9\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

formulas\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u516c\u5f0f\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 latex string \u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"formulas\": [\n{\n\"poly\": [\n[\n444.0,\n244.0\n],\n[\n705.4,\n244.5\n],\n[\n705.8,\n311.3\n],\n[\n444.1,\n311.0\n]\n],\n\"latex\": \"F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)\"\n}\n],\n\"layoutImage\": \"xxxxxx\",\n\"ocrImage\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/formula-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected formulas:\")\nprint(result[\"formulas\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/formula-recognition\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto formulas = result[\"formulas\"];\n        std::cout << \"\\nDetected formulas:\" << std::endl;\n        for (const auto& formula : formulas) {\n            std::cout << formula << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/formula-recognition\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String layoutImagePath = \"./layout.jpg\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode formulas = result.get(\"formulas\");\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected formulas: \" + formulas.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/formula-recognition\"\n    imagePath := \"./demo.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            LayoutImage      string   `json:\"layoutImage\"`\n            Formulas []map[string]interface{} `json:\"formulas\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected formulas:\")\n    for _, formula := range respData.Result.Formulas {\n        fmt.Println(formula)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/formula-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected formulas:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"formulas\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/formula-recognition'\nconst imagePath = './demo.jpg'\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected formulas:\");\n    console.log(result[\"formulas\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/formula-recognition\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected formulas:\\n\";\nprint_r($result[\"formulas\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u516c\u5f0f\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u516c\u5f0f\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  layout_model: RT-DETR-H_layout_17cls #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  formula_rec_model: LaTeX_OCR_rec #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  formula_rec_batch_size: 5\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2. \u200b\u5feb\u901f\u200b\u5f00\u59cb\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html","title":"\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#1","title":"1. \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u662f\u200b\u4e00\u79cd\u200b\u4ece\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u7ed3\u6784\u5316\u200b\u4fe1\u606f\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u4e3b\u8981\u200b\u7528\u4e8e\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6587\u6863\u200b\u7248\u9762\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u673a\u5668\u200b\u53ef\u8bfb\u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u6587\u6863\u200b\u7ba1\u7406\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u200b\u6570\u5b57\u5316\u200b\u7b49\u200b\u9886\u57df\u200b\u5177\u6709\u200b\u5e7f\u6cdb\u200b\u7684\u200b\u5e94\u7528\u200b\u3002\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff08OCR\uff09\u3001\u200b\u56fe\u50cf\u5904\u7406\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u5757\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u6bb5\u843d\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u4ee5\u53ca\u200b\u5176\u4ed6\u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u3002\u200b\u6b64\u200b\u8fc7\u7a0b\u200b\u901a\u5e38\u200b\u5305\u62ec\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u5143\u7d20\u200b\u5206\u6790\u200b\u548c\u200b\u6570\u636e\u200b\u683c\u5f0f\u5316\u200b\u4e09\u4e2a\u200b\u4e3b\u8981\u200b\u6b65\u9aa4\u200b\uff0c\u200b\u6700\u7ec8\u200b\u751f\u6210\u200b\u7ed3\u6784\u5316\u200b\u7684\u200b\u6587\u6863\u200b\u6570\u636e\u200b\uff0c\u200b\u63d0\u5347\u200b\u6570\u636e\u5904\u7406\u200b\u7684\u200b\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002

\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M SLANet_plus \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bSLANet\u200b\u7684\u200b\u589e\u5f3a\u7248\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200bSLANet\uff0cSLANet_plus \u200b\u5bf9\u200b\u65e0\u7ebf\u200b\u8868\u200b\u3001\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\u5f97\u5230\u200b\u4e86\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\uff0c\u200b\u5e76\u200b\u964d\u4f4e\u200b\u4e86\u200b\u6a21\u578b\u200b\u5bf9\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51c6\u786e\u6027\u200b\u7684\u200b\u654f\u611f\u5ea6\u200b\uff0c\u200b\u5373\u4f7f\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51fa\u73b0\u200b\u504f\u79fb\u200b\uff0c\u200b\u4e5f\u200b\u80fd\u591f\u200b\u8f83\u200b\u51c6\u786e\u200b\u5730\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b BLEU score normed edit distance ExpRate \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b LaTeX_OCR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.8821 0.0823 40.01 - - 89.7 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MS-SSIM \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b UVDoc\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.40 30.3 M \u200b\u9ad8\u7cbe\u5ea6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u578b\u200b

\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b DocUNet benchmark\u3002

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_doc_ori\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 99.06 3.84845 9.23735 7 \u200b\u57fa\u4e8e\u200bPP-LCNet_x1_0\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u542b\u6709\u200b\u56db\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5373\u200b0\u200b\u5ea6\u200b\uff0c90\u200b\u5ea6\u200b\uff0c180\u200b\u5ea6\u200b\uff0c270\u200b\u5ea6\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8bc1\u4ef6\u200b\u548c\u200b\u6587\u6863\u200b\u7b49\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5305\u542b\u200b 1000 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline layout_parsing --input demo_paper.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config layout_parsing\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config layout_parsing --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./layout_parsing.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./layout_parsing.yaml --input layout_parsing.jpg\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': PosixPath('/root/.paddlex/temp/tmp5jmloefs.png'), 'parsing_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmpshsq8_w0.png'), 'layout_bbox': [51.46833, 74.22329, 542.4082, 232.77504], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [213, 221, 238],\n        [217, 223, 240],\n        [233, 234, 241]],\n\n       [[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpcd2q9uyu.png'), 'layout_bbox': [47.68295, 243.08054, 546.28253, 295.71045], 'figure_title': 'Overview of RT-DETR, We feed th', 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpr_iqa8b3.png'), 'layout_bbox': [58.416977, 304.1531, 275.9134, 400.07513], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmphpblxl3p.png'), 'layout_bbox': [100.62961, 405.97458, 234.79774, 414.77414], 'figure_title': 'Figure 5. The fusion block in CCFF.', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmplgnczrsf.png'), 'layout_bbox': [47.81724, 421.9041, 288.01566, 550.538], 'text': 'D, Ds, not only significantly reduces latency (35% faster),\\nRut\\nnproves accuracy (0.4% AP higher), CCFF is opti\\nased on the cross-scale fusion module, which\\nnsisting of convolutional lavers intc\\npath.\\nThe role of the fusion block is t\\n into a new feature, and its\\nFigure 5. The f\\nblock contains tw\\n1 x1\\nchannels, /V RepBlock\\n. anc\\n: two-path outputs are fused by element-wise add. We\\ntormulate the calculation ot the hvbrid encoder as:', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpsq0ey9md.png'), 'layout_bbox': [94.60716, 558.703, 288.04193, 600.19434], 'formula': '\\\\begin{array}{l}{{\\\\Theta=K=\\\\mathrm{p.s.sp{\\\\pm}}\\\\mathrm{i.s.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}}),{\\\\qquad\\\\mathrm{{a.s.}}\\\\mathrm{s.}}}\\\\\\\\ {{\\\\tau_{\\\\mathrm{{s.s.s.s.s.}}(\\\\mathrm{l.s.},\\\\mathrm{l.s.},\\\\mathrm{s.s.}}\\\\mathrm{s.}\\\\mathrm{s.}}\\\\end{array}),}}\\\\\\\\ {{\\\\bar{\\\\mathrm{e-c.c.s.s.}(\\\\mathrm{s.},\\\\mathrm{s.s.},\\\\ s_{s}}\\\\mathrm{s.s.},\\\\tau),}}\\\\end{array}', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpv30qy0v4.png'), 'layout_bbox': [47.975555, 607.12024, 288.5776, 629.1252], 'text': 'tened feature to the same shape as Ss.\\nwhere Re shape represents restoring the shape of the flat-', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp0jejzwwv.png'), 'layout_bbox': [48.383354, 637.581, 245.96404, 648.20496], 'paragraph_title': '4.3. Uncertainty-minimal Query Selection', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpushex416.png'), 'layout_bbox': [47.80134, 656.002, 288.50192, 713.24994], 'text': 'To reduce the difficulty of optimizing object queries in\\nDETR, several subsequent works [42, 44, 45] propose query\\nselection schemes, which have in common that they use the\\nconfidence score to select the top K\u2019 features from the en-\\ncoder to initialize object queries (or just position queries).', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpki7e_6wc.png'), 'layout_bbox': [306.6371, 302.1026, 546.3772, 419.76724], 'text': 'The confidence score represents the likelihood that the fea\\nture includes foreground objects. Nevertheless, the \\nare required to simultaneously model the category\\nojects, both of which determine the quality of the\\npertor\\ncore of the fes\\nBased on the analysis, the current query\\n considerable level of uncertainty in the\\nresulting in sub-optimal initialization for\\nand hindering the performance of the detector.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmppbxrfehp.png'), 'layout_bbox': [306.0642, 422.7347, 546.9216, 539.45734], 'text': 'To address this problem, we propose the uncertainty mini\\nmal query selection scheme, which explicitly const\\noptim\\n the epistemic uncertainty to model the\\nfeatures, thereby providing \\nhigh-quality\\nr the decoder. Specifically,\\n the discrepancy between i\\nalization P\\nand classificat\\n.(2\\ntunction for the gradie', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp1mgiyd21.png'), 'layout_bbox': [331.52808, 549.32635, 546.5229, 586.15546], 'formula': '\\\\begin{array}{c c c}{{}}&{{}}&{{\\\\begin{array}{c}{{i\\\\langle X\\\\rangle=({\\\\bar{Y}}({\\\\bar{X}})+{\\\\bar{Z}}({\\\\bar{X}})\\\\mid X\\\\in{\\\\bar{\\\\pi}}^{\\\\prime}}}&{{}}\\\\\\\\ {{}}&{{}}&{{}}\\\\end{array}}}&{{\\\\emptyset}}\\\\\\\\ {{}}&{{}}&{{C(\\\\bar{X},{\\\\bar{X}})=C..\\\\scriptstyle(\\\\bar{0},{\\\\bar{Y}})+{\\\\mathcal{L}}_{{\\\\mathrm{s}}}({\\\\bar{X}}),\\\\ 6)}}&{{}}\\\\end{array}', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp8t73dpym.png'), 'layout_bbox': [306.44016, 592.8762, 546.84314, 630.60126], 'text': 'where  and y denote the prediction and ground truth,\\n= (c, b), c and b represent the category and bounding\\nbox respectively, X represent the encoder feature.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpftnxeyjm.png'), 'layout_bbox': [306.15652, 632.3142, 546.2463, 713.19073], 'text': 'Effectiveness analysis. To analyze the effectiveness of the\\nuncertainty-minimal query selection, we visualize the clas-\\nsificatior\\nscores and IoU scores of the selected fe\\nCOCO\\na 12017, Figure 6. We draw the scatterplo\\nt with\\ndots\\nrepresent the selected features from the model trained\\nwith uncertainty-minimal query selection and vanilla query', 'layout': 'right'}]}\n

\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u89e3\u6790\u200b\u540e\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\uff0c\u200b\u76f8\u5173\u200b\u529f\u80fd\u200b\u652f\u6301\u200b\u4e2d\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u7ed3\u6784\u5316\u200b\u7684\u200bjson\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"layout_parsing\")\n\noutput = pipeline.predict(\"demo_paper.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200bhtml\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bimg\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u5176\u4e2d\u200b\uff0csave_to_img \u200b\u80fd\u591f\u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\uff08\u200b\u5305\u62ec\u200bOCR\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\uff09\uff0c save_to_html \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u76f4\u63a5\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\uff09\uff0csave_to_xlsx \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bExcel\u200b\u683c\u5f0f\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u683c\u5f0f\u200b\uff09\u3002

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/layout_parsing.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/layout_parsing.yaml\")\noutput = pipeline.predict(\"layout_parsing.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u4ea7\u7ebf\u200b\u5404\u4e2a\u200b\u5b50\u200b\u6a21\u5757\u200b\u7684\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u7684\u200bxlsx\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200bhtml\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u8fdb\u884c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u3002

POST /layout-parsing

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b file string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u6216\u200bPDF\u200b\u6587\u4ef6\u200b\u7684\u200bURL\uff0c\u200b\u6216\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u8d85\u8fc7\u200b10\u200b\u9875\u200b\u7684\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53ea\u6709\u200b\u524d\u200b10\u200b\u9875\u200b\u7684\u200b\u5185\u5bb9\u200b\u4f1a\u200b\u88ab\u200b\u4f7f\u7528\u200b\u3002 \u200b\u662f\u200b fileType integer \u200b\u6587\u4ef6\u7c7b\u578b\u200b\u30020\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c1\u200b\u8868\u793a\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u3002\u200b\u82e5\u200b\u8bf7\u6c42\u200b\u4f53\u65e0\u6b64\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5219\u200b\u670d\u52a1\u200b\u5c06\u200b\u5c1d\u8bd5\u200b\u6839\u636e\u200bURL\u200b\u81ea\u52a8\u200b\u63a8\u65ad\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u3002 \u200b\u5426\u200b useImgOrientationCls boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useImgUnwrapping boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useSealTextDet boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b layoutParsingResults array \u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u7ed3\u679c\u200b\u3002\u200b\u6570\u7ec4\u200b\u957f\u5ea6\u200b\u4e3a\u200b1\uff08\u200b\u5bf9\u4e8e\u200b\u56fe\u50cf\u200b\u8f93\u5165\u200b\uff09\u200b\u6216\u200b\u6587\u6863\u200b\u9875\u6570\u200b\u4e0e\u200b10\u200b\u4e2d\u200b\u7684\u200b\u8f83\u200b\u5c0f\u8005\u200b\uff08\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff09\u3002\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff0c\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6bcf\u200b\u4e00\u9875\u200b\u7684\u200b\u5904\u7406\u7ed3\u679c\u200b\u3002

layoutParsingResults\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b layoutElements array \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u4fe1\u606f\u200b\u3002

layoutElements\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 label string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u6807\u7b7e\u200b\u3002 text string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u5305\u542b\u200b\u7684\u200b\u6587\u672c\u200b\u3002 layoutType string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u6392\u5217\u200b\u65b9\u5f0f\u200b\u3002 image string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u56fe\u50cf\u200b\uff0cJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/layout-parsing\" # \u200b\u670d\u52a1\u200bURL\n\nimage_path = \"./demo.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": image_data, # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u6587\u4ef6\u200bURL\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(\"\\nDetected layout elements:\")\nfor res in result[\"layoutParsingResults\"]:\n    for ele in res[\"layoutElements\"]:\n        print(\"===============================\")\n        print(\"bbox:\", ele[\"bbox\"])\n        print(\"label:\", ele[\"label\"])\n        print(\"text:\", repr(ele[\"text\"]))\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b7\u200b\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u9519\u8bef\u200b\uff08\u200b\u5982\u200b\u884c\u5217\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\u3001\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u7248\u9762\u200b\u4e2d\u200b\u5b58\u5728\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff08\u200b\u4f8b\u5982\u200b\u5bf9\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u542b\u200b\u6587\u5b57\u200b\u533a\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u6216\u200b\u8bc1\u4ef6\u200b\u7684\u200b\u65b9\u5411\u200b\u5b58\u5728\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  table_model: SLANet_plus  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_server_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_server_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  formula_rec_model: LaTeX_OCR_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  seal_text_det_model: PP-OCRv4_server_seal_det   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_unwarp_model: UVDoc  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_ori_cls_model: PP-LCNet_x1_0_doc_ori  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200bnpu \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html","title":"\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#1","title":"1. \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u548c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u5185\u5bb9\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u8bc6\u522b\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u3001\u200b\u5370\u7ae0\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b PP-OCRv4_server_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b \uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path ./output\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device: \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n--save_path: \u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config seal_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config seal_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./seal_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline seal_recognition.yaml --input seal_text_det.png --save_path ./output\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': 'seal_text_det.png', 'layout_result': {'input_path': 'seal_text_det.png', 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9813116192817688, 'coordinate': [0, 5.2238655, 639.59766, 637.6985]}]}, 'ocr_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmp19fn93y5.png'), 'dt_polys': [array([[468, 469],\n       [472, 469],\n       [477, 471],\n       [507, 501],\n       [509, 505],\n       [509, 509],\n       [508, 513],\n       [506, 514],\n       [456, 553],\n       [454, 555],\n       [391, 581],\n       [388, 581],\n       [309, 590],\n       [306, 590],\n       [234, 577],\n       [232, 577],\n       [172, 548],\n       [170, 546],\n       [121, 504],\n       [118, 501],\n       [118, 496],\n       [119, 492],\n       [121, 490],\n       [152, 463],\n       [156, 461],\n       [160, 461],\n       [164, 463],\n       [202, 495],\n       [252, 518],\n       [311, 530],\n       [371, 522],\n       [425, 501],\n       [464, 471]]), array([[442, 439],\n       [445, 442],\n       [447, 447],\n       [449, 490],\n       [448, 494],\n       [446, 497],\n       [440, 499],\n       [197, 500],\n       [193, 499],\n       [190, 496],\n       [188, 491],\n       [188, 448],\n       [189, 444],\n       [192, 441],\n       [197, 439],\n       [438, 438]]), array([[465, 341],\n       [470, 344],\n       [472, 346],\n       [476, 356],\n       [476, 419],\n       [475, 424],\n       [472, 428],\n       [467, 431],\n       [462, 433],\n       [175, 434],\n       [170, 433],\n       [166, 430],\n       [163, 426],\n       [161, 420],\n       [161, 354],\n       [162, 349],\n       [165, 345],\n       [170, 342],\n       [175, 340],\n       [460, 340]]), array([[326,  34],\n       [481,  85],\n       [485,  88],\n       [488,  90],\n       [584, 220],\n       [586, 225],\n       [587, 229],\n       [589, 378],\n       [588, 383],\n       [585, 388],\n       [581, 391],\n       [576, 393],\n       [570, 392],\n       [507, 373],\n       [502, 371],\n       [498, 367],\n       [496, 359],\n       [494, 255],\n       [423, 162],\n       [322, 129],\n       [246, 151],\n       [205, 169],\n       [144, 252],\n       [139, 360],\n       [137, 365],\n       [134, 369],\n       [128, 373],\n       [ 66, 391],\n       [ 61, 392],\n       [ 56, 390],\n       [ 51, 387],\n       [ 48, 382],\n       [ 47, 377],\n       [ 49, 230],\n       [ 50, 225],\n       [ 52, 221],\n       [149,  89],\n       [153,  86],\n       [157,  84],\n       [318,  34],\n       [322,  33]])], 'dt_scores': [0.9943362380813267, 0.9994290391836306, 0.9945320407374245, 0.9908104427126033], 'rec_text': ['5263647368706', '\u200b\u5417\u200b\u7e41\u7269\u200b', '\u200b\u53d1\u7968\u200b\u4e13\u7528\u7ae0\u200b', '\u200b\u5929\u6d25\u200b\u541b\u548c\u7f18\u200b\u5546\u8d38\u200b\u6709\u9650\u516c\u53f8\u200b'], 'rec_score': [0.9921098351478577, 0.997374951839447, 0.9999369382858276, 0.9901710152626038]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4fdd\u5b58\u200b\u5728\u200b output \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"seal_recognition\")\n\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu enable_hpi \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/seal_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/seal_recognition.yaml\")\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /seal-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/seal-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/seal-recognition\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/seal-recognition\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/seal-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/seal-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/seal-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/seal-recognition\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u5370\u7ae0\u200b\u533a\u57df\u200b\u5728\u200b\u6574\u4f53\u200b\u7248\u9762\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  layout_model: RT-DETR-H_layout_3cls #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_server_seal_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_server_rec #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200bnpu \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline seal_recognition --input seal_text_det.png --device npu:0 --save_path output\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html","title":"\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#1","title":"1. \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u636e\u5f55\u5165\u200b\u3001\u200b\u4fe1\u606f\u68c0\u7d22\u200b\u548c\u200b\u6587\u6863\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002

\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b

\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.2 M PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 100.1M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4_server_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b \uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21_1","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config table_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config table_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./table_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./table_recognition.yaml --input table_recognition.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': 'table_recognition.jpg', 'layout_result': {'input_path': 'table_recognition.jpg', 'boxes': [{'cls_id': 3, 'label': 'Table', 'score': 0.6014542579650879, 'coordinate': [0, 21, 551, 118]}]}, 'ocr_result': {'dt_polys': [array([[37., 40.],\n       [75., 40.],\n       [75., 60.],\n       [37., 60.]], dtype=float32), array([[123.,  37.],\n       [200.,  37.],\n       [200.,  59.],\n       [123.,  59.]], dtype=float32), array([[227.,  37.],\n       [391.,  37.],\n       [391.,  58.],\n       [227.,  58.]], dtype=float32), array([[416.,  36.],\n       [535.,  38.],\n       [535.,  61.],\n       [415.,  58.]], dtype=float32), array([[35., 73.],\n       [78., 73.],\n       [78., 92.],\n       [35., 92.]], dtype=float32), array([[287.,  73.],\n       [328.,  73.],\n       [328.,  92.],\n       [287.,  92.]], dtype=float32), array([[453.,  72.],\n       [495.,  72.],\n       [495.,  94.],\n       [453.,  94.]], dtype=float32), array([[ 17., 103.],\n       [ 94., 103.],\n       [ 94., 118.],\n       [ 17., 118.]], dtype=float32), array([[145., 104.],\n       [178., 104.],\n       [178., 118.],\n       [145., 118.]], dtype=float32), array([[277., 104.],\n       [337., 102.],\n       [338., 118.],\n       [278., 118.]], dtype=float32), array([[446., 102.],\n       [504., 104.],\n       [503., 118.],\n       [445., 118.]], dtype=float32)], 'rec_text': ['Dres', '\u200b\u8fde\u7eed\u200b\u5de5\u4f5c\u200b3', '\u200b\u53d6\u51fa\u200b\u6765\u200b\u653e\u5728\u200b\u7f51\u4e0a\u200b\uff0c\u200b\u6ca1\u200b\u60f3\u200b', '\u200b\u6c5f\u200b\u3001\u200b\u6574\u6c5f\u200b\u7b49\u200b\u516b\u5927\u200b', 'Abstr', 'rSrivi', '$709.', 'cludingGiv', '2.72', 'Ingcubic', '$744.78'], 'rec_score': [0.9934158325195312, 0.9990204572677612, 0.9967061877250671, 0.9375461935997009, 0.9947397112846375, 0.9972746968269348, 0.9904290437698364, 0.973427414894104, 0.9983080625534058, 0.993423342704773, 0.9964120984077454], 'input_path': 'table_recognition.jpg'}, 'table_result': [{'input_path': 'table_recognition.jpg', 'layout_bbox': [0, 21, 551, 118], 'bbox': array([[  4.395736 ,  25.238262 , 113.31014  ,  25.316246 , 115.454315 ,\n         71.8867   ,   3.7177477,  71.7937   ],\n       [110.727455 ,  25.94007  , 210.07187  ,  26.028755 , 209.66394  ,\n         65.96484  , 109.59861  ,  66.09809  ],\n       [214.45381  ,  26.027939 , 407.95276  ,  26.112846 , 409.6684   ,\n         66.91336  , 215.27292  ,  67.002014 ],\n       [402.81863  ,  26.123789 , 549.03656  ,  26.231564 , 549.19995  ,\n         66.88339  , 404.48068  ,  66.74034  ],\n       [  2.4458022,  64.68588  , 102.7665   ,  65.10228  , 105.79447  ,\n         96.051254 ,   2.5367072,  95.35514  ],\n       [108.85877  ,  65.80549  , 211.70216  ,  66.02091  , 210.79245  ,\n         94.75581  , 107.59308  ,  94.42664  ],\n       [217.05621  ,  64.98496  , 407.76328  ,  65.133484 , 406.8436   ,\n         96.00133  , 214.67896  ,  95.87226  ],\n       [401.73572  ,  64.60494  , 547.9967   ,  64.73921  , 548.19135  ,\n         96.09901  , 402.26733  ,  95.95529  ],\n       [  2.4882016,  93.589554 , 107.01325  ,  93.67592  , 107.8446   ,\n        120.13259  ,   2.508764 , 119.85027  ],\n       [110.773125 ,  93.98633  , 213.354    ,  94.08046  , 212.46033  ,\n        120.80207  , 109.29008  , 120.613045 ],\n       [216.08781  ,  94.19984  , 405.843    ,  94.28341  , 405.9974   ,\n        121.33152  , 215.10301  , 121.299034 ],\n       [403.92212  ,  94.44883  , 548.30963  ,  94.54982  , 548.4949   ,\n        122.610176 , 404.53433  , 122.49881  ]], dtype=float32), 'img_idx': 0, 'html': '<html><body><table><tr><td>Dres</td><td>\u200b\u8fde\u7eed\u200b\u5de5\u4f5c\u200b3</td><td>\u200b\u53d6\u51fa\u200b\u6765\u200b\u653e\u5728\u200b\u7f51\u4e0a\u200b\uff0c\u200b\u6ca1\u200b\u60f3\u200b</td><td>\u200b\u6c5f\u200b\u3001\u200b\u6574\u6c5f\u200b\u7b49\u200b\u516b\u5927\u200b</td></tr><tr><td>Abstr</td><td></td><td>rSrivi</td><td>$709.</td></tr><tr><td>cludingGiv</td><td>2.72</td><td>Ingcubic</td><td>$744.78</td></tr></table></body></html>'}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"table_recognition\")\n\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200bhtml\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bimg\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u5176\u4e2d\u200b\uff0csave_to_img \u200b\u80fd\u591f\u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\uff08\u200b\u5305\u62ec\u200bOCR\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\uff09\uff0c save_to_html \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u76f4\u63a5\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\uff09\uff0csave_to_xlsx \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bExcel\u200b\u683c\u5f0f\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u683c\u5f0f\u200b\uff09\u3002

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/table_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/table_recognition.yaml\")\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200bhtml\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u8bc6\u522b\u200b\u56fe\u4e2d\u200b\u7684\u200b\u8868\u683c\u200b\u3002

POST /table-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b tables array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5185\u5bb9\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

tables\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 html string HTML\u200b\u683c\u5f0f\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/table-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected tables:\")\nprint(result[\"tables\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/table-recognition\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto tables = result[\"tables\"];\n        std::cout << \"\\nDetected tables:\" << std::endl;\n        for (const auto& table : tables) {\n            std::cout << table << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/table-recognition\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode tables = result.get(\"tables\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected tables: \" + tables.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/table-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Tables []map[string]interface{} `json:\"tables\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected tables:\")\n    for _, table := range respData.Result.Tables {\n        fmt.Println(table)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/table-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected tables:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"tables\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/table-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected tables:\");\n    console.log(result[\"tables\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/table-recognition\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected tables:\\n\";\nprint_r($result[\"tables\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u56db\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u9519\u8bef\u200b\uff08\u200b\u5982\u200b\u884c\u5217\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\u3001\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u8868\u683c\u200b\u533a\u57df\u200b\u5728\u200b\u6574\u4f53\u200b\u7248\u9762\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  table_model: SLANet  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_mobile_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_mobile_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200bnpu \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline table_recognition --input table_recognition.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#1","title":"1. \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u8bc6\u522b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u6a21\u5f0f\u200b\u6216\u200b\u884c\u4e3a\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7f51\u7edc\u5b89\u5168\u200b\u3001\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u548c\u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6b63\u5e38\u200b\u8d8b\u52bf\u200b\u548c\u200b\u89c4\u5f8b\u200b\uff0c\u200b\u6765\u200b\u53d1\u73b0\u200b\u4e0e\u200b\u9884\u671f\u200b\u884c\u4e3a\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u7a81\u7136\u200b\u589e\u52a0\u200b\u7684\u200b\u7f51\u7edc\u6d41\u91cf\u200b\u6216\u200b\u5f02\u5e38\u200b\u7684\u200b\u4ea4\u6613\u200b\u6d3b\u52a8\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u63d0\u4f9b\u200b\u5b9e\u65f6\u200b\u8b66\u62a5\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u53ca\u65f6\u200b\u5e94\u5bf9\u200b\u6f5c\u5728\u200b\u98ce\u9669\u200b\u548c\u200b\u95ee\u9898\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u4fdd\u969c\u7cfb\u7edf\u200b\u7a33\u5b9a\u6027\u200b\u548c\u200b\u5b89\u5168\u6027\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002

\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) AutoEncoder_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 99.36 84.36 91.25 52K DLinear_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.98 93.96 96.41 112K Nonstationary_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.55 88.95 93.51 1.8M PatchTST_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.78 90.70 94.57 320K TimesNet_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.37 94.80 96.56 1.3M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PSM \u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config ts_ad\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config ts_ad --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b--pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ts_ad.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ts_ad.yaml --input ts_ad.cs --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'ts_ad.csv', 'anomaly':            label\ntimestamp\n220226         0\n220227         0\n220228         0\n220229         0\n220230         0\n...          ...\n220317         1\n220318         1\n220319         1\n220320         1\n220321         0\n\n[96 rows x 1 columns]}\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_ad\")\n\noutput = pipeline.predict(\"ts_ad.cs\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_csv \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bcsv\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/ts_ad.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_ad.yaml\")\noutput = pipeline.predict(\"ts_ad.cs\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3002

POST /time-series-anomaly-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b csv string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200bCSV\u200b\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200bCSV\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002CSV\u200b\u6587\u4ef6\u200b\u9700\u8981\u200b\u4f7f\u7528\u200bUTF-8\u200b\u7f16\u7801\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b csv string CSV\u200b\u683c\u5f0f\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u3002\u200b\u4f7f\u7528\u200bUTF-8+Base64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"csv\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-anomaly-detection\" # \u200b\u670d\u52a1\u200bURL\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/time-series-anomaly-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        // \u200b\u4fdd\u5b58\u200b\u6570\u636e\u200b\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                // \u200b\u4fdd\u5b58\u200b\u8fd4\u56de\u200b\u7684\u200b\u6570\u636e\u200b\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-anomaly-detection\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    // \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    // \u200b\u5c06\u200bBase64\u200b\u7f16\u7801\u200b\u7684\u200bcsv\u200b\u6570\u636e\u200b\u89e3\u7801\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-anomaly-detection'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n  })\n};\n\n// \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8f6c\u6362\u200b\u4e3a\u200bBase64\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-anomaly-detection\"; // \u200b\u670d\u52a1\u200bURL\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: DLinear_ad  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n

\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline ts_ad --input ts_ad.cs --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b--device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline ts_ad --input ts_ad.cs --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#1","title":"1. \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u5f52\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u884c\u4e3a\u200b\u8bc6\u522b\u200b\u3001\u200b\u91d1\u878d\u200b\u8d8b\u52bf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5f0f\u200b\u6216\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5c06\u200b\u4e00\u6bb5\u200b\u8bed\u97f3\u200b\u4fe1\u53f7\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u95ee\u5019\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u8bf7\u6c42\u200b\u201d\uff0c\u200b\u6216\u200b\u5c06\u200b\u80a1\u7968\u4ef7\u683c\u200b\u8d70\u52bf\u200b\u5212\u5206\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u6355\u6349\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\u548c\u200b\u53d8\u5316\u89c4\u5f8b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u6570\u636e\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u76d1\u63a7\u200b\u3001\u200b\u5e02\u573a\u9884\u6d4b\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u8d77\u200b\u7740\u200b\u5173\u952e\u4f5c\u7528\u200b\u3002

\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) TimesNet_cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.5 792K

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b UWaveGestureLibrary \u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_yaml ts_cls\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path\uff09\uff1a

paddlex --get_pipeline_config ts_cls --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ts_cls.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ts_cls.yaml --input ts_cls.csv --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'ts_cls.csv', 'classification':         classid     score\nsample\n0             0  0.617688}\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_cls\")\n\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_csv \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bcsv\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/ts_cls.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_forecast.yaml\")\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002

POST /time-series-classification

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b csv string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200bCSV\u200b\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200bCSV\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002CSV\u200b\u6587\u4ef6\u200b\u9700\u8981\u200b\u4f7f\u7528\u200bUTF-8\u200b\u7f16\u7801\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u7c7b\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"label\": \"running\",\n\"score\": 0.97\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-classification\" # \u200b\u670d\u52a1\u200bURL\ncsv_path = \"./test.csv\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(f\"label: {result['label']}, score: {result['score']}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/time-series-classification\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n        std::cout << \"label: \" << result[\"label\"] << \", score: \" << result[\"score\"] << std::endl;\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-classification\";\n        String csvPath = \"./test.csv\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                System.out.println(\"label: \" + result.get(\"label\").asText() + \", score: \" + result.get(\"score\").asText());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-classification\"\n    csvPath := \"./test.csv\";\n\n    // \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Label string `json:\"label\"`\n            Score string `json:\"score\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    fmt.Printf(\"label: %s, score: %s\\n\", respData.Result.Label, respData.Result.Score)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-classification\";\n    static readonly string csvPath = \"./test.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] csveBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csveBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string label = jsonResponse[\"result\"][\"label\"].ToString();\n        string score = jsonResponse[\"result\"][\"score\"].ToString();\n        Console.WriteLine($\"label: {label}, score: {score}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-classification'\nconst csvPath = \"./test.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n  })\n};\n\n// \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8f6c\u6362\u200b\u4e3a\u200bBase64\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    console.log(`label: ${result[\"label\"]}, score: ${result[\"score\"]}`);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-classification\"; // \u200b\u670d\u52a1\u200bURL\n$csv_path = \"./test.csv\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\necho \"label: \" . $result[\"label\"] . \", score: \" . $result[\"score\"];\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: TimesNet_cls  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline ts_cls --input ts_cls.csv --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#1","title":"1. \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002

\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) DLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.382 0.394 72K NLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.386 0.392 40K Nonstationary\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.600 0.515 55.5 M PatchTST\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.385 0.397 2.0M RLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.384 0.392 40K TiDE\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.405 0.412 31.7M TimesNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.417 0.431 4.9M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b ETTH1\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config ts_fc\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config ts_fc --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ts_fc.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ts_fc.yaml --input ts_fc.csv --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'ts_fc.csv', 'forecast':                            OT\ndate\n2018-06-26 20:00:00  9.586131\n2018-06-26 21:00:00  9.379762\n2018-06-26 22:00:00  9.252275\n2018-06-26 23:00:00  9.249993\n2018-06-27 00:00:00  9.164998\n...                       ...\n2018-06-30 15:00:00  8.830340\n2018-06-30 16:00:00  9.291553\n2018-06-30 17:00:00  9.097666\n2018-06-30 18:00:00  8.905430\n2018-06-30 19:00:00  8.993793\n\n[96 rows x 1 columns]}\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_fc\")\n\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_csv \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bcsv\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/ts_fc.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_fc.yaml\")\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3002

POST /time-series-forecasting

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b csv string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200bCSV\u200b\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200bCSV\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002CSV\u200b\u6587\u4ef6\u200b\u9700\u8981\u200b\u4f7f\u7528\u200bUTF-8\u200b\u7f16\u7801\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b csv string CSV\u200b\u683c\u5f0f\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002\u200b\u4f7f\u7528\u200bUTF-8+Base64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"csv\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-forecasting\" # \u200b\u670d\u52a1\u200bURL\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/time-series-forecasting\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        // \u200b\u4fdd\u5b58\u200b\u6570\u636e\u200b\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-forecasting\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                // \u200b\u4fdd\u5b58\u200b\u8fd4\u56de\u200b\u7684\u200b\u6570\u636e\u200b\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-forecasting\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    // \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    // \u200b\u5c06\u200bBase64\u200b\u7f16\u7801\u200b\u7684\u200bcsv\u200b\u6570\u636e\u200b\u89e3\u7801\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-forecasting\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-forecasting'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n  })\n};\n\n// \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8f6c\u6362\u200b\u4e3a\u200bBase64\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-forecasting\"; // \u200b\u670d\u52a1\u200bURL\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: DLinear  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 0\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline ts_fc --input ts_fc.csv --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html","title":"Anomaly detection tutorial","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#paddlex-30","title":"PaddleX 3.0 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4ee5\u4e0b\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u98df\u54c1\u200b\u699b\u5b50\u200b\u5916\u89c2\u200b\u5f02\u5e38\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08\u200b\u94c1\u4e1d\u7f51\u200b \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 1 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b STFPM 96.2 - - 21.5 M STFPM.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b **MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002**

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 391\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 70\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff1a-o Train.epochs_iters=5000\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 4000\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 1\u3002
  2. \u200b\u57fa\u4e8e\u200b STFPM \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.01\uff0c0.1\uff0c0.4\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.4\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\u5230\u200b5000\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u8fbe\u5230\u200b\u66f4\u4f18\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 4000 0.01 1 4\u200b\u5361\u200b 0.9646 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 4000 0.1 1 4\u200b\u5361\u200b 0.9707 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 5000 0.4 1 4\u200b\u5361\u200b 0.9826

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200buad_hazelnut.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/anomaly_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200boutput/best_model/inference\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html","title":"Anomaly detection tutorial en","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#paddlex-30-image-anomaly-detection-pipeline-food-appearance-quality-inspection-tutorial","title":"PaddleX 3.0 Image Anomaly Detection Pipeline \u2014 Food Appearance Quality Inspection Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a Food Appearance Quality Inspection task.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For Food Appearance Quality Inspection, this falls under the category of anomaly detection tasks, corresponding to PaddleX's Image Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers 1 ways to experience the pipeline: one is through the PaddleX wheel package locally.

  • Local Experience:
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 1 end-to-end anomaly detection models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) yaml file STFPM 96.2 - - 21.5 M STFPM.yaml

Note: The above accuracy metrics are measured on the MVTec AD dataset.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Food Appearance Quality Inspection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX anomaly detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 391;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 70;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 4000 and the batch size at 1.
  2. Initiate three experiments based on the STFPM model, with learning rates of: 0.01, 0.1, 0.4.
  3. It can be observed that the configuration with the highest accuracy in Experiment 3 is a learning rate of 0.4. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 5000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 4000 0.01 1 4 0.9646 Experiment 2 4000 0.1 1 4 0.9707 Experiment 3 4000 0.4 1 4 0.9797

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 3 4000 0.4 1 4 0.9797 Experiment 3 with more epochs 5000 0.4 1 4 0.9826

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

The prediction results will be generated under ./output, where the prediction result for uad_hazelnut.png is shown below:

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the anomaly detection pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/anomaly_detection.yaml configuration file to your own model path output/best_model/inference:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to Anomaly Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"practical_tutorials/deployment_tutorial.html","title":"PaddleX 3.0 \u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u6559\u7a0b","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002

PaddleX \u200b\u7684\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002
  • \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  • \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u672c\u200b\u6559\u7a0b\u200b\u5c06\u4e3e\u200b\u4e09\u4e2a\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u6765\u200b\u4f9d\u6b21\u200b\u4ecb\u7ecd\u200b PaddleX \u200b\u7684\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#1","title":"1 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u793a\u4f8b","text":""},{"location":"practical_tutorials/deployment_tutorial.html#11","title":"1.1 \u200b\u83b7\u53d6\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u6fc0\u6d3b","text":"

\u200b\u5728\u200b \u200b\u98de\u6868\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b-\u200b\u4eba\u5de5\u667a\u80fd\u200b\u5b66\u4e60\u200b\u4e0e\u200b\u5b9e\u8bad\u200b\u793e\u533a\u200b \u200b\u9875\u9762\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u5e8f\u5217\u53f7\u200b\u54a8\u8be2\u200b\u4e0e\u200b\u83b7\u53d6\u200b\u201d\u200b\u90e8\u5206\u200b\u9009\u62e9\u200b\u201c\u200b\u7acb\u5373\u200b\u83b7\u53d6\u200b\u201d\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u90e8\u7f72\u200b\u7684\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5e76\u200b\u70b9\u51fb\u200b\u201c\u200b\u83b7\u53d6\u200b\u201d\u3002\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u9875\u9762\u200b\u4e0b\u65b9\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200bSDK\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u201d\u200b\u90e8\u5206\u200b\u627e\u5230\u200b\u83b7\u53d6\u200b\u5230\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\uff1a

\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002PaddleX \u200b\u63d0\u4f9b\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u548c\u200b\u5728\u7ebf\u200b\u6fc0\u6d3b\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff08\u200b\u5747\u200b\u53ea\u200b\u652f\u6301\u200b Linux \u200b\u7cfb\u7edf\u200b\uff09\uff1a

  • \u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u53ca\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u4f7f\u200b\u7a0b\u5e8f\u200b\u81ea\u52a8\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002
  • \u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u6309\u7167\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u754c\u9762\u200b\u4e2d\u200b\u7684\u200b\u6307\u5f15\u200b\uff08\u200b\u70b9\u51fb\u200b\u201c\u200b\u64cd\u4f5c\u200b\u201d\u200b\u4e2d\u200b\u7684\u200b\u201c\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u201d\uff09\uff0c\u200b\u83b7\u53d6\u200b\u673a\u5668\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\u7ed1\u5b9a\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u8bc1\u4e66\u200b\uff0c\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u4f7f\u7528\u200b\u8fd9\u79cd\u200b\u6fc0\u6d3b\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u5c06\u200b\u8bc1\u4e66\u200b\u5b58\u653e\u200b\u5728\u200b\u673a\u5668\u200b\u7684\u200b ${HOME}/.baidu/paddlex/licenses \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff08\u200b\u5982\u679c\u200b\u76ee\u5f55\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u521b\u5efa\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u5e8f\u5217\u53f7\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u5230\u200b\u552f\u4e00\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u4e14\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u4e00\u6b21\u200b\u3002\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u7528\u6237\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u673a\u5668\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b\u6bcf\u53f0\u200b\u673a\u5668\u200b\u51c6\u5907\u200b\u5355\u72ec\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002
"},{"location":"practical_tutorials/deployment_tutorial.html#12","title":"1.2 \u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u4e0b\u8868\u4e2d\u200b\u6839\u636e\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b\u3001\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3001Python \u200b\u7248\u672c\u200b\u7b49\u200b\u4fe1\u606f\u200b\uff0c\u200b\u627e\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u5e76\u200b\u5728\u200b\u90e8\u7f72\u200b\u73af\u5883\u200b\u4e2d\u200b\u6267\u884c\u200b\uff1a

\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b \u200b\u64cd\u4f5c\u7cfb\u7edf\u200b \u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b Python \u200b\u7248\u672c\u200b \u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0\uff08CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6\uff09 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • \u200b\u5f53\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200b GPU \u200b\u65f6\u200b\uff0c\u200b\u8bf7\u200b\u4f7f\u7528\u200b\u4e0e\u200b\u73af\u5883\u200b\u5339\u914d\u200b\u7684\u200b CUDA \u200b\u548c\u200b cuDNN \u200b\u7248\u672c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5426\u5219\u200b\uff0c\u200b\u5c06\u200b\u65e0\u6cd5\u200b\u6b63\u5e38\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002
  • \u200b\u5bf9\u4e8e\u200b Linux \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u4f7f\u7528\u200b Bash \u200b\u6267\u884c\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u3002
  • \u200b\u5f53\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200b CPU \u200b\u65f6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4ec5\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff1b\u200b\u5bf9\u4e8e\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5219\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u6216\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u3002
"},{"location":"practical_tutorials/deployment_tutorial.html#13","title":"1.3 \u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63d2\u4ef6\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u200b\u5f53\u524d\u200b\u73af\u5883\u200b\u7684\u200b LD_LIBRARY_PATH \u200b\u6ca1\u6709\u200b\u6307\u5b9a\u200b TensorRT \u200b\u7684\u200b\u5171\u4eab\u200b\u5e93\u200b\u76ee\u5f55\u200b\uff0c\u200b\u56e0\u4e3a\u200b\u63d2\u4ef6\u200b\u4e2d\u200b\u5df2\u7ecf\u200b\u96c6\u6210\u200b\u4e86\u200b TensorRT\uff0c\u200b\u907f\u514d\u200b TensorRT \u200b\u7248\u672c\u200b\u51b2\u7a81\u200b\u5bfc\u81f4\u200b\u63d2\u4ef6\u200b\u65e0\u6cd5\u200b\u6b63\u5e38\u200b\u4f7f\u7528\u200b\u3002

\u200b\u5bf9\u4e8e\u200b PaddleX CLI\uff0c\u200b\u6307\u5b9a\u200b --use_hpip\uff0c\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u5e8f\u5217\u53f7\u200b\uff0c\u200b\u5373\u53ef\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002\u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u65f6\u200b\uff0c\u200b\u9700\u200b\u6307\u5b9a\u200b --update_license\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n\n# \u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\npaddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --update_license \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n

\u200b\u5bf9\u4e8e\u200b PaddleX Python API\uff0c\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u65b9\u6cd5\u200b\u7c7b\u4f3c\u200b\u3002\u200b\u4ecd\u200b\u4ee5\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"OCR\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": xxx}\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \")\n

\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5f97\u5230\u200b\u7684\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u672a\u200b\u542f\u7528\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u4e00\u81f4\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u9996\u6b21\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\uff0c\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u82b1\u8d39\u200b\u8f83\u957f\u65f6\u95f4\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u6784\u5efa\u200b\u3002PaddleX \u200b\u5c06\u200b\u5728\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u7b2c\u4e00\u6b21\u200b\u6784\u5efa\u200b\u5b8c\u6210\u200b\u540e\u200b\u5c06\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7f13\u5b58\u200b\u5728\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u540e\u7eed\u200b\u590d\u7528\u200b\u7f13\u5b58\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u4ee5\u200b\u63d0\u5347\u200b\u521d\u59cb\u5316\u200b\u901f\u5ea6\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#14","title":"1.4 \u200b\u63a8\u7406\u200b\u6b65\u9aa4","text":"

\u200b\u672c\u200b\u63a8\u7406\u200b\u6b65\u9aa4\u200b\u57fa\u4e8e\u200b PaddleX CLI\u3001\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\u5e8f\u5217\u53f7\u200b\u3001Python 3.10.0\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200bCPU \u200b\u7684\u200b\u65b9\u5f0f\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5176\u4ed6\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\uff08\u200b\u5982\u200b\u4e0d\u540c\u200b Python \u200b\u7248\u672c\u200b\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u6216\u200b PaddleX Python API\uff09\u200b\u53ef\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b \u200b\u66ff\u6362\u200b\u76f8\u5e94\u200b\u7684\u200b\u6307\u4ee4\u200b\u3002

# \u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\ncurl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310\n# \u200b\u786e\u4fdd\u200b\u5f53\u524d\u200b\u73af\u5883\u200b\u7684\u200b `LD_LIBRARY_PATH` \u200b\u6ca1\u6709\u200b\u6307\u5b9a\u200b TensorRT \u200b\u7684\u200b\u5171\u4eab\u200b\u5e93\u200b\u76ee\u5f55\u200b \u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u4e0b\u9762\u200b\u547d\u4ee4\u200b\u53bb\u9664\u200b\u6216\u200b\u624b\u52a8\u200b\u53bb\u9664\u200b\nexport LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\\n' | grep -v TensorRT | tr '\\n' ':' | sed 's/:*$//')\n# \u200b\u6267\u884c\u200b\u63a8\u7406\u200b\npaddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n

\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\uff1a

"},{"location":"practical_tutorials/deployment_tutorial.html#15","title":"1.5 \u200b\u66f4\u6362\u200b\u4ea7\u200b\u7ebf\u6216\u200b\u6a21\u578b","text":"
  • \u200b\u66f4\u6362\u200b\u4ea7\u7ebf\u200b\uff1a

\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u66ff\u6362\u200b --pipeline \u200b\u4f20\u5165\u200b\u7684\u200b\u503c\u200b\u5373\u53ef\u200b\uff0c\u200b\u4ee5\u4e0b\u200b\u4ee5\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n
  • \u200b\u66f4\u6362\u200b\u6a21\u578b\u200b\uff1a

OCR \u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PP-OCRv4_mobile_det\u3001PP-OCRv4_mobile_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b PP-OCRv4_server_det\u3001PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./OCR.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.text_det_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_det \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n#    \u200b\u5c06\u200b Pipeline.text_rec_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u6267\u884c\u200b\u63a8\u7406\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --pipeline ./OCR.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n

\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PicoDet-S \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b RT-DETR \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./object_detection.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b RT-DETR \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u6267\u884c\u200b\u63a8\u7406\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --pipeline ./object_detection.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n

\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u4e0e\u200b\u4e0a\u8ff0\u200b\u4e24\u6761\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200b\u7ec6\u8282\u200b\u53ef\u200b\u53c2\u8003\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#2","title":"2 \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u793a\u4f8b","text":""},{"location":"practical_tutorials/deployment_tutorial.html#21","title":"2.1 \u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6","text":"

\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6\u200b\uff1a

paddlex --install serving\n
"},{"location":"practical_tutorials/deployment_tutorial.html#22","title":"2.2 \u200b\u542f\u52a8\u200b\u670d\u52a1","text":"

\u200b\u901a\u8fc7\u200b PaddleX CLI \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\uff0c\u200b\u6307\u4ee4\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a

paddlex --serve --pipeline {\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b} [{\u200b\u5176\u4ed6\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b}]\n

\u200b\u4ee5\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --serve --pipeline OCR\n

\u200b\u670d\u52a1\u200b\u542f\u52a8\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u7c7b\u4f3c\u200b\u5982\u4e0b\u200b\u5c55\u793a\u200b\u7684\u200b\u4fe1\u606f\u200b\uff1a

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline \u200b\u53ef\u200b\u6307\u5b9a\u200b\u4e3a\u200b\u5b98\u65b9\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u200b\u672c\u5730\u4ea7\u200b\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002PaddleX \u200b\u4ee5\u6b64\u200b\u6784\u5efa\u200b\u4ea7\u7ebf\u200b\u5e76\u200b\u90e8\u7f72\u200b\u4e3a\u200b\u670d\u52a1\u200b\u3002\u200b\u5982\u9700\u200b\u8c03\u6574\u200b\u914d\u7f6e\u200b\uff08\u200b\u5982\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u3001batch_size\u3001\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u7b49\u200b\uff09\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b \u201c\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u201d \u200b\u90e8\u5206\u200b\u3002 \u200b\u4e0e\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u76f8\u5173\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u8bf4\u660e\u200b --pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002 --device \u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b cpu\uff08\u200b\u5982\u200b GPU \u200b\u4e0d\u53ef\u200b\u7528\u200b\uff09\u200b\u6216\u200b gpu\uff08\u200b\u5982\u200b GPU \u200b\u53ef\u7528\u200b\uff09\u3002 --host \u200b\u670d\u52a1\u5668\u200b\u7ed1\u5b9a\u200b\u7684\u200b\u4e3b\u673a\u540d\u200b\u6216\u200b IP \u200b\u5730\u5740\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b0.0.0.0\u3002 --port \u200b\u670d\u52a1\u5668\u200b\u76d1\u542c\u200b\u7684\u200b\u7aef\u53e3\u53f7\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b8080\u3002 --use_hpip \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002 --serial_number \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4f7f\u7528\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5e76\u975e\u200b\u6240\u6709\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6a21\u578b\u200b\u90fd\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002 --update_license \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002"},{"location":"practical_tutorials/deployment_tutorial.html#23","title":"2.3 \u200b\u8c03\u7528\u200b\u670d\u52a1","text":"

\u200b\u6b64\u5904\u200b\u53ea\u200b\u5c55\u793a\u200b Python \u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff0cAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u5176\u4ed6\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\u53ef\u200b\u53c2\u8003\u200b PaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b \u200b\u7684\u200b 1.3 \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b \u200b\u4e2d\u200b\u5404\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u7684\u200b \u201c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u201d \u200b\u90e8\u5206\u200b\u3002

import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
"},{"location":"practical_tutorials/deployment_tutorial.html#24","title":"2.4 \u200b\u90e8\u7f72\u200b\u6b65\u9aa4","text":"
# \u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6\u200b\npaddlex --install serving\n# \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\npaddlex --serve --pipeline OCR\n# \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b | fast_test.py \u200b\u4e2d\u200b\u4ee3\u7801\u200b\u4e3a\u200b\u4e0a\u200b\u4e00\u8282\u200b\u7684\u200b Python \u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\uff1a

"},{"location":"practical_tutorials/deployment_tutorial.html#25","title":"2.5 \u200b\u66f4\u6362\u200b\u4ea7\u200b\u7ebf\u6216\u200b\u6a21\u578b","text":"
  • \u200b\u66f4\u6362\u200b\u4ea7\u7ebf\u200b\uff1a

\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5219\u200b\u66ff\u6362\u200b --pipeline \u200b\u4f20\u5165\u200b\u7684\u200b\u503c\u200b\u5373\u53ef\u200b\uff0c\u200b\u4ee5\u4e0b\u200b\u4ee5\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --serve --pipeline object_detection\n
  • \u200b\u66f4\u6362\u200b\u6a21\u578b\u200b\uff1a

OCR \u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PP-OCRv4_mobile_det\u3001PP-OCRv4_mobile_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b PP-OCRv4_server_det\u3001PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./OCR.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.text_det_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_det \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n#    \u200b\u5c06\u200b Pipeline.text_rec_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --serve --pipeline ./OCR.yaml\n# 4. \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PicoDet-S \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b RT-DETR \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./object_detection.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b RT-DETR \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --serve --pipeline ./object_detection.yaml\n# 4. \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b | fast_test.py \u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u4e3a\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b Python \u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u4e0e\u200b\u4e0a\u8ff0\u200b\u4e24\u6761\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200b\u7ec6\u8282\u200b\u53ef\u200b\u53c2\u8003\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#3","title":"3 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u793a\u4f8b","text":""},{"location":"practical_tutorials/deployment_tutorial.html#31","title":"3.1 \u200b\u73af\u5883\u200b\u51c6\u5907","text":"
  1. \u200b\u5728\u200b\u672c\u5730\u200b\u73af\u5883\u200b\u5b89\u88c5\u200b\u597d\u200b CMake \u200b\u7f16\u8bd1\u200b\u5de5\u5177\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b\u5f53\u524d\u200b\u7cfb\u7edf\u200b\u7b26\u5408\u8981\u6c42\u200b\u7684\u200b\u7248\u672c\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b Mac \u200b\u4e0a\u200b\u5f00\u53d1\u200b\uff0c\u200b\u9700\u8981\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b Mac \u200b\u5e73\u53f0\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002

    \u200b\u73af\u5883\u200b\u8981\u6c42\u200b - CMake >= 3.10\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b 3.20 \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09 - Android NDK >= r17c\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b r20b \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09

    \u200b\u672c\u200b\u6307\u5357\u200b\u6240\u200b\u4f7f\u7528\u200b\u7684\u200b\u6d4b\u8bd5\u73af\u5883\u200b\uff1a - cmake == 3.20.0 - android-ndk == r20b

  2. \u200b\u51c6\u5907\u200b\u4e00\u90e8\u200b Android \u200b\u624b\u673a\u200b\uff0c\u200b\u5e76\u200b\u5f00\u542f\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002\u200b\u5f00\u542f\u200b\u65b9\u6cd5\u200b: \u200b\u624b\u673a\u200b\u8bbe\u7f6e\u200b -> \u200b\u67e5\u627e\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b -> \u200b\u6253\u5f00\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b\u548c\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002

  3. \u200b\u7535\u8111\u200b\u4e0a\u200b\u5b89\u88c5\u200b ADB \u200b\u5de5\u5177\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8c03\u8bd5\u200b\u3002ADB \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

    3.1. Mac \u200b\u7535\u8111\u200b\u5b89\u88c5\u200b ADB

     brew cask install android-platform-tools\n

    3.2. Linux \u200b\u5b89\u88c5\u200b ADB

     # debian\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo apt update\n sudo apt install -y wget adb\n\n # redhat\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo yum install adb\n

    3.3. Windows \u200b\u5b89\u88c5\u200b ADB

    win \u200b\u4e0a\u200b\u5b89\u88c5\u200b\u9700\u8981\u200b\u53bb\u200b\u8c37\u6b4c\u200b\u7684\u200b\u5b89\u5353\u200b\u5e73\u53f0\u200b\u4e0b\u8f7d\u200b ADB \u200b\u8f6f\u4ef6\u5305\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\uff1a\u200b\u94fe\u63a5\u200b

    \u200b\u6253\u5f00\u200b\u7ec8\u7aef\u200b\uff0c\u200b\u624b\u673a\u200b\u8fde\u63a5\u200b\u7535\u8111\u200b\uff0c\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4e2d\u200b\u8f93\u5165\u200b

     adb devices\n

    \u200b\u5982\u679c\u200b\u6709\u200b device \u200b\u8f93\u51fa\u200b\uff0c\u200b\u5219\u200b\u8868\u793a\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u3002

     List of devices attached\n 744be294    device\n
"},{"location":"practical_tutorials/deployment_tutorial.html#32","title":"3.2 \u200b\u7269\u6599\u200b\u51c6\u5907","text":"
  1. \u200b\u514b\u9686\u200b Paddle-Lite-Demo \u200b\u4ed3\u5e93\u200b\u7684\u200b feature/paddle-x \u200b\u5206\u652f\u200b\u5230\u200b PaddleX-Lite-Deploy \u200b\u76ee\u5f55\u200b\u3002

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. \u200b\u586b\u5199\u200b \u200b\u95ee\u5377\u200b \u200b\u4e0b\u8f7d\u200b\u538b\u7f29\u5305\u200b\uff0c\u200b\u5c06\u200b\u538b\u7f29\u5305\u200b\u653e\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\u540e\u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\u3002

    # 1. \u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\ncd PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo\n\n# 2. \u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\nunzip ocr.zip\n

"},{"location":"practical_tutorials/deployment_tutorial.html#33","title":"3.3 \u200b\u90e8\u7f72\u200b\u6b65\u9aa4","text":"
  1. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/libs \u200b\u76ee\u5f55\u200b\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\u3002\u200b\u6b64\u200b\u6b65\u9aa4\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u4e00\u6b21\u200b\uff0c\u200b\u5373\u53ef\u200b\u652f\u6301\u200b\u6bcf\u4e2a\u200b demo \u200b\u4f7f\u7528\u200b\u3002

  2. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/ocr/assets \u200b\u76ee\u5f55\u200b\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b \u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6587\u4ef6\u200b\u3002

  3. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo \u200b\u76ee\u5f55\u200b\uff0c\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\u3002

  4. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo\uff0c\u200b\u8fd0\u884c\u200b run.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u5728\u200b\u7aef\u4fa7\u200b\u7684\u200b\u9884\u6d4b\u200b\u3002

\u200b\u6ce8\u610f\u4e8b\u9879\u200b\uff1a - \u200b\u5728\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b NDK_ROOT \u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e3a\u200b\u5b9e\u9645\u200b\u5b89\u88c5\u200b\u7684\u200b NDK \u200b\u8def\u5f84\u200b\u3002 - \u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b Git Bash \u200b\u6267\u884c\u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b\u3002 - \u200b\u82e5\u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b windows\u3002 - \u200b\u82e5\u200b\u5728\u200b Mac \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b darwin\u3002 - \u200b\u5728\u200b\u8fd0\u884c\u200b run.sh \u200b\u811a\u672c\u200b\u65f6\u9700\u200b\u4fdd\u6301\u200b ADB \u200b\u8fde\u63a5\u200b\u3002 - download.sh \u200b\u548c\u200b run.sh \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u53c2\u6570\u200b\u6765\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u200b\u4e0d\u200b\u6307\u5b9a\u200b\u5219\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PP-OCRv4_mobile \u200b\u6a21\u578b\u200b\u3002\u200b\u76ee\u524d\u200b\u9002\u914d\u200b\u4e86\u200b 2 \u200b\u4e2a\u200b\u6a21\u578b\u200b\uff1a - PP-OCRv3_mobile - PP-OCRv4_mobile

\u200b\u4ee5\u4e0b\u200b\u4e3a\u200b\u5b9e\u9645\u64cd\u4f5c\u200b\u65f6\u200b\u7684\u200b\u793a\u4f8b\u200b\uff1a

 # 1. \u200b\u4e0b\u8f7d\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\n cd PaddleX-Lite-Deploy/libs\n sh download.sh\n\n # 2. \u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6587\u4ef6\u200b\n cd ../ocr/assets\n sh download.sh PP-OCRv4_mobile\n\n # 3. \u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\n cd ../android/shell/ppocr_demo\n sh build.sh\n\n# 4. \u200b\u9884\u6d4b\u200b\n sh run.sh PP-OCRv4_mobile\n

\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\uff1a

The detection visualized image saved in ./test_img_result.jpg\n0       \u200b\u7eaf\u81fb\u200b\u8425\u517b\u200b\u62a4\u53d1\u7d20\u200b  0.993706\n1       \u200b\u4ea7\u54c1\u200b\u4fe1\u606f\u200b/\u200b\u53c2\u6570\u200b   0.991224\n2       \uff0845\u200b\u5143\u200b/\u200b\u6bcf\u516c\u65a4\u200b\uff0c100\u200b\u516c\u65a4\u200b\u8d77\u8ba2\u200b\uff09    0.938893\n3       \u200b\u6bcf\u74f6\u200b22\u200b\u5143\u200b\uff0c1000\u200b\u74f6\u200b\u8d77\u8ba2\u200b\uff09  0.988353\n4       \u3010\u200b\u54c1\u724c\u200b\u3011\uff1a\u200b\u4ee3\u52a0\u5de5\u200b\u65b9\u5f0f\u200b/OEMODM     0.97557\n5       \u3010\u200b\u54c1\u540d\u200b\u3011\uff1a\u200b\u7eaf\u81fb\u200b\u8425\u517b\u200b\u62a4\u53d1\u7d20\u200b        0.986914\n6       ODMOEM  0.929891\n7       \u3010\u200b\u4ea7\u54c1\u7f16\u53f7\u200b\u3011\uff1aYM-X-3011 0.964156\n8       \u3010\u200b\u51c0\u542b\u91cf\u200b\u3011\uff1a220ml       0.976404\n9       \u3010\u200b\u9002\u7528\u4eba\u7fa4\u200b\u3011\uff1a\u200b\u9002\u5408\u200b\u6240\u6709\u200b\u80a4\u8d28\u200b      0.987942\n10      \u3010\u200b\u4e3b\u8981\u200b\u6210\u5206\u200b\u3011\uff1a\u200b\u9cb8\u8721\u200b\u786c\u8102\u200b\u9187\u200b\u3001\u200b\u71d5\u9ea6\u200b\u03b2-\u200b\u8461\u805a\u200b    0.968315\n11      \u200b\u7cd6\u200b\u3001\u200b\u6930\u6cb9\u200b\u9170\u80fa\u200b\u4e19\u57fa\u200b\u751c\u83dc\u78b1\u200b\u3001\u200b\u6cdb\u9192\u200b    0.941537\n12      \uff08\u200b\u6210\u54c1\u200b\u5305\u6750\u200b\uff09    0.974796\n13      \u3010\u200b\u4e3b\u8981\u200b\u529f\u80fd\u200b\u3011\uff1a\u200b\u53ef\u200b\u7d27\u81f4\u200b\u5934\u53d1\u200b\u78f7\u5c42\u200b\uff0c\u200b\u4ece\u800c\u200b\u8fbe\u5230\u200b  0.988799\n14      \u200b\u5373\u65f6\u200b\u6301\u4e45\u200b\u6539\u5584\u200b\u5934\u53d1\u200b\u5149\u6cfd\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7ed9\u200b\u5e72\u71e5\u200b\u7684\u200b\u5934\u200b  0.989547\n15      \u200b\u53d1\u200b\u8db3\u591f\u200b\u7684\u200b\u6ecb\u517b\u200b    0.998413\n
"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html","title":"PaddleX 3.0 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3_doc\uff09 -- \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u5b9e\u9645\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u4f17\u591a\u200b\u573a\u666f\u200b\u4e2d\u200b\u90fd\u200b\u6709\u7740\u200b\u5e7f\u6cdb\u200b\u7684\u200b\u5e94\u7528\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5b66\u672f\u7814\u7a76\u200b\u3001\u200b\u56fe\u4e66\u9986\u200b\u7ba1\u7406\u200b\u3001\u200b\u79d1\u6280\u200b\u60c5\u62a5\u5206\u6790\u200b\u3001\u200b\u6587\u732e\u200b\u7efc\u8ff0\u200b\u64b0\u5199\u200b\u7b49\u200b\u573a\u666f\u200b\u3002\u200b\u901a\u8fc7\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u6280\u672f\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u4ece\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u4e2d\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u51fa\u200b\u6807\u9898\u200b\u3001\u200b\u4f5c\u8005\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5173\u952e\u8bcd\u200b\u3001\u200b\u53d1\u8868\u200b\u5e74\u4efd\u200b\u3001\u200b\u671f\u520a\u200b\u540d\u79f0\u200b\u3001\u200b\u5f15\u7528\u200b\u4fe1\u606f\u200b\u7b49\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5e76\u200b\u4ee5\u200b\u7ed3\u6784\u5316\u200b\u7684\u200b\u5f62\u5f0f\u200b\u5b58\u50a8\u200b\uff0c\u200b\u4fbf\u4e8e\u200b\u540e\u7eed\u200b\u7684\u200b\u68c0\u7d22\u200b\u3001\u200b\u5206\u6790\u200b\u4e0e\u200b\u5e94\u7528\u200b\u3002\u200b\u8fd9\u200b\u4e0d\u4ec5\u200b\u63d0\u5347\u200b\u4e86\u200b\u79d1\u7814\u4eba\u5458\u200b\u7684\u200b\u5de5\u4f5c\u6548\u7387\u200b\uff0c\u200b\u4e5f\u200b\u4e3a\u200b\u5b66\u672f\u7814\u7a76\u200b\u7684\u200b\u6df1\u5165\u200b\u53d1\u5c55\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u6709\u529b\u200b\u7684\u200b\u652f\u6301\u200b\u3002

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u8282\u200b\u4ee5\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u7684\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5e0c\u671b\u200b\u62bd\u53d6\u200b\u51fa\u200b\u8bba\u6587\u200b\u4e2d\u200b\u7684\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#21","title":"2.1 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u4f7f\u7528\u200b\u5343\u5e06\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u9875\u7709\u200b\", \"\u200b\u8868\u683c\u200b\u6807\u9898\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u4ec5\u200b\u652f\u6301\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\u6216\u8005\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\u200b\u4e0a\u200b\u83b7\u53d6\u200b\u76f8\u5173\u200b\u7684\u200b ak/sk(access_token)\u3002\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bAK\u200b\u548c\u200bSK\u200b\u9274\u6743\u200b\u8c03\u7528\u200bAPI\u200b\u6d41\u7a0b\u200b \u200b\u83b7\u53d6\u200bak/sk\uff0c\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio \u200b\u8bbf\u95ee\u200b\u4ee4\u724c\u200b\u4e2d\u200b\u83b7\u53d6\u200b access_token\u3002

\u200b\u8f93\u51fa\u200b\u6253\u5370\u200b\u7684\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

The result has been saved in output/tmpfnss9sq9_layout.jpg.\nThe result has been saved in output/tmpfnss9sq9_ocr.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\n\n{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u8868\u683c\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

\u200b\u5728\u200boutput \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u4e86\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u3001OCR\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u4ee5\u53ca\u200b\u8868\u683c\u200bhtml\u200b\u548c\u200bxlsx\u200b\u7ed3\u679c\u200b\u3002

\u200b\u5176\u4e2d\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u901a\u8fc7\u200b\u4e0a\u9762\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7684\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b Badcase \u200b\u5206\u6790\u200b\uff0c\u200b\u53d1\u73b0\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u5f53\u524d\u200b\u9700\u6c42\u200b\u573a\u666f\u200b\u4e2d\u200b\u5b58\u5728\u200b\u4e0b\u9762\u200b\u7684\u200b\u95ee\u9898\u200b\uff1a\u200b\u7531\u4e8e\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u76ee\u524d\u200b\u53ea\u200b\u533a\u5206\u200b\u4e86\u200b\u56fe\u200b\uff0c\u200b\u8868\u683c\u200b\u548c\u200b\u5370\u7ae0\u200b\u4e09\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u76ee\u524d\u200b\u65e0\u6cd5\u200b\u51c6\u786e\u200b\u7684\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u62bd\u53d6\u200b\u51fa\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u7b49\u200b\u5176\u4ed6\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5728\u200b{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u8868\u683c\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\u200b\u4e2d\u200b\u7684\u200b\u7ed3\u679c\u200b\u662f\u200b\u672a\u77e5\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u672c\u200b\u8282\u200b\u5de5\u4f5c\u200b\u805a\u7126\u200b\u4e8e\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u7684\u200b\u573a\u666f\u200b\uff0c\u200b\u5229\u7528\u200b\u8bba\u6587\u200b\u6587\u6863\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4ee5\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5bf9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u7248\u9762\u200b\u5206\u6790\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ece\u800c\u200b\u8fbe\u5230\u200b\u80fd\u591f\u200b\u7cbe\u786e\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u4fe1\u606f\u200b\u7684\u200b\u80fd\u529b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#22","title":"2.2 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u70b9\u51fb\u200b\u94fe\u63a5\u200b\u4e0b\u8f7d\u200b \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4e0a\u4f20\u200b\u81f3\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u62bd\u53d6\u200b\u6548\u679c\u200b\u3002\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 4 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/paperlayout.tar -P ./dataset\ntar -xf ./dataset/paperlayout.tar -C ./dataset/\n

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/paperlayout/\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 4734,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/train_4612.jpg\",\n      \"check_dataset\\/demo_img\\/train_4844.jpg\",\n      \"check_dataset\\/demo_img\\/train_0084.jpg\",\n      \"check_dataset\\/demo_img\\/train_0448.jpg\",\n      \"check_dataset\\/demo_img\\/train_4703.jpg\",\n      \"check_dataset\\/demo_img\\/train_3572.jpg\",\n      \"check_dataset\\/demo_img\\/train_4516.jpg\",\n      \"check_dataset\\/demo_img\\/train_2836.jpg\",\n      \"check_dataset\\/demo_img\\/train_1353.jpg\",\n      \"check_dataset\\/demo_img\\/train_0225.jpg\"\n    ],\n    \"val_samples\": 928,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/val_0982.jpg\",\n      \"check_dataset\\/demo_img\\/val_0607.jpg\",\n      \"check_dataset\\/demo_img\\/val_0623.jpg\",\n      \"check_dataset\\/demo_img\\/val_0890.jpg\",\n      \"check_dataset\\/demo_img\\/val_0036.jpg\",\n      \"check_dataset\\/demo_img\\/val_0654.jpg\",\n      \"check_dataset\\/demo_img\\/val_0895.jpg\",\n      \"check_dataset\\/demo_img\\/val_0059.jpg\",\n      \"check_dataset\\/demo_img\\/val_0142.jpg\",\n      \"check_dataset\\/demo_img\\/val_0088.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/paperlayout\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 4734\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 928\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/paperlayout\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a 1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 30\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 4\u3002 2. \u200b\u57fa\u4e8e\u200b RT-DETR-H_layout_3cls \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u56db\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.001\uff0c0.0005\uff0c0.0001\uff0c0.00001\u3002 3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0001\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 50\u3001100\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b mAP@0.50:0.95 1 0.00001 88.90 2 0.0001 92.41 3 0.0005 92.27 4 0.001 90.66

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.001 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [2\uff0c4\uff0c5] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b mAP@0.50:0.95 2 30 92.41 4 50 92.63 5 100 92.88

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5b8c\u5168\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

\u200b\u5728\u200b\u9009\u62e9\u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b\u65f6\u200b\uff0c\u200b\u8981\u200b\u8003\u8651\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u548c\u200b\u603b\u200b batch_size\uff0c\u200b\u4ee5\u53ca\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u5173\u7cfb\u200b\u3002\u200b\u9996\u5148\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u4e58\u4ee5\u200b\u5355\u5361\u200b batch_size \u200b\u7b49\u4e8e\u200b\u603b\u200b batch_size\u3002\u200b\u5176\u6b21\u200b\uff0c\u200b\u603b\u200b batch_size \u200b\u548c\u200b\u5b66\u4e60\u200b\u7387\u200b\u662f\u200b\u76f8\u5173\u200b\u7684\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u5e94\u200b\u4e0e\u200b\u603b\u200b batch_size \u200b\u4fdd\u6301\u200b\u540c\u6b65\u200b\u8c03\u6574\u200b\u3002 \u200b\u76ee\u524d\u200b\u9ed8\u8ba4\u200b\u5b66\u4e60\u200b\u7387\u200b\u5bf9\u5e94\u200b\u57fa\u4e8e\u200b 4 \u200b\u5361\u200b\u8bad\u7ec3\u200b\u7684\u200b\u603b\u200b batch_size\uff0c\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b\u5355\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u9664\u4ee5\u200b 4\u3002\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b 8 \u200b\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u4e58\u4ee5\u200b 2\u3002

\u200b\u8c03\u6574\u200b\u4e0d\u540c\u200b\u53c2\u6570\u200b\u6267\u884c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u547d\u4ee4\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#54","title":"5.4 \u200b\u6a21\u578b\u200b\u6d4b\u8bd5","text":"

\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200btest.jpg\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

\u200b\u9996\u5148\u200b\u83b7\u53d6\u200b\u5e76\u200b\u66f4\u65b0\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6267\u884c\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

\u200b\u5c06\u200bPP-ChatOCRv3-doc.yaml\u200b\u4e2d\u200b\u7684\u200bPipeline.layout_model\u200b\u5b57\u200b\u6bb5\u200b\u4fee\u6539\u200b\u4e3a\u200b\u4e0a\u9762\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u4fee\u6539\u200b\u540e\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a

Pipeline:\n  layout_model: ./output/best_model/inference\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5e94\u7528\u200b\u914d\u7f6e\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u9875\u7709\u200b\", \"\u200b\u8868\u683c\u200b\u6807\u9898\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output_ft\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u6253\u5370\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7ed3\u679c\u200b\uff1a

{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u7b2c\u200b43\u200b\u5377\u200b\\n \u200b\u822a\u7a7a\u200b\u53d1\u52a8\u673a\u200b\\n 44', '\u200b\u8868\u683c\u200b\u6807\u9898\u200b': '\u200b\u8868\u200b1\u200b\u6a21\u62df\u200b\u6765\u6d41\u200bMa=5\u200b\u98de\u884c\u200b\u7684\u200b\u7a7a\u6c14\u200b\u52a0\u70ed\u5668\u200b\u5de5\u4f5c\u200b\u53c2\u6570\u200b'}, 'prompt': ''}\n

\u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u4e4b\u540e\u200b\uff0c\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u5df2\u7ecf\u200b\u88ab\u200b\u6b63\u786e\u200b\u7684\u200b\u63d0\u53d6\u200b\u51fa\u6765\u200b\u3002

\u200b\u7248\u9762\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff0c\u200b\u5df2\u7ecf\u200b\u6b63\u786e\u200b\u589e\u52a0\u200b\u4e86\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u7684\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u80fd\u529b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u5982\u200b\u4e0b\u9762\u200b\u4ee3\u7801\u200b\u6240\u793a\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u9875\u7709\u200b\", \"\u200b\u8868\u683c\u200b\u6807\u9898\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html","title":"PaddleX 3.0 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3_doc\uff09 \u2014\u2014 \u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u5370\u7ae0\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u5b9e\u9645\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002\u200b\u91c7\u7528\u200b\u4eba\u5de5\u667a\u80fd\u200b\u6280\u672f\u200b\u8fdb\u884c\u200b\u5370\u7ae0\u200b\u81ea\u52a8\u8bc6\u522b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u6709\u6548\u200b\u8282\u7701\u200b\u4eba\u529b\u200b\u6210\u672c\u200b\uff0c\u200b\u63d0\u9ad8\u6548\u7387\u200b\u3002

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u8282\u200b\u4e3a\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\uff0c\u200b\u4e0d\u96be\u200b\u53d1\u73b0\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u4e0e\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u5b58\u5728\u200b\u7740\u200b\u7d27\u5bc6\u200b\u7684\u200b\u5173\u8054\u200b\u3002\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\uff0c\u200b\u5373\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u4e00\u4e2a\u200b\u7ecf\u5178\u200b\u95ee\u9898\u200b\u3002\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#21","title":"2.1 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u4f7f\u7528\u200b\u5343\u5e06\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u4ec5\u200b\u652f\u6301\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\u6216\u8005\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\u200b\u4e0a\u200b\u83b7\u53d6\u200b\u76f8\u5173\u200b\u7684\u200b ak/sk(access_token)\u3002\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bAK\u200b\u548c\u200bSK\u200b\u9274\u6743\u200b\u8c03\u7528\u200bAPI\u200b\u6d41\u7a0b\u200b \u200b\u83b7\u53d6\u200bak/sk\uff0c\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio \u200b\u8bbf\u95ee\u200b\u4ee4\u724c\u200b\u4e2d\u200b\u83b7\u53d6\u200b access_token\u3002

\u200b\u8f93\u51fa\u200b\u6253\u5370\u200b\u7684\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

The result has been saved in output/tmpx5tmgsem_curve_0.jpg.\nThe result has been saved in output/tmpx5tmgsem_layout.jpg.\nThe result has been saved in output/tmpx5tmgsem_ocr.jpg.\nThe retrieved vectorstore is not for PaddleX and will return vectorstore directly\n\n{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u51fb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

\u200b\u5728\u200boutput \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u4e86\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001OCR\uff08\u200b\u5982\u200b\u6709\u200b\u8868\u683c\u200b\uff0c\u200b\u8fd8\u6709\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u4ee5\u53ca\u200b\u8868\u683c\u200bhtml\u200b\u548c\u200bxlsx\uff09\u200b\u7ed3\u679c\u200b\u3002

\u200b\u5176\u4e2d\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u901a\u8fc7\u200b\u4e0a\u9762\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7684\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b Badcase \u200b\u5206\u6790\u200b\uff0c\u200b\u53d1\u73b0\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u5f53\u524d\u200b\u9700\u6c42\u200b\u573a\u666f\u200b\u4e2d\u200b\u5b58\u5728\u200b\u4e0b\u9762\u200b\u7684\u200b\u95ee\u9898\u200b\uff1a\u200b\u5728\u200bOCR\u200b\u8bc6\u522b\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u4e2d\u200b\uff0c\u200b\u5370\u7ae0\u200b\u7684\u200b\u6587\u672c\u200b\u5f2f\u66f2\u200b\u68c0\u6d4b\u200b\u6846\u6709\u200b\u504f\u5dee\u200b\uff0c\u200b\u5bfc\u81f4\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff1b\u200b\u5370\u7ae0\u200b\u7684\u200b\u4fe1\u606f\u200b\u6ca1\u6709\u200b\u88ab\u200b\u6b63\u786e\u200b\u7684\u200b\u62bd\u53d6\u200b\u51fa\u6765\u200b\u3002\u200b\u5728\u200b{'chat_res': {'\u200b\u5370\u7ae0\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\u200b\u4e2d\u200b\u7684\u200b\u7ed3\u679c\u200b\u662f\u200b\u672a\u77e5\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u672c\u200b\u8282\u200b\u5de5\u4f5c\u200b\u805a\u7126\u200b\u4e8e\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7684\u200b\u573a\u666f\u200b\uff0c\u200b\u5bf9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ece\u800c\u200b\u8fbe\u5230\u200b\u80fd\u591f\u200b\u7cbe\u786e\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u7684\u200b\u80fd\u529b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#22","title":"2.2 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u70b9\u51fb\u200b\u94fe\u63a5\u200b\u4e0b\u8f7d\u200b \u200b\u5370\u7ae0\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4e0a\u4f20\u200b\u81f3\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u62bd\u53d6\u200b\u6548\u679c\u200b\u3002\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 2 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u5370\u7ae0\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/practical_seal.tar -P ./dataset\ntar -xf ./dataset/practical_seal.tar -C ./dataset/\n

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/practical_seal/\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u200b\u68c0\u6d4b\u200b\u6846\u200b\u957f\u5bbd\u200b\u6bd4\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 793,\n    \"train_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4055390_00006_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3712248_00008_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4227328_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3745965_00007_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3980931_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC5896212_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3838814_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4677212_00002_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4058803_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4925966_00001_seal_0_crop.png\"\n    ],\n    \"val_samples\": 277,\n    \"val_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/15.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/16.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/17.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/18.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/19.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/20.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/21.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/22.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/23.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/24.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/practical_seal\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 793\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 277\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u957f\u5bbd\u200b\u6bd4\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4 \\\n    -o Train.learning_rate=0.0001\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/practical_seal\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a 1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 30\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 4\u3002 2. \u200b\u57fa\u4e8e\u200b PP-OCRv4_server_seal_det \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.001\uff0c0.0001\uff0c0.00001\u3002 3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b1\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 100\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b \u200b\u68c0\u6d4b\u200b Hmean(%) 1 0.001 97.35 2 0.0001 93.32 3 0.00001 87.63

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.001 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [1\uff0c4] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b \u200b\u68c0\u6d4b\u200b Hmean(%) 1 30 97.35 4 100 98.13

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5b8c\u5168\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

\u200b\u5728\u200b\u9009\u62e9\u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b\u65f6\u200b\uff0c\u200b\u8981\u200b\u8003\u8651\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u548c\u200b\u603b\u200b batch_size\uff0c\u200b\u4ee5\u53ca\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u5173\u7cfb\u200b\u3002\u200b\u9996\u5148\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u4e58\u4ee5\u200b\u5355\u5361\u200b batch_size \u200b\u7b49\u4e8e\u200b\u603b\u200b batch_size\u3002\u200b\u5176\u6b21\u200b\uff0c\u200b\u603b\u200b batch_size \u200b\u548c\u200b\u5b66\u4e60\u200b\u7387\u200b\u662f\u200b\u76f8\u5173\u200b\u7684\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u5e94\u200b\u4e0e\u200b\u603b\u200b batch_size \u200b\u4fdd\u6301\u200b\u540c\u6b65\u200b\u8c03\u6574\u200b\u3002 \u200b\u76ee\u524d\u200b\u9ed8\u8ba4\u200b\u5b66\u4e60\u200b\u7387\u200b\u5bf9\u5e94\u200b\u57fa\u4e8e\u200b 4 \u200b\u5361\u200b\u8bad\u7ec3\u200b\u7684\u200b\u603b\u200b batch_size\uff0c\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b\u5355\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u9664\u4ee5\u200b 4\u3002\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b 8 \u200b\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u4e58\u4ee5\u200b 2\u3002

\u200b\u8c03\u6574\u200b\u4e0d\u540c\u200b\u53c2\u6570\u200b\u6267\u884c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u547d\u4ee4\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u5370\u7ae0\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

\u200b\u9996\u5148\u200b\u83b7\u53d6\u200b\u5e76\u200b\u66f4\u65b0\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6267\u884c\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

\u200b\u5c06\u200bPP-ChatOCRv3-doc.yaml\u200b\u4e2d\u200b\u7684\u200bPipeline.seal_text_det_model\u200b\u5b57\u200b\u6bb5\u200b\u4fee\u6539\u200b\u4e3a\u200b\u4e0a\u9762\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u4fee\u6539\u200b\u540e\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: ./output/best_accuracy/inference\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5e94\u7528\u200b\u914d\u7f6e\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output_ft\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u6253\u5370\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7ed3\u679c\u200b\uff1a

{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u5e7f\u5173\u5e02\u200b\u56fd\u58eb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

\u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u4e4b\u540e\u200b\uff0c\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u5df2\u7ecf\u200b\u88ab\u200b\u6b63\u786e\u200b\u7684\u200b\u63d0\u53d6\u200b\u51fa\u6765\u200b\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff0c\u200b\u5df2\u7ecf\u200b\u6b63\u786e\u200b\u62bd\u53d6\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u5982\u200b\u4e0b\u9762\u200b\u4ee3\u7801\u200b\u6240\u793a\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u5783\u573e\u200b\u7684\u200b\u5177\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08ImageNet-1k \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 80 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b Top1 Acc(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) PP-HGNetV2_B6 86.30 10.46 240.18 288 CLIP_vit_base_patch16_224 85.39 12.03 234.85 331 PP-HGNetV2_B4 83.57 2.45 38.10 76 SwinTransformer_base_patch4_window7_224 83.37 12.35 - 342 PP-HGNet_small 81.51 4.24 108.21 94 PP-HGNetV2_B0 77.77 0.68 6.41 23 ResNet50 76.50 3.12 50.90 98 PP-LCNet_x1_0 71.32 1.01 3.39 7 MobileNetV3_small_x1_0 68.24 1.09 3.65 12

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\uff0cGPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-LCNet_x1_0 \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/trash40.tar -P ./dataset\ntar -xf ./dataset/trash40.tar -C ./dataset/\n

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/trash40/\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": ../../dataset/trash40/label.txt\",\n    \"num_classes\": 40,\n    \"train_samples\": 1605,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/img_14950.jpg\",\n      \"check_dataset/demo_img/img_12045.jpg\",\n    ],\n    \"val_samples\": 3558,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/img_198.jpg\",\n      \"check_dataset/demo_img/img_19627.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/trash40/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 40\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1605\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 3558\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/trash40 \\\n    -o Train.num_classes=40\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/trash40\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\uff0c\u200b\u56e0\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6570\u636e\u91cf\u200b\u8f83\u200b\u5c0f\u200b\uff0c\u200b\u6240\u4ee5\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 64\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-LCNet_x1_0 \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.01\uff0c0.001\uff0c0.1\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.01\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8f6e\u6b21\u200b\u5728\u200b 100epoch \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b Top1 Acc \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 20 0.01 64 4\u200b\u5361\u200b 73.83% \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 20 0.001 64 4\u200b\u5361\u200b 30.64% \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 20 0.1 64 4\u200b\u5361\u200b 71.53%

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b Top1 Acc \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 20 0.01 64 4\u200b\u5361\u200b 73.83% \u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 50 0.01 64 4\u200b\u5361\u200b 77.32% \u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 80 0.01 64 4\u200b\u5361\u200b 77.60% \u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.01 64 4\u200b\u5361\u200b 77.80%

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bgarbage_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/image_classification.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/image_classification.yaml\")\noutput = pipeline.predict(\"./dataset/trash40/images/test/0/img_154.jpg\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline instance_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u5206\u5272\u200b\u51fa\u200b\u5730\u7406\u200b\u7a7a\u95f4\u200b\u5bf9\u8c61\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 15 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mAP(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) Mask-RT-DETR-H 48.8 61.40 486 Mask-RT-DETR-X 47.5 45.70 257 Mask-RT-DETR-L 45.7 37.40 123 Mask-RT-DETR-S 40.9 32.40 57

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\uff0cGPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA V100 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b Mask-RT-DETR-H \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/intseg_remote_sense_coco.tar -P ./dataset\ntar -xf ./dataset/intseg_remote_sense_coco.tar -C ./dataset/\n

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 2989,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/524.jpg\",\n      \"check_dataset/demo_img/024.jpg\",\n    ],\n    \"val_samples\": 932,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/326.jpg\",\n      \"check_dataset/demo_img/596.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/intseg_remote_sense_coco/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 10\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2989\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 932\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco \\\n    -o Train.num_classes=10\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 80\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 2\u3002
  2. \u200b\u57fa\u4e8e\u200b Mask-RT-DETR-H \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.0005\uff0c0.005\uff0c0.0001
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0001\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 80 0.0005 2 4\u200b\u5361\u200b 0.695 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 80 0.0001 2 4\u200b\u5361\u200b 0.825 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 80 0.00005 2 4\u200b\u5361\u200b 0.706

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 80 0.0001 2 4\u200b\u5361\u200b 0.825 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 30 0.0001 2 4\u200b\u5361\u200b 0.287 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 50 0.0001 2 4\u200b\u5361\u200b 0.545 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.0001 2 4\u200b\u5361\u200b 0.813

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bremotesensing_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/instance_segmentation.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/instance_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u68c0\u6d4b\u200b\u884c\u4eba\u200b\u662f\u5426\u200b\u8dcc\u5012\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 37 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mAP(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200bPP-YOLOE_plus-S\u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/object_detection_fall_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/fall_det.tar -P ./dataset\ntar -xf ./dataset/fall_det.tar -C ./dataset/\n

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/fall_det\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 1224,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/fall_1168.jpg\",\n      \"check_dataset/demo_img/fall_1113.jpg\"\n    ],\n    \"val_samples\": 216,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/fall_349.jpg\",\n      \"check_dataset/demo_img/fall_394.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/fall_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1224\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 216\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/object_detection_fall_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/fall_det \\\n    -o Train.num_classes=1\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/fall_det\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 10\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 8\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-YOLOE_plus-S \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.00002\uff0c0.0001\uff0c0.0005\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0001\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8f6e\u6b21\u200b\u5728\u200b 100epoch \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 10 0.00002 8 4\u200b\u5361\u200b 0.880 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 10 0.0001 8 4\u200b\u5361\u200b 0.910 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 10 0.0005 8 4\u200b\u5361\u200b 0.888

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 10 0.0001 8 4\u200b\u5361\u200b 0.910 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 50 0.0001 8 4\u200b\u5361\u200b 0.944 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.0001 8 4\u200b\u5361\u200b 0.947

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bfall.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/object_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u80fd\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u65f6\u5c1a\u200b\u670d\u88c5\u200b\u5143\u7d20\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 37 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mAP(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PicoDet-L \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_mini_fashion_pedia_coco.tar -P ./dataset\ntar -xf ./dataset/det_mini_fashion_pedia_coco.tar -C ./dataset/\n

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 15,\n    \"train_samples\": 4000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/297ea597f7dfa6d710b2e8176cb3b913.jpg\",\n      \"check_dataset/demo_img/2d8b75ce472dbebd41ca8527f0a292f3.jpg\"\n    ],\n    \"val_samples\": 800,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/40e13ebcfa281567c92fc9842510abea.jpg\",\n      \"check_dataset/demo_img/87808e379034ac2344f5132d3dccc6e6.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_mini_fashion_pedia_coco\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 15\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 4000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 800\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco \\\n    -o Train.num_classes=15\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 50\uff1a-o Train.epochs_iters=50\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 50\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\u3002
  2. \u200b\u57fa\u4e8e\u200b PicoDet-L \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.02\uff0c0.04\uff0c0.08\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.04\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8f6e\u6b21\u200b\u5728\u200b 80epoch \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 50 0.02 16 4\u200b\u5361\u200b 0.428 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 50 0.04 16 4\u200b\u5361\u200b 0.471 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 50 0.08 16 4\u200b\u5361\u200b 0.440

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 50 0.04 16 4\u200b\u5361\u200b 0.471 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 30 0.04 16 4\u200b\u5361\u200b 0.425 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 80 0.04 16 4\u200b\u5361\u200b 0.491 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.04 16 4\u200b\u5361\u200b 0.459

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bFashionPedia_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/object_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200bOCR\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200bOCR\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 2 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b \u200b\u68c0\u6d4b\u200bHmean(%) \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleOCR \u200b\u81ea\u200b\u5efa\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u68c0\u6d4b\u200bHmean \u200b\u548c\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy\uff0cGPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002 \u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-OCRv4_server \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ocr_det_license_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ccpd_text_det.tar -P ./dataset\ntar -xf ./dataset/ccpd_text_det.tar -C ./dataset/\n

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 5769,\n    \"train_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/0274305555556-90_266-204&460_520&548-516&548_209&547_204&464_520&460-0_0_3_25_24_24_24_26-63-89.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0126171875-90_267-294&424_498&486-498&486_296&485_294&425_496&424-0_0_3_24_33_32_30_31-157-29.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0371516927083-89_254-178&423_517&534-517&534_204&525_178&431_496&423-1_0_3_24_33_31_29_31-117-667.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/03349609375-90_268-211&469_526&576-526&567_214&576_211&473_520&469-0_0_3_27_31_32_29_32-174-48.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0388454861111-90_269-138&409_496&518-496&518_138&517_139&410_491&409-0_0_3_24_27_26_26_30-174-148.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0198741319444-89_112-208&517_449&600-423&593_208&600_233&517_449&518-0_0_3_24_28_26_26_26-87-268.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3027782118055555555-91_92-186&493_532&574-529&574_199&565_186&497_532&493-0_0_3_27_26_30_33_32-73-336.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/034375-90_258-168&449_528&546-528&542_186&546_168&449_525&449-0_0_3_26_30_30_26_33-94-221.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0286501736111-89_92-290&486_577&587-576&577_290&587_292&491_577&486-0_0_3_17_25_28_30_33-134-122.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/02001953125-92_103-212&486_458&569-458&569_224&555_212&486_446&494-0_0_3_24_24_25_24_24-88-24.jpg\"\n    ],\n    \"val_samples\": 1001,\n    \"val_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/3056141493055555554-88_93-205&455_603&597-603&575_207&597_205&468_595&455-0_0_3_24_32_27_31_33-90-213.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0680295138889-88_94-120&474_581&623-577&605_126&623_120&483_581&474-0_0_5_24_31_24_24_24-116-518.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0482421875-87_265-154&388_496&530-490&495_154&530_156&411_496&388-0_0_5_25_33_33_33_33-84-104.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0347504340278-105_106-235&443_474&589-474&589_240&518_235&443_473&503-0_0_3_25_30_33_27_30-162-4.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0205338541667-93_262-182&428_410&519-410&519_187&499_182&428_402&442-0_0_3_24_26_29_32_24-83-63.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0380913628472-97_250-234&403_529&534-529&534_250&480_234&403_528&446-0_0_3_25_25_24_25_25-185-85.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/020598958333333334-93_267-256&471_482&563-478&563_256&546_262&471_482&484-0_0_3_26_24_25_32_24-102-115.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3030323350694444445-86_131-170&495_484&593-434&569_170&593_226&511_484&495-11_0_5_30_30_31_33_24-118-59.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3016158854166666667-86_97-243&471_462&546-462&527_245&546_243&479_453&471-0_0_3_24_30_27_24_29-98-40.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0340831163194-89_264-177&412_488&523-477&506_177&523_185&420_488&412-0_0_3_24_30_29_31_31-109-46.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/ccpd_text_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 5769\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1001\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ocr_det_license_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 10\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 8\uff0c\u200b\u5361\u6570\u200b\u9009\u62e9\u200b 4 \u200b\u5361\u200b\uff0c\u200b\u603b\u6279\u200b\u5927\u5c0f\u200b\u662f\u200b 32\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-OCRv4_server_det \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u56db\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.00005\uff0c0.0001\uff0c0.0005\uff0c0.001\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b 4 \u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b0.001\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b \u200b\u68c0\u6d4b\u200bHmean(%) 1 0.00005 99.06 2 0.0001 99.55 3 0.0005 99.60 4 0.001 99.70

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.001 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [4\uff0c5] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002 \u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b \u200b\u68c0\u6d4b\u200b Hmean(%) 4 10 99.70 5 20 99.80

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir output/best_accuracy/inference None \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bcase1.jpg\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/OCR.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200bOCR\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u624b\u5199\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u624b\u5199\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u624b\u5199\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200bOCR\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 4 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200bOCR\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b \u200b\u68c0\u6d4b\u200bHmean(%) \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

\u200b\u6ce8\u200b\uff1a\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b1.1w\u200b\u5f20\u200b\u56fe\u7247\u200b\uff0c\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32 \u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-OCRv4_server \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u624b\u5199\u4f53\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/handwrite_chinese_text_rec.tar -P ./dataset\ntar -xf ./dataset/handwrite_chinese_text_rec.tar -C ./dataset/\n

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 23965,\n    \"train_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/64957.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/138926.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/86760.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/83191.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/79882.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/58639.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1187-P16_1.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/8199.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1225-P19_9.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/183335.png\"\n    ],\n    \"val_samples\": 17259,\n    \"val_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/11.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/12.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/13.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/14.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/15.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/16.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/17.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/18.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/19.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/20.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/handwrite_chinese_text_rec\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 23965\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 17259\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 8, \u200b\u5361\u6570\u200b\u9009\u62e9\u200b 4 \u200b\u5361\u200b\uff0c\u200b\u603b\u6279\u200b\u5927\u5c0f\u200b\u662f\u200b 32\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u56db\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.001\uff0c0.005\uff0c0.0002\uff0c0.0001.
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b 3 \u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0002\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 30\u300150 \u200b\u548c\u200b 80\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b \u200b\u8bc6\u522b\u200b Acc (%) 1 0.001 43.28 2 0.005 32.63 3 0.0002 49.64 4 0.0001 46.32

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.0002 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [4, 5, 6, 7] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002 \u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b \u200b\u8bc6\u522b\u200b Acc (%) 4 20 49.64 5 30 52.03 6 50 54.15 7 80 54.35

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir None output/best_accuracy/inference \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bcase.jpg\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/OCR.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline semantic_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u5206\u5272\u200b\u51fa\u200b\u8f66\u9053\u200b\u7ebf\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08Cityscapes \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 18 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mIoU (%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) OCRNet_HRNet-W48 82.15 87.97 2180.76 270 PP-LiteSeg-T 77.04 5.98 140.02 31

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-LiteSeg-T \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/semantic-segmentation-makassaridn-road-dataset.tar -P ./dataset\ntar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./dataset/\n

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 300,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/20220311151733_0060_040.jpg\",\n      \"check_dataset/demo_img/20220311153115_0023_039.jpg\"\n    ],\n    \"val_samples\": 74,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/20220311152033_0060_007.jpg\",\n      \"check_dataset/demo_img/20220311144930_0060_026.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/semantic-segmentation-makassaridn-road-dataset\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 300\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 74\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \\\n    -o Train.num_classes=4\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff1a-o Train.epochs_iters=5000\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 2\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-LiteSeg-T \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.006\uff0c0.008\uff0c0.01\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.008\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u5728\u200b 80000 \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5000 0.006 2 4\u200b\u5361\u200b 0.623 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5000 0.008 2 4\u200b\u5361\u200b 0.629 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5000 0.01 2 4\u200b\u5361\u200b 0.619

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5000 0.008 2 4\u200b\u5361\u200b 0.629 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 10000 0.008 2 4\u200b\u5361\u200b 0.773 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 40000 0.008 2 4\u200b\u5361\u200b 0.855 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 80000 0.008 2 4\u200b\u5361\u200b 0.863

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bmakassaridn-road_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/semantic_segmentation.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html","title":"PaddleX 3.0 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u8bbe\u5907\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u5e94\u7528\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8bbe\u5907\u200b\u8282\u70b9\u200b\u7684\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u200b\u4efb\u52a1\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u8bbe\u5907\u200b\u8282\u70b9\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u884c\u4e3a\u200b\u6216\u200b\u5f02\u5e38\u200b\u72b6\u6001\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u548c\u200b\u89e3\u51b3\u200b\u5e94\u7528\u670d\u52a1\u5668\u200b\u8282\u70b9\u200b\u4e2d\u200b\u7684\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u7cfb\u7edf\u200b\u7684\u200b\u53ef\u9760\u6027\u200b\u548c\u200b\u53ef\u7528\u6027\u200b\u3002\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX \u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    from paddlex import create_model\nmodel = create_model(\"PatchTST_ad\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u53ef\u4ee5\u200b\u8fdb\u5165\u200b \u200b\u5b98\u65b9\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u80fd\u529b\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002
"},{"location":"practical_tutorials/ts_anomaly_detection.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b5\u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear_ad 0.9898 0.9396 0.9641 72.8K DLinear_ad\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b Nonstationary_ad 0.9855 0.8895 0.9351 1.5MB \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b AutoEncoder_ad 0.9936 0.8436 0.9125 32K AutoEncoder_ad\u200b\u662f\u200b\u7ecf\u5178\u200b\u7684\u200b\u81ea\u200b\u7f16\u7801\u200b\u7ed3\u6784\u200b\u7684\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PatchTST_ad 0.9878 0.9070 0.9457 164K PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b TimesNet_ad 0.9837 0.9480 0.9656 732K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPSM\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u957f\u5ea6\u200b\u4e3a\u200b100\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ts_anomaly_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u4e3a\u4e86\u200b\u6f14\u793a\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6574\u4e2a\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u200b\u4f7f\u7528\u200b\u516c\u5f00\u200b\u7684\u200b MSL \u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u53ca\u200b\u9a8c\u8bc1\u200b\u3002PSM\uff08\u200b\u706b\u661f\u200b\u79d1\u5b66\u200b\u5b9e\u9a8c\u5ba4\u200b\uff09\u200b\u6570\u636e\u200b\u96c6\u7531\u200b\u6765\u81ea\u200b\u7f8e\u56fd\u56fd\u5bb6\u822a\u7a7a\u822a\u5929\u5c40\u200b\uff0c\u200b\u5177\u6709\u200b 55 \u200b\u4e2a\u200b\u7ef4\u5ea6\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5305\u542b\u200b\u6765\u81ea\u200b\u822a\u5929\u5668\u200b\u76d1\u6d4b\u200b\u7cfb\u7edf\u200b\u7684\u200b\u610f\u5916\u4e8b\u4ef6\u200b\u5f02\u5e38\u200b\uff08ISA\uff09\u200b\u62a5\u544a\u200b\u7684\u200b\u9065\u6d4b\u200b\u5f02\u5e38\u200b\u6570\u636e\u200b\u3002\u200b\u5177\u6709\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u80cc\u666f\u200b\uff0c\u200b\u80fd\u591f\u200b\u66f4\u597d\u200b\u5730\u200b\u53cd\u6620\u200b\u771f\u5b9e\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff0c\u200b\u901a\u5e38\u200b\u7528\u4e8e\u200b\u6d4b\u8bd5\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3002

\u200b\u6211\u4eec\u200b\u5df2\u7ecf\u200b\u5c06\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u6807\u51c6\u200b\u6570\u636e\u683c\u5f0f\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/msl.tar -P ./dataset\ntar -xf ./dataset/msl.tar -C ./dataset/\n
* \u200b\u6570\u636e\u200b\u6ce8\u610f\u4e8b\u9879\u200b * \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e0\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u4efb\u52a1\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4e0d\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u3002\u200b\u6536\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u6837\u672c\u200b\u5c3d\u53ef\u80fd\u200b\u4fdd\u8bc1\u200b\u90fd\u200b\u662f\u200b\u6b63\u5e38\u200b\u6570\u636e\u200b\uff0c\u200b\u5373\u200b\u6ca1\u6709\u200b\u5f02\u5e38\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u6807\u7b7e\u200b\u5217\u5747\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0\uff0c\u200b\u6216\u8005\u200b\u4e0d\u200b\u8bbe\u7f6e\u200b\u6807\u7b7e\u200b\u5217\u200b\u4e5f\u200b\u662f\u200b\u53ef\u4ee5\u200b\u7684\u200b\u3002\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u4e3a\u4e86\u200b\u9a8c\u8bc1\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u9700\u8981\u200b\u8fdb\u884c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u67d0\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u200b\u5f02\u5e38\u200b\u7684\u200b\u70b9\u200b\uff0c\u200b\u8be5\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 1\uff0c\u200b\u6b63\u5e38\u200b\u7684\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u4e3a\u200b 0\u3002 * \u200b\u7f3a\u5931\u200b\u503c\u200b\u5904\u7406\u200b\uff1a\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002 * \u200b\u975e\u200b\u91cd\u590d\u6027\u200b\uff1a\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u662f\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u987a\u5e8f\u200b\u6309\u884c\u200b\u6536\u96c6\u200b\u7684\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u4e0d\u80fd\u200b\u91cd\u590d\u200b\u51fa\u73b0\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/msl\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 58317,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"0\",\n        \"1\",\n        \"2\",\n        \"...\"\n      ]\n      [\n        \"...\"\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/msl\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\u6570\u636e\u200b\u90e8\u5206\u200b\u5df2\u200b\u7701\u7565\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 58317
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 73729
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"practical_tutorials/ts_anomaly_detection.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b4.1.3\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ts_anomaly_detection.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

  python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/msl \\\n    -o Train.epochs_iters=5 \\\n    -o Train.batch_size=16 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.time_col=timestamp \\\n    -o Train.feature_cols=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 \\\n    -o Train.freq=1 \\\n    -o Train.label_col=label \\\n    -o Train.seq_len=96\n
\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b(\u200b\u65f6\u5e8f\u200b\u6a21\u578b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b)\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
  • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\u3001\u200b\u5355\u4f8b\u200b\u6d4b\u8bd5\u200b\uff08predict\uff09\uff1b
  • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\uff1b\u200b\u53ef\u200b\u5728\u200b PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u200b\u540c\u7ea7\u200b\u76ee\u5f55\u200b\u7684\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u67e5\u770b\u200b\u4e0d\u540c\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
  • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
  • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b
  • batch_size\uff1a\u200b\u8bad\u7ec3\u200b\u5355\u5361\u200b\u6279\u200b\u5927\u5c0f\u200b\u8bbe\u7f6e\u200b\uff1b
  • time_col: \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff1b
  • feature_cols:\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u8868\u793a\u200b\u80fd\u591f\u200b\u5224\u65ad\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u76f8\u5173\u200b\u53d8\u91cf\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\uff0c\u200b\u53ef\u80fd\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u8fd0\u8f6c\u200b\u65f6\u200b\u7684\u200b\u6563\u70ed\u91cf\u200b\u6709\u5173\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u8bbe\u7f6e\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u540d\u200b\u6709\u200b 55 \u200b\u4e2a\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200b\uff1a0, 1 \u200b\u7b49\u200b\uff1b
  • freq\uff1a\u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\uff1b
  • input_len: \u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff0c\u200b\u4f1a\u200b\u6309\u7167\u200b\u8be5\u200b\u957f\u5ea6\u200b\u5bf9\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5207\u7247\u200b\uff0c\u200b\u9884\u6d4b\u200b\u8be5\u200b\u957f\u5ea6\u200b\u4e0b\u200b\u8fd9\u200b\u4e00\u6bb5\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u8003\u8651\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\u3002\u200b\u8868\u793a\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b 96 \u200b\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\uff1b
  • label\uff1a\u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u7f16\u53f7\u200b\uff0c\u200b\u5f02\u5e38\u200b\u70b9\u4e3a\u200b 1\uff0c\u200b\u6b63\u5e38\u200b\u70b9\u4e3a\u200b 0\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u76d1\u63a7\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b label\u3002 \u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 1 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002
\u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference*\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ts_anomaly_detection.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/msl\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b f1\u3001recall \u200b\u548c\u200b precision\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u57fa\u4e8e\u200b\u63a7\u5236\u53d8\u91cf\u200b\u7684\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5728\u200b\u521d\u59cb\u200b\u9636\u6bb5\u200b\u57fa\u4e8e\u200b\u56fa\u5b9a\u200b\u7684\u200b\u8f83\u200b\u5c0f\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u591a\u6b21\u200b\u8c03\u6574\u200b\u5b66\u4e60\u200b\u7387\u200b\uff0c\u200b\u4ece\u800c\u200b\u627e\u5230\u200b\u8f83\u4f18\u200b\u5b66\u4e60\u200b\u7387\u200b\uff1b\u200b\u4e4b\u540e\u200b\u518d\u6b21\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u4e0b\u9762\u200b\u6211\u4eec\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u8c03\u53c2\u200b\u65b9\u6cd5\u200b:

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 5\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\uff0c\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\u3002
  2. \u200b\u57fa\u4e8e\u200b PatchTST_ad \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.0001\uff0c0.0005\uff0c0.001\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\uff0c\u200b\u5176\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\u3002\u200b\u56e0\u6b64\u200b\u5b66\u4e60\u200b\u7387\u200b\u56fa\u5b9a\u200b\u4e3a\u200b 0.001\uff0c\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\u3002
  4. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u56db\u200b\u4e0e\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u4e00\u81f4\u200b\uff0c\u200b\u8bf4\u660e\u200b\u65e0\u9700\u200b\u518d\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u3002 \u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a
\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200bF1 score (%) \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5 0.0001 16 96 1\u200b\u5361\u200b 79.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.0005 16 96 1\u200b\u5361\u200b 80.1 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.001 16 96 1\u200b\u5361\u200b 80.9

\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200bF1 score (%) \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.0005 16 96 1\u200b\u5361\u200b 80.9 \u200b\u5b9e\u9a8c\u200b\u56db\u200b 20 0.0005 16 96 1\u200b\u5361\u200b 80.9"},{"location":"practical_tutorials/ts_anomaly_detection.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/test.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPatchTST_ad.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"practical_tutorials/ts_anomaly_detection.html#7","title":"7.\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff1a

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
    \u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

  2. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html","title":"PaddleX 3.0 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u5fc3\u8df3\u200b\u76d1\u6d4b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u5206\u7c7b\u200b\u5e94\u7528\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u5fc3\u8df3\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u7684\u200b\u5206\u7c7b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ts_classification.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u200b\u4efb\u52a1\u200b\u76ee\u6807\u200b\u5c31\u662f\u200b\u57fa\u4e8e\u200b\u5fc3\u8df3\u200b\u76d1\u6d4b\u6570\u636e\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u5fc3\u8df3\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u72b6\u51b5\u200b\u7684\u200b\u5206\u7c7b\u200b\u3002\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU) \u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ts_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX \u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u53ef\u4ee5\u200b\u8fdb\u5165\u200b \u200b\u5b98\u65b9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u7684\u200b\u80fd\u529b\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b1\u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b TimesNet_cls 87.5 792K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b UWaveGestureLibrary\u3002

"},{"location":"practical_tutorials/ts_classification.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ts_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u4e3a\u4e86\u200b\u6f14\u793a\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6574\u4e2a\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u200b\u4f7f\u7528\u200b\u516c\u5f00\u200b\u7684\u200b Heartbeat \u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u53ca\u200b\u9a8c\u8bc1\u200b\u3002Heartbeat \u200b\u6570\u636e\u200b\u96c6\u662f\u200b UEA \u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u573a\u666f\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u6d89\u53ca\u200b\u5230\u200b\u5fc3\u8df3\u200b\u76d1\u6d4b\u200b\u533b\u5b66\u200b\u8bca\u65ad\u200b\u8fd9\u4e00\u200b\u5b9e\u9645\u200b\u4efb\u52a1\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u7531\u200b\u591a\u7ec4\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7ec4\u6210\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6570\u636e\u200b\u70b9\u200b\u7531\u200b\u6807\u7b7e\u200b\u53d8\u91cf\u200b\u3001\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u548c\u200b 61 \u200b\u4e2a\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u7ec4\u6210\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u901a\u5e38\u200b\u7528\u4e8e\u200b\u6d4b\u8bd5\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u65f6\u95f4\u200b\u5206\u7c7b\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\u3002

\u200b\u6211\u4eec\u200b\u5df2\u7ecf\u200b\u5c06\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u6807\u51c6\u200b\u6570\u636e\u683c\u5f0f\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
* \u200b\u6570\u636e\u200b\u6ce8\u610f\u4e8b\u9879\u200b * \u200b\u57fa\u4e8e\u200b\u6536\u96c6\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u660e\u786e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u7684\u200b\u5206\u7c7b\u200b\u76ee\u6807\u200b\uff0c\u200b\u5e76\u200b\u5b9a\u4e49\u200b\u76f8\u5e94\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u80a1\u7968\u4ef7\u683c\u200b\u5206\u7c7b\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u53ef\u80fd\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u5b9a\u4e49\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6807\u7b7e\u200b\uff1b\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u5b9a\u4e49\u200b\u4e3a\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u200b\u6807\u7b7e\u200b\u3002\u200b\u6bcf\u200b\u4e00\u4e2a\u200b group\uff0c\u200b\u5c31\u662f\u200b\u4e00\u4e2a\u200b\u5206\u7c7b\u200b\u6837\u672c\u200b\u3002 * \u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\u4e00\u81f4\u200b\uff1a\u200b\u786e\u4fdd\u200b\u6240\u6709\u200b\u6570\u636e\u200b\u5e8f\u5217\u200b\u7684\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\u4e00\u81f4\u200b\uff0c\u200b\u5982\u200b\u6bcf\u200b\u5c0f\u65f6\u200b\u3001\u200b\u6bcf\u65e5\u200b\u6216\u200b\u6bcf\u5468\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u4e0d\u200b\u4e00\u81f4\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u91cd\u200b\u91c7\u6837\u200b\u65b9\u6cd5\u200b\u8c03\u6574\u200b\u5230\u200b\u7edf\u4e00\u200b\u7684\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\u3002 * \u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u4e00\u81f4\u200b\uff1a\u200b\u786e\u4fdd\u200b\u6bcf\u200b\u4e00\u4e2a\u200bgroup\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u5ea6\u200b\u4e00\u81f4\u200b\u3002 * \u200b\u7f3a\u5931\u200b\u503c\u200b\u5904\u7406\u200b\uff1a\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002 * \u200b\u975e\u200b\u91cd\u590d\u6027\u200b\uff1a\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u662f\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u987a\u5e8f\u200b\u6309\u884c\u200b\u6536\u96c6\u200b\u7684\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u4e0d\u80fd\u200b\u91cd\u590d\u200b\u51fa\u73b0\u200b\u3002

"},{"location":"practical_tutorials/ts_classification.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [ ...\n    ],\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [ ...\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\u6570\u636e\u200b\u90e8\u5206\u200b\u5df2\u200b\u7701\u7565\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 82620
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 83025
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b4.1.3\u3002

"},{"location":"practical_tutorials/ts_classification.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ts_classification.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Train.epochs_iters=5 \\\n    -o Train.batch_size=16 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.time_col=time \\\n    -o Train.target_cols=dim_0,dim_1,dim_2 \\\n    -o Train.freq=1 \\\n    -o Train.group_id=group_id \\\n    -o Train.static_cov_cols=label\n
\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b(\u200b\u65f6\u5e8f\u200b\u6a21\u578b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b)\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
  • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\u3001\u200b\u5355\u4f8b\u200b\u6d4b\u8bd5\u200b\uff08predict\uff09\uff1b
  • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\uff1b\u200b\u53ef\u200b\u5728\u200b\u8be5\u200b\u8def\u5f84\u200b\u4e0b\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5217\u8868\u200b\u7684\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u67e5\u770b\u200b\u4e0d\u540c\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
  • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
  • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b
  • batch_size\uff1a\u200b\u8bad\u7ec3\u200b\u5355\u5361\u200b\u6279\u200b\u5927\u5c0f\u200b\u8bbe\u7f6e\u200b\uff1b
  • time_col: \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff1b
  • target_cols:\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\u3002\u200b\u4e00\u822c\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u548c\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b\u7684\u200b\u76ee\u6807\u200b\u8d8a\u200b\u76f8\u5173\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u5fc3\u200b\u8df3\u200b\u76d1\u63a7\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u540d\u200b\u6709\u200b 61 \u200b\u4e2a\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200b\uff1adim_0, dim_1 \u200b\u7b49\u200b\uff1b
  • freq\uff1a\u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\uff1b
  • group_id\uff1a\u200b\u4e00\u4e2a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u8868\u793a\u200b\u7684\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65f6\u5e8f\u200b\u6837\u672c\u200b\uff0c\u200b\u76f8\u540c\u200b\u7f16\u53f7\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u7ec4\u6210\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u6307\u5b9a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b, \u200b\u5982\u200b\uff1agroup_id\uff1b
  • static_cov_cols\uff1a\u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u7684\u200b\u7c7b\u522b\u200b\u7f16\u53f7\u200b\u5217\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u6807\u7b7e\u200b\u76f8\u540c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u7c7b\u522b\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u5982\u200b\uff1alabel\u3002 \u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a

  • \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 1 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\uff1b
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u3002
\u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference*\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ts_classification.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Evaluate.weight_path=./output/best_model/model.pdparams\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/ts_classification.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002 \u200b\u57fa\u4e8e\u200b\u63a7\u5236\u53d8\u91cf\u200b\u7684\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5728\u200b\u521d\u59cb\u200b\u9636\u6bb5\u200b\u57fa\u4e8e\u200b\u56fa\u5b9a\u200b\u7684\u200b\u8f83\u200b\u5c0f\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u591a\u6b21\u200b\u8c03\u6574\u200b\u5b66\u4e60\u200b\u7387\u200b\uff0c\u200b\u4ece\u800c\u200b\u627e\u5230\u200b\u8f83\u4f18\u200b\u5b66\u4e60\u200b\u7387\u200b\uff1b\u200b\u4e4b\u540e\u200b\u518d\u6b21\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u4e0b\u9762\u200b\u6211\u4eec\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u7684\u200b\u8c03\u53c2\u200b\u65b9\u6cd5\u200b:

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 5\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\u3002
  2. \u200b\u57fa\u4e8e\u200b TimesNet_cls \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.00001\uff0c0.0001\uff0c0.001\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u3002\u200b\u56e0\u6b64\u200b\u56fa\u5b9a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\uff0c\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5230\u200b 30\u3002\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u5185\u7f6e\u200b\u7684\u200b earlystop \u200b\u673a\u5236\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u5728\u200b 10 \u200b\u4e2a\u200b patience epoch\uff08\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff09\u200b\u540e\u200b\u6ca1\u6709\u200b\u63d0\u5347\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u3002\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b\u65e9\u505c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u624b\u52a8\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b patience \u200b\u7684\u200b\u503c\u200b\u3002 \u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a
\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u51c6\u786e\u7387\u200b \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5 0.00001 16 1\u200b\u5361\u200b 72.20% \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.0001 16 1\u200b\u5361\u200b 72.20% \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.001 16 1\u200b\u5361\u200b 73.20%

\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u51c6\u786e\u7387\u200b \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.001 16 1\u200b\u5361\u200b 73.20% \u200b\u5b9e\u9a8c\u200b\u56db\u200b 30 0.001 16 1\u200b\u5361\u200b 75.10%"},{"location":"practical_tutorials/ts_classification.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_classification/test.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff1a

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
    \u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

  2. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html","title":"PaddleX 3.0 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u7528\u7535\u91cf\u200b\u957f\u671f\u200b\u9884\u6d4b\u200b\u5e94\u7528\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u7528\u7535\u91cf\u200b\u957f\u671f\u200b\u9884\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u200b\u4efb\u52a1\u200b\u76ee\u6807\u200b\u662f\u200b\u57fa\u4e8e\u200b\u5386\u53f2\u6570\u636e\u200b\u5bf9\u200b\u672a\u6765\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u7535\u529b\u200b\u6d88\u8017\u91cf\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u3002\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU) \u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX \u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u53ef\u4ee5\u200b\u8fdb\u5165\u200b \u200b\u5b98\u65b9\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u80fd\u529b\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b5\u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear 0.382 0.394 76k DLinear\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b Nonstationary 0.600 0.515 60.3M \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b PatchTST 0.385 0.397 2.2M PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b TiDE 0.405 0.412 34.9M TiDE\u200b\u662f\u200b\u9002\u7528\u200b\u4e8e\u200b\u5904\u7406\u200b\u591a\u200b\u53d8\u91cf\u200b\u3001\u200b\u957f\u671f\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u9884\u6d4b\u200b\u95ee\u9898\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200b TimesNet 0.417 0.431 5.2M \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5206\u6790\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6d4b\u8bd5\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u4e3a\u200b96\uff0c\u200b\u9884\u6d4b\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u9664\u200b TiDE \u200b\u5916\u4e3a\u200b96\uff0cTiDE\u200b\u4e3a\u200b720 \u3002

\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ts_forecast.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u4e3a\u4e86\u200b\u6f14\u793a\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6574\u4e2a\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u200b\u4f7f\u7528\u200b\u7535\u529b\u200b Electricity \u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u53ca\u200b\u9a8c\u8bc1\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u91c7\u96c6\u200b\u4e86\u200b 2012 - 2014 \u200b\u5e74\u200b\u7684\u200b\u67d0\u200b\u8282\u70b9\u200b\u8017\u7535\u91cf\u200b\uff0c\u200b\u6bcf\u200b\u95f4\u8ddd\u200b 1 \u200b\u5c0f\u65f6\u200b\u91c7\u96c6\u200b\u4e00\u6b21\u200b\u6570\u636e\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6570\u636e\u200b\u70b9\u200b\u7531\u200b\u5f53\u524d\u200b\u65f6\u95f4\u200b\u70b9\u200b\u548c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u8017\u7535\u91cf\u200b\u7ec4\u6210\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u901a\u5e38\u200b\u7528\u4e8e\u200b\u6d4b\u8bd5\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\u3002

\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b 96 \u200b\u5c0f\u65f6\u200b\u7684\u200b\u8017\u7535\u91cf\u200b\u3002\u200b\u6211\u4eec\u200b\u5df2\u7ecf\u200b\u5c06\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u6807\u51c6\u200b\u6570\u636e\u683c\u5f0f\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/electricity.tar -P ./dataset\ntar -xf ./dataset/electricity.tar -C ./dataset/\n
* \u200b\u6570\u636e\u200b\u6ce8\u610f\u4e8b\u9879\u200b * \u200b\u4e3a\u4e86\u200b\u8bad\u7ec3\u200b\u51fa\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u8d34\u8fd1\u200b\u5b9e\u9645\u200b\u573a\u666f\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\u5c24\u4e3a\u200b\u5173\u952e\u200b\uff0c\u200b\u56e0\u6b64\u200b\u901a\u5e38\u200b\u9700\u8981\u200b\u4e00\u6279\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\u52a0\u5165\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u3002 * \u200b\u6807\u6ce8\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u57fa\u4e8e\u200b\u6536\u96c6\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u5c06\u200b\u6240\u6709\u200b\u6570\u636e\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u7684\u200b\u987a\u5e8f\u6392\u5217\u200b\u5373\u53ef\u200b\u3002\u200b\u8bad\u7ec3\u200b\u65f6\u200b\u5c06\u200b\u6570\u636e\u200b\u81ea\u52a8\u200b\u5206\u4e3a\u200b\u591a\u4e2a\u200b\u65f6\u95f4\u200b\u7247\u6bb5\u200b\uff0c\u200b\u5386\u53f2\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u548c\u200b\u672a\u6765\u200b\u7684\u200b\u5e8f\u5217\u200b\u5206\u522b\u200b\u8868\u793a\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u548c\u200b\u5176\u200b\u5bf9\u5e94\u200b\u7684\u200b\u9884\u6d4b\u200b\u76ee\u6807\u200b\uff0c\u200b\u6784\u6210\u200b\u4e86\u200b\u4e00\u7ec4\u200b\u8bad\u7ec3\u6837\u672c\u200b\u3002 * \u200b\u7f3a\u5931\u200b\u503c\u200b\u5904\u7406\u200b\uff1a\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002 * \u200b\u975e\u200b\u91cd\u590d\u6027\u200b\uff1a\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u662f\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u987a\u5e8f\u200b\u6309\u884c\u200b\u6536\u96c6\u200b\u7684\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u4e0d\u80fd\u200b\u91cd\u590d\u200b\u51fa\u73b0\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/electricity\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22880,\n    \"train_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2012-01-01 00:00:00\",\n        2162.0\n      ],\n      [\n        \"2012-01-01 01:00:00\",\n        2835.0\n      ],\n      [\n        \"2012-01-01 02:00:00\",\n        2764.0\n      ],\n      [\n        \"2012-01-01 03:00:00\",\n        2735.0\n      ],\n      [\n        \"2012-01-01 04:00:00\",\n        2721.0\n      ],\n      [\n        \"2012-01-01 05:00:00\",\n        2742.0\n      ],\n      [\n        \"2012-01-01 06:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 07:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 08:00:00\",\n        2680.0\n      ],\n      [\n        \"2012-01-01 09:00:00\",\n        2581.0\n      ]\n    ],\n    \"val_samples\": 3424,\n    \"val_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2014-08-11 08:00:00\",\n        3528.0\n      ],\n      [\n        \"2014-08-11 09:00:00\",\n        3800.0\n      ],\n      [\n        \"2014-08-11 10:00:00\",\n        3889.0\n      ],\n      [\n        \"2014-08-11 11:00:00\",\n        4340.0\n      ],\n      [\n        \"2014-08-11 12:00:00\",\n        4321.0\n      ],\n      [\n        \"2014-08-11 13:00:00\",\n        4293.0\n      ],\n      [\n        \"2014-08-11 14:00:00\",\n        4393.0\n      ],\n      [\n        \"2014-08-11 15:00:00\",\n        4384.0\n      ],\n      [\n        \"2014-08-11 16:00:00\",\n        4495.0\n      ],\n      [\n        \"2014-08-11 17:00:00\",\n        4374.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/electricity\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 22880\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 3424\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b4.1.3\u3002

"},{"location":"practical_tutorials/ts_forecast.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ts_forecast.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/electricity \\\n    -o Train.epochs_iters=5 \\\n    -o Train.batch_size=16 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.time_col=date \\\n    -o Train.target_cols=OT \\\n    -o Train.freq=1h \\\n    -o Train.input_len=96 \\\n    -o Train.predict_len=96\n
\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b(\u200b\u65f6\u5e8f\u200b\u6a21\u578b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b)\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
  • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\u3001\u200b\u5355\u4f8b\u200b\u6d4b\u8bd5\u200b\uff08predict\uff09\uff1b
  • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff1b\u200b\u53ef\u200b\u5728\u200b\u8be5\u200b\u8def\u5f84\u200b\u4e0b\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5217\u8868\u200b\u7684\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u67e5\u770b\u200b\u4e0d\u540c\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
  • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
  • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b
  • batch_size\uff1a\u200b\u8bad\u7ec3\u200b\u5355\u5361\u200b\u6279\u200b\u5927\u5c0f\u200b\u8bbe\u7f6e\u200b\uff1b
  • time_col: \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff1b
  • target_cols:\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\uff1b
  • freq\uff1a\u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\uff1b
  • input_len: \u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u5386\u53f2\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u53ca\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u80fd\u591f\u200b\u53c2\u8003\u200b\u7684\u200b\u5386\u53f2\u200b\u4fe1\u606f\u200b\u8d8a\u200b\u591a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u9ad8\u200b\uff1b
  • predict_len:\u200b\u5e0c\u671b\u200b\u6a21\u578b\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u5ea6\u200b\uff1b\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b\u7684\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u8d8a\u957f\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u4f4e\u200b\uff1b
  • patience\uff1aearly stop\u200b\u673a\u5236\u200b\u53c2\u6570\u200b\uff0c\u200b\u6307\u5728\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u5bb9\u5fcd\u200b\u6a21\u578b\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u7684\u200b\u6027\u80fd\u200b\u591a\u5c11\u200b\u6b21\u8fde\u7eed\u200b\u6ca1\u6709\u200b\u6539\u8fdb\u200b\uff1b\u200b\u8010\u5fc3\u200b\u503c\u8d8a\u200b\u5927\u200b\uff0c\u200b\u4e00\u822c\u200b\u8bad\u7ec3\u200b\u65f6\u95f4\u200b\u8d8a\u957f\u200b\u3002 \u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

  • \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 1 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\uff1b

  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u3002
\u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7b49\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/electricity \\\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/ts_forecast.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u57fa\u4e8e\u200b\u63a7\u5236\u53d8\u91cf\u200b\u7684\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5728\u200b\u521d\u59cb\u200b\u9636\u6bb5\u200b\u57fa\u4e8e\u200b\u56fa\u5b9a\u200b\u7684\u200b\u8f83\u200b\u5c0f\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u591a\u6b21\u200b\u8c03\u6574\u200b\u5b66\u4e60\u200b\u7387\u200b\uff0c\u200b\u4ece\u800c\u200b\u627e\u5230\u200b\u8f83\u4f18\u200b\u5b66\u4e60\u200b\u7387\u200b\uff1b\u200b\u4e4b\u540e\u200b\u518d\u6b21\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u51b3\u5b9a\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u505a\u51fa\u200b\u9884\u6d4b\u200b\u65f6\u200b\u5c06\u200b\u8003\u8651\u200b\u5386\u53f2\u6570\u636e\u200b\u7684\u200b\u591a\u5c11\u200b\uff0c\u200b\u4e5f\u200b\u5c24\u4e3a\u200b\u7684\u200b\u91cd\u8981\u200b\u3002\u200b\u4e0b\u9762\u200b\u6211\u4eec\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u8c03\u53c2\u200b\u65b9\u6cd5\u200b:

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 5\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\uff0c\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\u3002
  2. \u200b\u57fa\u4e8e\u200b DLinear \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.0001\uff0c0.001\uff0c0.01\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u3002\u200b\u56e0\u6b64\u200b\u56fa\u5b9a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\uff0c\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5230\u200b 30\u3002\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u5185\u7f6e\u200b\u7684\u200b earlystop \u200b\u673a\u5236\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u5728\u200b 10 \u200b\u4e2a\u200b patience epoch\uff08\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff09\u200b\u540e\u200b\u6ca1\u6709\u200b\u63d0\u5347\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u3002\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b\u65e9\u505c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u624b\u52a8\u200b\u9ad8\u7ea7\u200b\u914d\u7f6e\u200b\u4e2d\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b patience \u200b\u7684\u200b\u503c\u200b\u3002
  4. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u540e\u200b\u5b9e\u9a8c\u200b\u56db\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\uff0c\u200b\u63a5\u4e0b\u6765\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5230\u200b 144\uff0c\u200b\u4e5f\u200b\u5c31\u662f\u200b\u7528\u200b\u5386\u53f2\u200b 144 \u200b\u5c0f\u65f6\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b 96 \u200b\u5c0f\u65f6\u200b\uff0c\u200b\u5f97\u5230\u200b\u5b9e\u9a8c\u200b\u4e94\u200b\u7684\u200b\u6307\u6807\u200b\u3002\u200b\u7cbe\u5ea6\u200b\u8fbe\u5230\u200b 0.188\u3002 \u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a
\u200b\u5b9e\u9a8c\u200bid \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mse \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5 0.0001 16 96 96 1\u200b\u5361\u200b 0.314 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.001 16 96 96 1\u200b\u5361\u200b 0.302 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.01 16 96 96 1\u200b\u5361\u200b 0.320

\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bid \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mse \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.001 16 96 96 1\u200b\u5361\u200b 0.302 \u200b\u5b9e\u9a8c\u200b\u56db\u200b 30 0.001 16 96 96 1\u200b\u5361\u200b 0.301

\u200b\u589e\u5927\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bid \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mse \u200b\u5b9e\u9a8c\u200b\u56db\u200b 30 0.001 16 96 96 1\u200b\u5361\u200b 0.301 \u200b\u5b9e\u9a8c\u200b\u4e94\u200b 30 0.001 16 144 96 1\u200b\u5361\u200b 0.188"},{"location":"practical_tutorials/ts_forecast.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b\u672c\u200b\u6848\u4f8b\u200b\u4e2d\u200b\u7684\u200b\u7535\u529b\u200b\u6d4b\u8bd5\u6570\u636e\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/test.csv\n
\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200btest.csv\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u5728\u200bresult.csv\u200b\u4e2d\u200b\u3002

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff1a

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_forecast\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
    \u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  2. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002
"},{"location":"support_list/model_list_dcu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6d77\u5149\u200b DCU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_dcu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_dcu.html#_2","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Deeplabv3_Plus-R50 80.36 94.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3_Plus-R101 81.10 162.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_mlu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u5bd2\u6b66\u7eaa\u200b MLU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MobileNetV3_large_x0_5 69.2 9.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 7.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 14.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 19.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 26.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 6.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 6.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 8.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 13.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 86.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 6.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 5.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 8.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 16.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 23.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 32.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_mlu.html#_2","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet-L 42.6 20.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 4.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 185.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 83.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 28.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 349.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_mlu.html#_3","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LiteSeg-T 73.10 28.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_mlu.html#_4","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 4.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det 82.69 100.1M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_5","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 10.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 71.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_6","title":"\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 7.4M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_7","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/model_list_npu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6607\u200b\u817e\u200b NPU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_224 85.36 306.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CLIP_vit_large_patch14_224 88.1 1.04 G \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_224 83.84 313.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_384 84.90 313.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_224 84.26 700.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_384 85.27 700.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_small 83.13 178.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_tiny 82.03 101.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_5 63.5 4.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_25 51.4 1.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_75 68.8 9.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x1_0 71.0 15.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_5 65.0 7.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_25 53.2 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_0 72.2 12.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_5 74.1 25.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x2_0 75.2 41.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_5 69.2 9.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 7.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 14.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 19.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 26.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 6.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 6.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 8.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 13.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_large 83.4 125.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_medium 79.9 37.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_small 74.6 14.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_base 85.0 249.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 86.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_tiny 79.83 52.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0 77.77 21.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B1 79.18 22.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B2 81.74 39.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B3 82.98 57.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B4 83.57 70.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B5 84.75 140.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6 86.30 268.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 6.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 5.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 8.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 16.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 23.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 32.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_base 77.05 23.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_large 78.51 37.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_small 73.97 14.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18_vd 72.3 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34_vd 76.0 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_vd 79.1 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101_vd 80.2 158.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152_vd 80.6 214.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet200_vd 80.9 266.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window7_224 83.37 310.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window12_384 84.17 311.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window7_224 86.19 694.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window12_384 87.06 696.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_small_patch4_window7_224 83.21 175.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_tiny_patch4_window7_224 81.10 100.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_npu.html#_2","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_448_ML 89.15 325.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0_ML 80.98 39.6 M PP-HGNetV2-B4_ML 87.96 88.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6_ML 91.25 286.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"support_list/model_list_npu.html#_3","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Cascade-FasterRCNN-ResNet50-FPN 41.1 245.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 246.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-DLA-34 37.6 75.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-ResNet50 38.9 319.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DETR-R50 42.3 159.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet34-FPN 37.8 137.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50 36.7 120.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-FPN 38.4 148.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-FPN 39.5 148.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 148.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101 39.0 188.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101-FPN 41.4 216.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNeXt101-vd-FPN 43.4 360.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-Swin-Tiny-FPN 42.6 159.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FCOS-ResNet50 39.6 124.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L 42.6 20.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-M 37.5 16.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 4.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-XS 26.2 5.7M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 185.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 83.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 28.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 349.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H 56.3 435.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-L 53.0 113.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R18 46.5 70.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R50 53.1 149.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-X 54.8 232.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-DarkNet53 39.1 219.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-MobileNetV3 31.4 83.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-ResNet50_vd_DCN 40.6 163.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_4","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE_plus_SOD-S 25.1 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-L 31.9 325.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-largesize-L 42.7 340.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_5","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_human 48.0 196.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_human 42.5 28.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_6","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Deeplabv3_Plus-R50 80.36 94.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3_Plus-R101 81.10 162.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R50 79.90 138.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R101 80.85 205.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b OCRNet_HRNet-W48 82.15 249.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LiteSeg-T 73.10 28.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_npu.html#_7","title":"\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Mask AP \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask-RT-DETR-H 50.6 449.9 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-L 45.7 113.6 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-M 42.7 66.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-S 41.0 51.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-X 47.5 237.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-FPN 36.3 254.8 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 254.7 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-FPN 35.6 157.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-vd-FPN 36.4 157.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50 32.8 127.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-FPN 36.6 225.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-vd-FPN 38.1 225.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNeXt101-vd-FPN 39.5 370.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_seg-S 32.5 31.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_8","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_rec_CLIP_vit_base 88.69 306.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec_CLIP_vit_large 91.03 1.05 G \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"support_list/model_list_npu.html#_9","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_det 41.5 27.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_10","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_vehicle 63.9 196.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_vehicle 61.3 28.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_11","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b STFPM 96.2 21.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_12","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 4.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det 82.69 100.1M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_13","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 10.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 71.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_SVTRv2_rec 68.81 73.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_RepSVTR_rec 65.07 22.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_14","title":"\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b SLANet 76.31 6.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPubtabNet\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_15","title":"\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 7.4M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L_layout_3cls 89.3 22.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_3cls 95.9 470.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_17cls 92.6 470.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_16","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary 0.600 0.515 55.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST 0.385 0.397 2.0M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TiDE 0.405 0.412 31.7M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet 0.417 0.431 4.9M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/model_list_npu.html#_17","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AutoEncoder_ad 99.36 84.36 91.25 52K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DLinear_ad 98.98 93.96 96.41 112K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary_ad 98.55 88.95 93.51 1.8M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST_ad 98.78 90.70 94.57 320K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet_ad 98.37 94.80 96.56 1.3M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPSM\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_18","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b TimesNet_cls 87.5 792K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bUWaveGestureLibrary\uff1a\u200b\u8bad\u7ec3\u200b\u3001\u200b\u8bc4\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/model_list_xpu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6606\u4ed1\u200b XPU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MobileNetV3_large_x0_5 69.2 9.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 7.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 14.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 19.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 26.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 6.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 6.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 8.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 13.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 86.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 6.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 5.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 8.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 16.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 23.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 32.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_xpu.html#_2","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet-L 42.6 20.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 4.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 185.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 83.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 28.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 349.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_xpu.html#_3","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LiteSeg-T 73.10 28.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_xpu.html#_4","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 4.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det \uff09 82.69 100.1M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_5","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 10.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 71.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_6","title":"\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 7.4M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_7","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/models_list.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/models_list.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_224 85.36 13.1957 285.493 306.5 M CLIP_vit_base_patch16_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CLIP_vit_large_patch14_224 88.1 51.1284 1131.28 1.04 G CLIP_vit_large_patch14_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_224 83.84 12.8473 1513.87 313.9 M ConvNeXt_base_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_384 84.90 31.7607 3967.05 313.9 M ConvNeXt_base_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_224 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_384 85.27 66.4058 6598.92 700.7 M ConvNeXt_large_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_small 83.13 9.74075 1127.6 178.0 M ConvNeXt_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_tiny 82.03 5.48923 672.559 101.4 M ConvNeXt_tiny.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-L 83.5 23.4415 - 357.1 M FasterNet-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-M 83.0 21.8936 - 204.6 M FasterNet-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-S 81.3 13.0409 - 119.3 M FasterNet-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-T0 71.9 12.2432 - 15.1 M FasterNet-T0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-T1 75.9 11.3562 - 29.2 M FasterNet-T1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-T2 79.1 10.703 - 57.4 M FasterNet-T2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_5 63.5 1.86754 7.48297 4.8 M MobileNetV1_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_25 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_75 68.8 2.57903 10.6343 9.3 M MobileNetV1_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x1_0 71.0 2.78781 13.98 15.2 M MobileNetV1_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_5 65.0 4.94234 11.1629 7.1 M MobileNetV2_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_25 53.2 4.50856 9.40991 5.5 M MobileNetV2_x0_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_0 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_5 74.1 6.28385 22.5129 25.0 M MobileNetV2_x1_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x2_0 75.2 6.12888 30.8612 41.2 M MobileNetV2_x2_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_5 69.2 6.31302 14.5588 9.6 M MobileNetV3_large_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_35.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 8.73358 22.1296 26.5 M MobileNetV3_large_x1_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_35.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 6.9589 14.3995 13.0 M MobileNetV3_small_x1_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_large 83.4 12.5485 51.6453 125.2 M MobileNetV4_conv_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_medium 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_medium.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_small 74.6 5.24172 11.0893 14.7 M MobileNetV4_conv_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_hybrid_large 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_hybrid_medium 80.5 19.7543 62.2624 42.9 M MobileNetV4_hybrid_medium.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_base 85.0 14.2969 327.114 249.4 M PP-HGNet_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 5.50661 119.041 86.5 M PP-HGNet_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_tiny 79.83 5.22006 69.396 52.4 M PP-HGNet_tiny.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B1 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B2 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B3 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B4 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B4.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B5 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6 86.30 21.226 255.279 268.4 M PP-HGNetV2-B6.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 3.67722 6.66857 6.7 M PP-LCNet_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_35.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 3.91032 8.06953 8.4 M PP-LCNet_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 3.97666 12.3457 16.0 M PP-LCNet_x1_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 4.06028 21.5063 32.1 M PP-LCNet_x2_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_base 77.05 5.23428 19.6005 23.7 M PP-LCNetV2_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_large 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_small 73.97 3.89762 13.0273 14.6 M PP-LCNetV2_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18_vd 72.3 3.53048 31.3014 41.5 M ResNet18_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 2.4868 27.4601 41.5 M ResNet18.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34_vd 76.0 5.60675 56.0653 77.3 M ResNet34_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 4.16902 51.925 77.3 M ResNet34.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_vd 79.1 10.1885 68.446 90.8 M ResNet50_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 9.62383 64.8135 90.8 M ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101_vd 80.2 20.0563 124.85 158.4 M ResNet101_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 19.2297 121.006 158.7 M ResNet101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152_vd 80.6 29.6439 181.678 214.3 M ResNet152_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 30.0461 177.707 214.2 M ResNet152.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet200_vd 80.9 39.1628 235.185 266.0 M ResNet200_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S1 73.6 9.895 23.0465 11.2 M StarNet-S1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S2 74.8 7.91279 21.9571 14.3 M StarNet-S2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S3 77.0 10.7531 30.7656 22.2 M StarNet-S3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S4 79.0 15.2868 43.2497 28.9 M StarNet-S4.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window7_224 83.37 16.9848 383.83 310.5 M SwinTransformer_base_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window12_384 84.17 37.2855 1178.63 311.4 M SwinTransformer_base_patch4_window12_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window7_224 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window12_384 87.06 74.1768 2105.22 696.1 M SwinTransformer_large_patch4_window12_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_small_patch4_window7_224 83.21 16.3982 285.56 175.6 M SwinTransformer_small_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_tiny_patch4_window7_224 81.10 8.54846 156.306 100.1 M SwinTransformer_tiny_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/models_list.html#_2","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_448_ML 89.15 - - 325.6 M CLIP_vit_base_patch16_448_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0_ML 80.98 - - 39.6 M PP-HGNetV2-B0_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B4_ML 87.96 - - 88.5 M PP-HGNetV2-B4_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6_ML 91.25 - - 286.5 M PP-HGNetV2-B6_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0_ML 77.96 - - 29.4 M PP-LCNet_x1_0_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_ML 83.50 - - 108.9 M ResNet50_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"support_list/models_list.html#_3","title":"\u884c\u4eba\u200b\u5c5e\u6027\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LCNet_x1_0_pedestrian_attribute 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200bmA\u3002

"},{"location":"support_list/models_list.html#_4","title":"\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LCNet_x1_0_vehicle_attribute 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VeRi \u200b\u6570\u636e\u200b\u96c6\u200b mA\u3002

"},{"location":"support_list/models_list.html#_5","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G PP-ShiTuV2_rec_CLIP_vit_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"support_list/models_list.html#_6","title":"\u6587\u6863\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LCNet_x1_0_doc_ori 99.26 3.84845 9.23735 7.1 M PP-LCNet_x1_0_doc_ori.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b Top-1 Acc \u3002

"},{"location":"support_list/models_list.html#_7","title":"\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8f93\u51fa\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b Acc (%)AgeDB-30/CFP-FP/LFW GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MobileFaceNet 128 96.28/96.71/99.58 4.1 MobileFaceNet.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_face 512 98.12/98.56/99.77 87.2 ResNet50_face.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5206\u522b\u200b\u5728\u200bAgeDB-30\u3001CFP-FP\u200b\u548c\u200bLFW\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u6d4b\u5f97\u200b\u7684\u200bAccuracy\u3002

"},{"location":"support_list/models_list.html#_8","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_det 41.5 33.7426 537.003 27.6 M PP-ShiTuV2_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_9","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Cascade-FasterRCNN-ResNet50-FPN 41.1 - - 245.4 M Cascade-FasterRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 - - 246.2 M Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-DLA-34 37.6 - - 75.4 M CenterNet-DLA-34.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-ResNet50 38.9 - - 319.7 M CenterNet-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DETR-R50 42.3 59.2132 5334.52 159.3 M DETR-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet34-FPN 37.8 - - 137.5 M FasterRCNN-ResNet34-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-FPN 38.4 - - 148.1 M FasterRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-FPN 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50 36.7 - - 120.2 M FasterRCNN-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101-FPN 41.4 - - 216.3 M FasterRCNN-ResNet101-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101 39.0 - - 188.1 M FasterRCNN-ResNet101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNeXt101-vd-FPN 43.4 - - 360.6 M FasterRCNN-ResNeXt101-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-Swin-Tiny-FPN 42.6 - - 159.8 M FasterRCNN-Swin-Tiny-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FCOS-ResNet50 39.6 103.367 3424.91 124.2 M FCOS-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L 42.6 16.6715 169.904 20.9 M PicoDet-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-M 37.5 16.2311 71.7257 16.8 M PicoDet-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 14.097 37.6563 4.4 M PicoDet-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-XS 26.2 13.8102 48.3139 5.7M PicoDet-XS.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 19.843 449.261 83.2 M PP-YOLOE_plus-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 57.8995 1439.93 349.4 M PP-YOLOE_plus-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H 56.3 114.814 3933.39 435.8 M RT-DETR-H.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-L 53.0 34.5252 1454.27 113.7 M RT-DETR-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R18 46.5 19.89 784.824 70.7 M RT-DETR-R18.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R50 53.1 41.9327 1625.95 149.1 M RT-DETR-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-X 54.8 61.8042 2246.64 232.9 M RT-DETR-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-DarkNet53 39.1 40.1055 883.041 219.7 M YOLOv3-DarkNet53.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-MobileNetV3 31.4 18.6692 267.214 83.8 M YOLOv3-MobileNetV3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-ResNet50_vd_DCN 40.6 31.6276 856.047 163.0 M YOLOv3-ResNet50_vd_DCN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-L 50.1 185.691 1250.58 192.5 M YOLOX-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-M 46.9 123.324 688.071 90.0 M YOLOX-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-N 26.1 79.1665 155.59 3.4M YOLOX-N.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-S 40.4 184.828 474.446 32.0 M YOLOX-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-T 32.9 102.748 212.52 18.1 M YOLOX-T.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-X 51.8 227.361 2067.84 351.5 M YOLOX-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_10","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE_plus_SOD-S 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-L 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-largesize-L 42.7 458.521 11172.7 340.5 M PP-YOLOE_plus_SOD-largesize-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_11","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_human 48.0 32.7754 777.691 196.1 M PP-YOLOE-L_human.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_human 42.5 15.0118 179.317 28.8 M PP-YOLOE-S_human.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_12","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_vehicle 63.9 32.5619 775.633 196.1 M PP-YOLOE-L_vehicle.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_vehicle 61.3 15.3787 178.441 28.8 M PP-YOLOE-S_vehicle.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_13","title":"\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b AP (%)Easy/Medium/Hard GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b BlazeFace 77.7/73.4/49.5 0.447 M BlazeFace.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b BlazeFace-FPN-SSH 83.2/80.5/60.5 0.606 M BlazeFace-FPN-SSH.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet_LCNet_x2_5_face 93.7/90.7/68.1 28.9 M PicoDet_LCNet_x2_5_face.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S_face 93.9/91.8/79.8 26.5 M PP-YOLOE_plus-S_face \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5728\u200bWIDER-FACE\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\uff0c\u200b\u4ee5\u200b640 *640\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u5c3a\u5bf8\u200b\u8bc4\u4f30\u200b\u5f97\u5230\u200b\u7684\u200b\u3002

"},{"location":"support_list/models_list.html#_14","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b STFPM 96.2 - - 21.5 M STFPM.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"support_list/models_list.html#_15","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Deeplabv3_Plus-R50 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3_Plus-R101 81.10 100.026 2460.71 162.5 M Deeplabv3_Plus-R101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R50 79.90 82.2631 1735.83 138.3 M Deeplabv3-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R101 80.85 121.492 2685.51 205.9 M Deeplabv3-R101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b OCRNet_HRNet-W18 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W18.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b OCRNet_HRNet-W48 82.15 78.9976 2226.95 249.8 M OCRNet_HRNet-W48.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LiteSeg-T 73.10 7.6827 138.683 28.5 M PP-LiteSeg-T.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LiteSeg-B 75.25 10.9935 194.727 47.0 M PP-LiteSeg-B.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B0 (slice) 76.73 11.1946 268.929 13.2 M SegFormer-B0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B1 (slice) 78.35 17.9998 403.393 48.5 M SegFormer-B1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B2 (slice) 81.60 48.0371 1248.52 96.9 M SegFormer-B2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B3 (slice) 82.47 64.341 1666.35 167.3 M SegFormer-B3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B4 (slice) 82.38 82.4336 1995.42 226.7 M SegFormer-B4.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B5 (slice) 82.58 97.3717 2420.19 229.7 M SegFormer-B5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b Cityscapes \u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b SeaFormer_base(slice) 40.92 24.4073 397.574 30.8 M SeaFormer_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SeaFormer_large (slice) 43.66 27.8123 550.464 49.8 M SeaFormer_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SeaFormer_small (slice) 38.73 19.2295 358.343 14.3 M SeaFormer_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SeaFormer_tiny (slice) 34.58 13.9496 330.132 6.1M SeaFormer_tiny.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ADE20k \u200b\u6570\u636e\u200b\u96c6\u200b, slice \u200b\u8868\u793a\u200b\u5bf9\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5207\u56fe\u200b\u64cd\u4f5c\u200b\u3002

"},{"location":"support_list/models_list.html#_16","title":"\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask-RT-DETR-H 50.6 132.693 4896.17 449.9 M Mask-RT-DETR-H.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-L 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-M 42.7 36.8329 - 66.6 M Mask-RT-DETR-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-S 41.0 33.5007 - 51.8 M Mask-RT-DETR-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-X 47.5 75.755 3358.04 237.5 M Mask-RT-DETR-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-FPN 36.3 - - 254.8 M Cascade-MaskRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 - - 254.7 M Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-FPN 35.6 - - 157.5 M MaskRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-vd-FPN 36.4 - - 157.5 M MaskRCNN-ResNet50-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50 32.8 - - 127.8 M MaskRCNN-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-FPN 36.6 - - 225.4 M MaskRCNN-ResNet101-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-vd-FPN 38.1 - - 225.1 M MaskRCNN-ResNet101-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNeXt101-vd-FPN 39.5 - - 370.0 M MaskRCNN-ResNeXt101-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_seg-S 32.5 - - 31.5 M PP-YOLOE_seg-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

|SOLOv2| 35.5|-|-|179.1 M|SOLOv2.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_17","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 10.6923 120.177 4.2 M PP-OCRv4_mobile_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det 82.69 83.3501 2434.01 100.1M PP-OCRv4_server_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/models_list.html#_18","title":"\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u5370\u7ae0\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002

"},{"location":"support_list/models_list.html#_19","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 7.95018 46.7868 10.6 M PP-OCRv4_mobile_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 7.19439 140.179 71.2 M PP-OCRv4_server_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_SVTRv2_rec 68.81 8.36801 165.706 73.9 M ch_SVTRv2_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_RepSVTR_rec 65.07 10.5047 51.5647 22.1 M ch_RepSVTR_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002

"},{"location":"support_list/models_list.html#_20","title":"\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b BLEU score normed edit distance ExpRate \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b LaTeX_OCR_rec 0.8821 0.0823 40.01 - - 89.7 M LaTeX_OCR_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_21","title":"\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b SLANet 59.52 522.536 1845.37 6.9 M SLANet.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SLANet_plus 63.69 522.536 1845.37 6.9 M SLANet_plus.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PaddleX\u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_22","title":"\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b MS-SSIM \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b UVDoc 54.40 - - 30.3 M UVDoc.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PaddleX\u200b\u81ea\u5efa\u200b\u7684\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_23","title":"\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP@(0.50:0.95)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 13.036 91.2634 7.4 M PicoDet_layout_1x.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S_layout_3cls 87.1 13.521 45.7633 4.8 M PicoDet-S_layout_3cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S_layout_17cls 70.3 13.5632 46.2059 4.8 M PicoDet-S_layout_17cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L_layout_3cls 89.3 15.7425 159.771 22.6 M PicoDet-L_layout_3cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L_layout_17cls 79.9 17.1901 160.262 22.6 M PicoDet-L_layout_17cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_3cls 95.9 114.644 3832.62 470.1 M RT-DETR-H_layout_3cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_17cls 92.6 115.126 3827.25 470.2 M RT-DETR-H_layout_17cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/models_list.html#_24","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72 K DLinear.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40 K NLinear.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary 0.600 0.515 55.5 M Nonstationary.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST 0.385 0.397 2.0 M PatchTST.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40 K RLinear.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TiDE 0.405 0.412 31.7 M TiDE.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet 0.417 0.431 4.9 M TimesNet.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b ETTH1 \u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/models_list.html#_25","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AutoEncoder_ad 99.36 84.36 91.25 52 K AutoEncoder_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DLinear_ad 98.98 93.96 96.41 112 K DLinear_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary_ad 98.55 88.95 93.51 1.8 M Nonstationary_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST_ad 98.78 90.70 94.57 320 K PatchTST_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet_ad 98.37 94.80 96.56 1.3 M TimesNet_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PSM \u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_26","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b TimesNet_cls 87.5 792 K TimesNet_cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b UWaveGestureLibrary\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

>\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"support_list/pipelines_list.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)","text":""},{"location":"support_list/pipelines_list.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5b83\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u533a\u5206\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u4e0d\u540c\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u7684\u200b\u7cbe\u786e\u200b\u5206\u5272\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5728\u200b\u540c\u4e00\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5206\u522b\u200b\u6807\u8bb0\u200b\u51fa\u200b\u6bcf\u200b\u4e00\u8f86\u8f66\u200b\u3001\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u4eba\u200b\u6216\u200b\u6bcf\u200b\u4e00\u53ea\u200b\u52a8\u7269\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5b83\u4eec\u200b\u5728\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u4e0a\u200b\u88ab\u200b\u72ec\u7acb\u200b\u5904\u7406\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u5305\u542b\u200b\u591a\u8f86\u200b\u8f66\u200b\u548c\u200b\u884c\u4eba\u200b\u7684\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u80fd\u591f\u200b\u5c06\u200b\u6bcf\u8f86\u8f66\u200b\u548c\u200b\u6bcf\u4e2a\u200b\u4eba\u200b\u7684\u200b\u8f6e\u5ed3\u200b\u6e05\u6670\u200b\u5730\u200b\u5206\u5f00\u200b\uff0c\u200b\u5f62\u6210\u200b\u591a\u4e2a\u200b\u72ec\u7acb\u200b\u7684\u200b\u533a\u57df\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u548c\u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bMask R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6765\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u7684\u200b\u50cf\u7d20\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u533a\u5206\u200b\uff0c\u200b\u4e3a\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u7684\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u652f\u6301\u200b\u3002
  • \u200b\u5546\u573a\u200b\u4e2d\u200b\u4eba\u7fa4\u200b\u7684\u200b\u8ba1\u6570\u200b
  • \u200b\u519c\u4e1a\u200b\u667a\u80fd\u5316\u200b\u4e2d\u200b\u519c\u4f5c\u7269\u200b\u6216\u200b\u679c\u5b9e\u200b\u6570\u91cf\u200b\u7684\u200b\u7edf\u8ba1\u200b
  • \u200b\u56fe\u50cf\u7f16\u8f91\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u7269\u4f53\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u5206\u5272\u200b
\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3-doc\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u6587\u6863\u200b\u548c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u8bc6\u522b\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002\u200b\u5f00\u6e90\u200b\u7248\u200b\u652f\u6301\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u548c\u200b\u672c\u5730\u200b\u90e8\u7f72\u200b\uff0c\u200b\u652f\u6301\u200b\u5404\u4e2a\u200b\u6a21\u5757\u200b\u7684\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u3002
  • \u200b\u77e5\u8bc6\u200b\u56fe\u8c31\u200b\u7684\u200b\u6784\u5efa\u200b
  • \u200b\u5728\u7ebf\u200b\u65b0\u95fb\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u4e8b\u4ef6\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b66\u672f\u200b\u6587\u732e\u200b\u4e2d\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u548c\u200b\u5206\u6790\u200b\uff08\u200b\u7279\u522b\u200b\u662f\u200b\u9700\u8981\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u3001\u200b\u626d\u66f2\u200b\u56fe\u7247\u200b\u3001\u200b\u66f4\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u7684\u200b\u573a\u666f\u200b\uff09
\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u636e\u5f55\u5165\u200b\u3001\u200b\u4fe1\u606f\u68c0\u7d22\u200b\u548c\u200b\u6587\u6863\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002
  • \u200b\u94f6\u884c\u200b\u8d26\u5355\u200b\u7684\u200b\u5904\u7406\u200b
  • \u200b\u533b\u7597\u200b\u62a5\u544a\u200b\u4e2d\u200b\u5404\u9879\u200b\u6307\u6807\u200b\u7684\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b
  • \u200b\u5408\u540c\u200b\u4e2d\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u7684\u200b\u63d0\u53d6\u200b
\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u8bc6\u522b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u6a21\u5f0f\u200b\u6216\u200b\u884c\u4e3a\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7f51\u7edc\u5b89\u5168\u200b\u3001\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u548c\u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6b63\u5e38\u200b\u8d8b\u52bf\u200b\u548c\u200b\u89c4\u5f8b\u200b\uff0c\u200b\u6765\u200b\u53d1\u73b0\u200b\u4e0e\u200b\u9884\u671f\u200b\u884c\u4e3a\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u7a81\u7136\u200b\u589e\u52a0\u200b\u7684\u200b\u7f51\u7edc\u6d41\u91cf\u200b\u6216\u200b\u5f02\u5e38\u200b\u7684\u200b\u4ea4\u6613\u200b\u6d3b\u52a8\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff08\u200b\u5982\u200b\u5b64\u7acb\u200b\u68ee\u6797\u200b\u3001LSTM\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u63d0\u4f9b\u200b\u5b9e\u65f6\u200b\u8b66\u62a5\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u53ca\u65f6\u200b\u5e94\u5bf9\u200b\u6f5c\u5728\u200b\u98ce\u9669\u200b\u548c\u200b\u95ee\u9898\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u4fdd\u969c\u7cfb\u7edf\u200b\u7a33\u5b9a\u6027\u200b\u548c\u200b\u5b89\u5168\u6027\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002
  • \u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b
  • \u200b\u7f51\u7edc\u200b\u5165\u4fb5\u200b\u68c0\u6d4b\u200b
  • \u200b\u8bbe\u5907\u200b\u6545\u969c\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u751f\u4ea7\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u7535\u529b\u7cfb\u7edf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u5f52\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u884c\u4e3a\u200b\u8bc6\u522b\u200b\u3001\u200b\u8bed\u97f3\u200b\u8bc6\u522b\u200b\u548c\u200b\u91d1\u878d\u200b\u8d8b\u52bf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5f0f\u200b\u6216\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5c06\u200b\u4e00\u6bb5\u200b\u8bed\u97f3\u200b\u4fe1\u53f7\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u95ee\u5019\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u8bf7\u6c42\u200b\u201d\uff0c\u200b\u6216\u200b\u5c06\u200b\u80a1\u7968\u4ef7\u683c\u200b\u8d70\u52bf\u200b\u5212\u5206\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u6355\u6349\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\u548c\u200b\u53d8\u5316\u89c4\u5f8b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u6570\u636e\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u76d1\u63a7\u200b\u3001\u200b\u8bed\u97f3\u200b\u52a9\u624b\u200b\u548c\u200b\u5e02\u573a\u9884\u6d4b\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u8d77\u200b\u7740\u200b\u5173\u952e\u4f5c\u7528\u200b\u3002
  • \u200b\u5fc3\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u884c\u4e3a\u200b\u5206\u7c7b\u200b
  • \u200b\u8111\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u60c5\u7eea\u200b\u5206\u7c7b\u200b
  • \u200b\u4ea4\u901a\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
  • \u200b\u7f51\u7edc\u6d41\u91cf\u200b\u5206\u7c7b\u200b
  • \u200b\u8bbe\u5907\u200b\u5de5\u4f5c\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u6682\u65e0\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u4e00\u5f20\u200b\u56fe\u50cf\u200b\u540c\u65f6\u200b\u5206\u914d\u200b\u5230\u200b\u591a\u4e2a\u200b\u76f8\u5173\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u3001\u200b\u5185\u5bb9\u200b\u63a8\u8350\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b58\u5728\u200b\u7684\u200b\u591a\u4e2a\u200b\u7269\u4f53\u200b\u6216\u200b\u7279\u5f81\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u4e2d\u200b\u540c\u65f6\u200b\u5305\u542b\u200b\u201c\u200b\u72d7\u200b\u201d\u200b\u548c\u200b\u201c\u200b\u6237\u5916\u200b\u201d\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u6807\u7b7e\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u66f4\u52a0\u200b\u5168\u9762\u200b\u7684\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u641c\u7d22\u5f15\u64ce\u200b\u548c\u200b\u81ea\u52a8\u200b\u5185\u5bb9\u200b\u751f\u6210\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u200b\u5177\u6709\u200b\u91cd\u8981\u200b\u610f\u4e49\u200b\u3002
  • \u200b\u533b\u5b66\u5f71\u50cf\u200b\u8bca\u65ad\u200b
  • \u200b\u590d\u6742\u200b\u573a\u666f\u200b\u8bc6\u522b\u200b
  • \u200b\u591a\u200b\u76ee\u6807\u200b\u76d1\u63a7\u200b
  • \u200b\u5546\u54c1\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b
  • \u200b\u751f\u6001\u200b\u73af\u5883\u76d1\u6d4b\u200b
  • \u200b\u5b89\u5168\u76d1\u63a7\u200b
  • \u200b\u707e\u5bb3\u200b\u9884\u8b66\u200b
\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u4e13\u95e8\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u4f53\u79ef\u200b\u8f83\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u76d1\u63a7\u200b\u3001\u200b\u65e0\u4eba\u9a7e\u9a76\u200b\u548c\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u4ece\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e2d\u200b\u51c6\u786e\u200b\u627e\u5230\u200b\u5e76\u200b\u5206\u7c7b\u200b\u50cf\u200b\u884c\u4eba\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u6216\u200b\u5c0f\u200b\u52a8\u7269\u200b\u7b49\u200b\u5c0f\u200b\u5c3a\u5bf8\u200b\u7269\u4f53\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u63d0\u5347\u200b\u5bf9\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5728\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4e2d\u200b\u4e0d\u200b\u9057\u6f0f\u200b\u91cd\u8981\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u63d0\u9ad8\u200b\u5b89\u5168\u6027\u200b\u548c\u200b\u81ea\u52a8\u5316\u200b\u6c34\u5e73\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002
  • \u200b\u65e0\u4eba\u9a7e\u9a76\u200b\u6c7d\u8f66\u200b\u4e2d\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b
  • \u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u5efa\u7b51\u7269\u200b\u8bc6\u522b\u200b
  • \u200b\u667a\u80fd\u200b\u4ea4\u901a\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u5165\u4fb5\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b
  • \u200b\u5de5\u4e1a\u200b\u68c0\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u5fae\u5c0f\u200b\u7455\u75b5\u200b\u68c0\u6d4b\u200b
  • \u200b\u65e0\u4eba\u673a\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u52a8\u7269\u200b\u76d1\u6d4b\u200b
\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\uff0c\u200b\u6765\u200b\u8bc6\u522b\u200b\u4e0e\u4f17\u4e0d\u540c\u200b\u6216\u200b\u4e0d\u200b\u7b26\u5408\u200b\u6b63\u5e38\u200b\u6a21\u5f0f\u200b\u7684\u200b\u56fe\u50cf\u5904\u7406\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5de5\u4e1a\u200b\u8d28\u91cf\u200b\u68c0\u6d4b\u200b\u3001\u200b\u533b\u7597\u200b\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u5b89\u5168\u76d1\u63a7\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6f5c\u5728\u200b\u7684\u200b\u7f3a\u9677\u200b\u3001\u200b\u5f02\u5e38\u200b\u6216\u200b\u5f02\u5e38\u200b\u884c\u4e3a\u200b\uff0c\u200b\u4ece\u800c\u200b\u5e2e\u52a9\u200b\u6211\u4eec\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u95ee\u9898\u200b\u5e76\u200b\u91c7\u53d6\u76f8\u5e94\u200b\u63aa\u65bd\u200b\u3002\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7cfb\u7edf\u200b\u88ab\u200b\u8bbe\u8ba1\u200b\u7528\u4e8e\u200b\u81ea\u52a8\u68c0\u6d4b\u200b\u548c\u200b\u6807\u8bb0\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u9ad8\u200b\u5de5\u4f5c\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002
  • \u200b\u5de5\u4e1a\u200b\u8d28\u91cf\u200b\u63a7\u5236\u200b
  • \u200b\u533b\u7597\u200b\u5f71\u50cf\u200b\u5206\u6790\u200b
  • \u200b\u76d1\u63a7\u200b\u89c6\u9891\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u4ea4\u901a\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u7684\u200b\u8fdd\u89c4\u884c\u4e3a\u200b\u8bc6\u522b\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u7684\u200b\u969c\u788d\u7269\u200b\u68c0\u6d4b\u200b
  • \u200b\u519c\u4e1a\u200b\u75c5\u866b\u5bb3\u200b\u76d1\u6d4b\u200b
  • \u200b\u73af\u5883\u76d1\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u6c61\u67d3\u7269\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u6682\u65e0\u200b \u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u662f\u200b\u4e00\u79cd\u200b\u4ece\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u7ed3\u6784\u5316\u200b\u4fe1\u606f\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u4e3b\u8981\u200b\u7528\u4e8e\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6587\u6863\u200b\u7248\u9762\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u673a\u5668\u200b\u53ef\u8bfb\u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u6587\u6863\u200b\u7ba1\u7406\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u200b\u6570\u5b57\u5316\u200b\u7b49\u200b\u9886\u57df\u200b\u5177\u6709\u200b\u5e7f\u6cdb\u200b\u7684\u200b\u5e94\u7528\u200b\u3002\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff08OCR\uff09\u3001\u200b\u56fe\u50cf\u5904\u7406\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u5757\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u6bb5\u843d\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u4ee5\u53ca\u200b\u5176\u4ed6\u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u3002\u200b\u6b64\u200b\u8fc7\u7a0b\u200b\u901a\u5e38\u200b\u5305\u62ec\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u5143\u7d20\u200b\u5206\u6790\u200b\u548c\u200b\u6570\u636e\u200b\u683c\u5f0f\u5316\u200b\u4e09\u4e2a\u200b\u4e3b\u8981\u200b\u6b65\u9aa4\u200b\uff0c\u200b\u6700\u7ec8\u200b\u751f\u6210\u200b\u7ed3\u6784\u5316\u200b\u7684\u200b\u6587\u6863\u200b\u6570\u636e\u200b\uff0c\u200b\u63d0\u5347\u200b\u6570\u636e\u5904\u7406\u200b\u7684\u200b\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002
  • \u200b\u91d1\u878d\u200b\u4e0e\u200b\u6cd5\u5f8b\u200b\u6587\u6863\u200b\u5206\u6790\u200b
  • \u200b\u5386\u53f2\u6587\u732e\u200b\u548c\u200b\u6863\u6848\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u81ea\u52a8\u5316\u200b\u8868\u5355\u200b\u586b\u5199\u200b
  • \u200b\u9875\u9762\u200b\u7ed3\u6784\u200b\u89e3\u6790\u200b
\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200bLaTeX\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u5b66\u200b\u3001\u200b\u7269\u7406\u200b\u3001\u200b\u8ba1\u7b97\u673a\u79d1\u5b66\u200b\u7b49\u200b\u9886\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u7f16\u8f91\u200b\u548c\u200b\u6570\u636e\u5206\u6790\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6570\u5b66\u516c\u5f0f\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200bLaTeX\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002
  • \u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u4e0e\u200b\u68c0\u7d22\u200b
  • \u200b\u516c\u5f0f\u200b\u641c\u7d22\u5f15\u64ce\u200b
  • \u200b\u516c\u5f0f\u200b\u7f16\u8f91\u5668\u200b
  • \u200b\u81ea\u52a8\u5316\u200b\u6392\u7248\u200b
\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u548c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u5185\u5bb9\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u8bc6\u522b\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002
  • \u200b\u5408\u540c\u200b\u548c\u200b\u534f\u8bae\u200b\u9a8c\u8bc1\u200b
  • \u200b\u652f\u7968\u200b\u5904\u7406\u200b
  • \u200b\u8d37\u6b3e\u200b\u5ba1\u6279\u200b
  • \u200b\u6cd5\u5f8b\u6587\u4e66\u200b\u7ba1\u7406\u200b
\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b"},{"location":"support_list/pipelines_list.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u200b\u7ed9\u5b9a\u200b\u7684\u200b\u56fe\u50cf\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b
  • \u200b\u827a\u672f\u54c1\u200b\u98ce\u683c\u200b\u5206\u7c7b\u200b
  • \u200b\u519c\u4f5c\u7269\u200b\u75c5\u866b\u5bb3\u200b\u8bc6\u522b\u200b
  • \u200b\u52a8\u7269\u200b\u79cd\u7c7b\u200b\u8bc6\u522b\u200b
  • \u200b\u536b\u661f\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u571f\u5730\u200b\u3001\u200b\u6c34\u4f53\u200b\u3001\u200b\u5efa\u7b51\u200b\u7684\u200b\u5206\u7c7b\u200b
\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u8bad\u7ec3\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u8054\u5408\u200b\u8bad\u7ec3\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200b\u5c11\u91cf\u200b\u6709\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u548c\u200b\u5927\u91cf\u200b\u65e0\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u200b\u51cf\u5c11\u200b\u4eba\u5de5\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3001\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u7684\u200b\u6210\u672c\u200b\u3002\u200b\u4e0b\u56fe\u200b\u5c55\u793a\u200b\u4e86\u200b\u8be5\u200b\u4ea7\u7ebf\u200b\u5728\u200b\u516c\u5f00\u200b\u6570\u636e\u200b\u96c6\u200b COCO 10% \u200b\u6709\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u7684\u200b\u6307\u6807\u200b\u60c5\u51b5\u200b\u3002\u200b\u4f7f\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u5728\u200b COCO 10% \u200b\u6709\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b +90% \u200b\u65e0\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u4e0a\u200b\uff0c\u200b\u5927\u200b\u6a21\u578b\u200b\uff08RT-DETR-H\uff09\u200b\u76f8\u6bd4\u200b\u76f4\u63a5\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u7cbe\u5ea6\u9ad8\u200b 8.4 \u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0847.7%->56.1%\uff09\uff0c\u200b\u5237\u65b0\u200b\u4e86\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b SOTA\u3002\u200b\u5c0f\u200b\u6a21\u578b\u200b\uff08PicoDet-S\uff09\u200b\u76f8\u6bd4\u200b\u76f4\u63a5\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u7cbe\u5ea6\u9ad8\u200b\u4e86\u200b 10 \u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\u4ee5\u4e0a\u200b\uff0818.3%->28.8%\uff09\u3002
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u884c\u4eba\u200b\u3001\u200b\u8f66\u8f86\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u519b\u4e8b\u200b\u4fa6\u5bdf\u200b\u4e2d\u200b\u654c\u65b9\u200b\u8bbe\u65bd\u200b\u3001\u200b\u88c5\u5907\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u6df1\u6d77\u200b\u63a2\u6d4b\u200b\u4e2d\u200b\u6d77\u5e95\u200b\u751f\u7269\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-OCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-OCR \u200b\u4ea7\u7ebf\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b OCR \u200b\u8bad\u7ec3\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u7531\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e32\u8054\u200b\u5b8c\u6210\u200b\u3002\u200b\u9884\u6d4b\u200b\u56fe\u7247\u200b\u9996\u5148\u200b\u7ecf\u8fc7\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u83b7\u53d6\u200b\u5168\u90e8\u200b\u7684\u200b\u6587\u672c\u200b\u884c\u200b\u68c0\u6d4b\u200b\u6846\u200b\u5e76\u200b\u8fdb\u884c\u200b\u77eb\u6b63\u200b\uff0c\u200b\u4e4b\u540e\u200b\u7ecf\u6587\u200b\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u5f97\u5230\u200b OCR \u200b\u6587\u672c\u200b\u7ed3\u679c\u200b\u3002 \u200b\u5728\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u90e8\u5206\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u8054\u5408\u200b\u8bad\u7ec3\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200b\u5c11\u91cf\u200b\u6709\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u548c\u200b\u5927\u91cf\u200b\u65e0\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u200b\u51cf\u5c11\u200b\u4eba\u5de5\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3001\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u7684\u200b\u6210\u672c\u200b\u3002\u200b\u4e0b\u56fe\u200b\u5c55\u793a\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5e94\u7528\u200b\u4e2d\u200b\u7684\u200b 2 \u200b\u4e2a\u200b\u573a\u666f\u200b\u4f7f\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u540e\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\uff0c\u200b\u5728\u200b\u4e0d\u540c\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u5927\u200b\u6a21\u578b\u200b\u548c\u200b\u5c0f\u200b\u6a21\u578b\u200b\u5747\u200b\u6709\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u3002
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7535\u5b50\u5316\u200b
  • \u200b\u8eab\u4efd\u8bc1\u200b\u3001\u200b\u62a4\u7167\u200b\u3001\u200b\u9a7e\u9a76\u6267\u7167\u200b\u4e0a\u200b\u4e2a\u4eba\u4fe1\u606f\u200b\u7684\u200b\u8bfb\u53d6\u200b\u548c\u200b\u9a8c\u8bc1\u200b
  • \u200b\u96f6\u552e\u200b\u4e2d\u200b\u4ea7\u54c1\u200b\u4fe1\u606f\u200b\u8bc6\u522b\u200b
\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv2 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv2-common\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u5c06\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002 PP-ChatOCRv2-common \u200b\u7684\u200b\u7cfb\u7edf\u200b\u6d41\u7a0b\u200b\uff1a\u200b\u9996\u5148\u200b\u8f93\u5165\u200b\u9884\u6d4b\u200b\u56fe\u7247\u200b\uff0c\u200b\u9001\u5165\u200b\u901a\u7528\u200b OCR \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7ecf\u8fc7\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9884\u6d4b\u51fa\u200b\u6587\u5b57\u200b\uff0c\u200b\u4e0e\u200b\u7528\u6237\u200b Query \u200b\u4e4b\u95f4\u200b\u8fdb\u884c\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\uff0c\u200b\u5f97\u5230\u200b\u4e0e\u200b Query \u200b\u76f8\u5173\u200b\u7684\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\uff1b\u200b\u6700\u540e\u200b\u628a\u200b\u8fd9\u4e9b\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u4f20\u5165\u200b prompt \u200b\u751f\u6210\u5668\u200b\u91cd\u65b0\u7ec4\u5408\u200b\u6210\u200b prompt\uff0c\u200b\u8ba9\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u7ed9\u51fa\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002
  • \u200b\u8eab\u4efd\u8bc1\u200b\u3001\u200b\u94f6\u884c\u5361\u200b\u3001\u200b\u6237\u53e3\u672c\u200b\u3001\u200b\u706b\u8f66\u7968\u200b\u3001\u200b\u7eb8\u8d28\u200b\u53d1\u7968\u200b\u7b49\u200b\u591a\u79cd\u200b\u573a\u666f\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u63d0\u53d6\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv2 \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv2-doc\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u7279\u6b8a\u200b\u6807\u70b9\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002 PP-ChatOCRv2-doc \u200b\u7684\u200b\u7cfb\u7edf\u200b\u6d41\u7a0b\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a\u200b\u9996\u5148\u200b\u8f93\u5165\u200b\u9884\u6d4b\u200b\u56fe\u7247\u200b\uff0c\u200b\u9001\u5165\u200b\u901a\u7528\u200b OCR \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7ecf\u8fc7\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u540e\u200b\uff0c\u200b\u9884\u6d4b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u548c\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\uff1b\u200b\u968f\u540e\u200b\u5c06\u200b OCR \u200b\u7cfb\u7edf\u200b\u9884\u6d4b\u51fa\u200b\u7684\u200b\u6587\u5b57\u200b\u3001\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u7528\u6237\u200b Query \u200b\u4e4b\u95f4\u200b\u8fdb\u884c\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\uff0c\u200b\u5f97\u5230\u200b\u4e0e\u200b Query \u200b\u76f8\u5173\u200b\u7684\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\uff1b\u200b\u6700\u540e\u200b\u628a\u200b\u8fd9\u4e9b\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u4f20\u5165\u200b prompt \u200b\u751f\u6210\u5668\u200b\u91cd\u65b0\u7ec4\u5408\u200b\u6210\u200b prompt\uff0c\u200b\u8ba9\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u7ed9\u51fa\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002
  • \u200b\u77e5\u8bc6\u200b\u56fe\u8c31\u200b\u7684\u200b\u6784\u5efa\u200b
  • \u200b\u5728\u7ebf\u200b\u65b0\u95fb\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u4e8b\u4ef6\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b66\u672f\u200b\u6587\u732e\u200b\u4e2d\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u548c\u200b\u5206\u6790\u200b
\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3-doc\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u6587\u6863\u200b\u548c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u8bc6\u522b\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002\u200b\u8be5\u200b\u7279\u8272\u200b\u4ea7\u7ebf\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u652f\u6301\u200b\u66f4\u5f3a\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff08\u200b\u5982\u200bOCR\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u878d\u5408\u200b\u80fd\u529b\u200b\uff09\uff0c\u200b\u652f\u6301\u200b\u6027\u80fd\u200b\u66f4\u5f3a\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u77e5\u8bc6\u200b\u56fe\u8c31\u200b\u7684\u200b\u6784\u5efa\u200b
  • \u200b\u5728\u7ebf\u200b\u65b0\u95fb\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u4e8b\u4ef6\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b66\u672f\u200b\u6587\u732e\u200b\u4e2d\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u548c\u200b\u5206\u6790\u200b\uff08\u200b\u7279\u522b\u200b\u662f\u200b\u9700\u8981\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u3001\u200b\u626d\u66f2\u200b\u56fe\u7247\u200b\u3001\u200b\u66f4\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u7684\u200b\u573a\u666f\u200b\uff09
\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200bv2 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200bv2 \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u7279\u70b9\u200b\u662f\u200b\u9488\u5bf9\u200b\u4e0d\u540c\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u80fd\u591f\u200b\u81ea\u200b\u9002\u5e94\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u96c6\u6210\u200b\u6a21\u578b\u200b\uff0c\u200b\u63d0\u5347\u200b\u4efb\u52a1\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5728\u200b\u6bcf\u65e5\u200b\u7684\u200b\u751f\u6d3b\u200b\u3001\u200b\u5de5\u4f5c\u200b\u4e2d\u200b\u968f\u5904\u53ef\u89c1\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u662f\u200b\u6307\u200b\u6839\u636e\u200b\u5386\u53f2\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u6a21\u5f0f\u200b\u548c\u200b\u8d8b\u52bf\u200b\uff0c\u200b\u5bf9\u200b\u672a\u6765\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u3002\u200b\u5b83\u200b\u5728\u200b\u8bb8\u591a\u200b\u9886\u57df\u200b\u4e2d\u200b\u90fd\u200b\u6709\u200b\u5e94\u7528\u200b\uff0c\u200b\u5305\u62ec\u200b\u91d1\u878d\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u3001\u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b\u3001\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u3001\u200b\u80a1\u7968\u4ef7\u683c\u200b\u9884\u6d4b\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u5e02\u573a\u9884\u6d4b\u200b
  • \u200b\u9500\u552e\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u5929\u6c14\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u7206\u53d1\u200b\u9884\u6d4b\u200b
  • \u200b\u7f51\u7edc\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u91d1\u878d\u98ce\u9669\u200b\u9884\u6d4b\u200b
\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200bv2 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u7279\u70b9\u200b\u662f\u200b\u9488\u5bf9\u200b\u4e0d\u540c\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u80fd\u591f\u200b\u81ea\u200b\u9002\u5e94\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u96c6\u6210\u200b\u6a21\u578b\u200b\uff0c\u200b\u63d0\u5347\u200b\u4efb\u52a1\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u76ee\u524d\u200b\u65f6\u5e8f\u200b\u6570\u636e\u5206\u6790\u200b\u6210\u719f\u200b\u7684\u200b\u5e94\u7528\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u5176\u200b\u65e8\u5728\u200b\u4ece\u200b\u6b63\u5e38\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u51fa\u200b\u5f02\u5e38\u200b\u7684\u200b\u4e8b\u4ef6\u200b\u6216\u200b\u884c\u4e3a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u5728\u200b\u4f17\u591a\u200b\u9886\u57df\u200b\u90fd\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff1a\u200b\u91cf\u5316\u200b\u4ea4\u6613\u200b\u4e2d\u200b\uff0c\u200b\u7528\u4e8e\u200b\u53d1\u73b0\u5f02\u5e38\u200b\u4ea4\u6613\u200b\u884c\u4e3a\u200b\uff0c\u200b\u89c4\u907f\u200b\u6f5c\u5728\u200b\u7684\u200b\u91d1\u878d\u98ce\u9669\u200b\uff1b\u200b\u5728\u200b\u7f51\u7edc\u5b89\u5168\u200b\u9886\u57df\u200b\uff0c\u200b\u7528\u4e8e\u200b\u5b9e\u65f6\u200b\u76d1\u6d4b\u200b\u7f51\u7edc\u6d41\u91cf\u200b\uff0c\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u5e76\u200b\u9884\u9632\u200b\u7f51\u7edc\u653b\u51fb\u200b\u884c\u4e3a\u200b\u7684\u200b\u53d1\u751f\u200b\uff1b\u200b\u5728\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u6c7d\u8f66\u200b\u9886\u57df\u200b\uff0c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u53ef\u4ee5\u200b\u6301\u7eed\u200b\u76d1\u6d4b\u200b\u8f66\u8f7d\u200b\u4f20\u611f\u5668\u200b\u6570\u636e\u200b\uff0c\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u53ef\u80fd\u200b\u5bfc\u81f4\u200b\u4e8b\u6545\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff1b\u200b\u800c\u200b\u5728\u200b\u5927\u578b\u200b\u5de5\u4e1a\u200b\u8bbe\u5907\u200b\u7ef4\u62a4\u200b\u4e2d\u200b\uff0c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4e5f\u200b\u80fd\u591f\u200b\u5e2e\u52a9\u200b\u5de5\u7a0b\u5e08\u200b\u63d0\u524d\u200b\u53d1\u73b0\u200b\u8bbe\u5907\u200b\u6545\u969c\u200b\u82d7\u5934\u200b\uff0c\u200b\u4ece\u800c\u200b\u91c7\u53d6\u200b\u9884\u9632\u6027\u200b\u7ef4\u62a4\u200b\u63aa\u65bd\u200b\uff0c\u200b\u964d\u4f4e\u200b\u8bbe\u5907\u200b\u505c\u673a\u200b\u65f6\u95f4\u200b\u548c\u200b\u7ef4\u4fee\u200b\u6210\u672c\u200b\u3002
  • \u200b\u7f51\u7edc\u200b\u5165\u4fb5\u200b\u68c0\u6d4b\u200b
  • \u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u751f\u4ea7\u200b\u4e2d\u200b\u6545\u969c\u200b\u8bbe\u5907\u200b\u68c0\u6d4b\u200b
  • \u200b\u533b\u7597\u200b\u5065\u5eb7\u200b\u4e2d\u200b\u60a3\u8005\u200b\u5f02\u5e38\u200b\u72b6\u6001\u200b\u76d1\u6d4b\u200b
"},{"location":"support_list/pipelines_list_dcu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(DCU)","text":""},{"location":"support_list/pipelines_list_dcu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
"},{"location":"support_list/pipelines_list_dcu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"support_list/pipelines_list_mlu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(MLU)","text":""},{"location":"support_list/pipelines_list_mlu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
"},{"location":"support_list/pipelines_list_mlu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"support_list/pipelines_list_npu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(NPU)","text":""},{"location":"support_list/pipelines_list_npu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5b83\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u533a\u5206\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u4e0d\u540c\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u7684\u200b\u7cbe\u786e\u200b\u5206\u5272\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5728\u200b\u540c\u4e00\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5206\u522b\u200b\u6807\u8bb0\u200b\u51fa\u200b\u6bcf\u200b\u4e00\u8f86\u8f66\u200b\u3001\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u4eba\u200b\u6216\u200b\u6bcf\u200b\u4e00\u53ea\u200b\u52a8\u7269\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5b83\u4eec\u200b\u5728\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u4e0a\u200b\u88ab\u200b\u72ec\u7acb\u200b\u5904\u7406\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u5305\u542b\u200b\u591a\u8f86\u200b\u8f66\u200b\u548c\u200b\u884c\u4eba\u200b\u7684\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u80fd\u591f\u200b\u5c06\u200b\u6bcf\u8f86\u8f66\u200b\u548c\u200b\u6bcf\u4e2a\u200b\u4eba\u200b\u7684\u200b\u8f6e\u5ed3\u200b\u6e05\u6670\u200b\u5730\u200b\u5206\u5f00\u200b\uff0c\u200b\u5f62\u6210\u200b\u591a\u4e2a\u200b\u72ec\u7acb\u200b\u7684\u200b\u533a\u57df\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u548c\u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bMask R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6765\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u7684\u200b\u50cf\u7d20\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u533a\u5206\u200b\uff0c\u200b\u4e3a\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u7684\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u652f\u6301\u200b\u3002
  • \u200b\u5546\u573a\u200b\u4e2d\u200b\u4eba\u7fa4\u200b\u7684\u200b\u8ba1\u6570\u200b
  • \u200b\u519c\u4e1a\u200b\u667a\u80fd\u5316\u200b\u4e2d\u200b\u519c\u4f5c\u7269\u200b\u6216\u200b\u679c\u5b9e\u200b\u6570\u91cf\u200b\u7684\u200b\u7edf\u8ba1\u200b
  • \u200b\u56fe\u50cf\u7f16\u8f91\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u7269\u4f53\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u5206\u5272\u200b
\u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u636e\u5f55\u5165\u200b\u3001\u200b\u4fe1\u606f\u68c0\u7d22\u200b\u548c\u200b\u6587\u6863\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002
  • \u200b\u94f6\u884c\u200b\u8d26\u5355\u200b\u7684\u200b\u5904\u7406\u200b
  • \u200b\u533b\u7597\u200b\u62a5\u544a\u200b\u4e2d\u200b\u5404\u9879\u200b\u6307\u6807\u200b\u7684\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b
  • \u200b\u5408\u540c\u200b\u4e2d\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u7684\u200b\u63d0\u53d6\u200b
\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u8bc6\u522b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u6a21\u5f0f\u200b\u6216\u200b\u884c\u4e3a\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7f51\u7edc\u5b89\u5168\u200b\u3001\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u548c\u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6b63\u5e38\u200b\u8d8b\u52bf\u200b\u548c\u200b\u89c4\u5f8b\u200b\uff0c\u200b\u6765\u200b\u53d1\u73b0\u200b\u4e0e\u200b\u9884\u671f\u200b\u884c\u4e3a\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u7a81\u7136\u200b\u589e\u52a0\u200b\u7684\u200b\u7f51\u7edc\u6d41\u91cf\u200b\u6216\u200b\u5f02\u5e38\u200b\u7684\u200b\u4ea4\u6613\u200b\u6d3b\u52a8\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff08\u200b\u5982\u200b\u5b64\u7acb\u200b\u68ee\u6797\u200b\u3001LSTM\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u63d0\u4f9b\u200b\u5b9e\u65f6\u200b\u8b66\u62a5\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u53ca\u65f6\u200b\u5e94\u5bf9\u200b\u6f5c\u5728\u200b\u98ce\u9669\u200b\u548c\u200b\u95ee\u9898\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u4fdd\u969c\u7cfb\u7edf\u200b\u7a33\u5b9a\u6027\u200b\u548c\u200b\u5b89\u5168\u6027\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002
  • \u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b
  • \u200b\u7f51\u7edc\u200b\u5165\u4fb5\u200b\u68c0\u6d4b\u200b
  • \u200b\u8bbe\u5907\u200b\u6545\u969c\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u751f\u4ea7\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u7535\u529b\u7cfb\u7edf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u5f52\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u884c\u4e3a\u200b\u8bc6\u522b\u200b\u3001\u200b\u8bed\u97f3\u200b\u8bc6\u522b\u200b\u548c\u200b\u91d1\u878d\u200b\u8d8b\u52bf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5f0f\u200b\u6216\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5c06\u200b\u4e00\u6bb5\u200b\u8bed\u97f3\u200b\u4fe1\u53f7\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u95ee\u5019\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u8bf7\u6c42\u200b\u201d\uff0c\u200b\u6216\u200b\u5c06\u200b\u80a1\u7968\u4ef7\u683c\u200b\u8d70\u52bf\u200b\u5212\u5206\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u6355\u6349\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\u548c\u200b\u53d8\u5316\u89c4\u5f8b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u6570\u636e\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u76d1\u63a7\u200b\u3001\u200b\u8bed\u97f3\u200b\u52a9\u624b\u200b\u548c\u200b\u5e02\u573a\u9884\u6d4b\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u8d77\u200b\u7740\u200b\u5173\u952e\u4f5c\u7528\u200b\u3002
  • \u200b\u5fc3\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u884c\u4e3a\u200b\u5206\u7c7b\u200b
  • \u200b\u8111\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u60c5\u7eea\u200b\u5206\u7c7b\u200b
  • \u200b\u4ea4\u901a\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
  • \u200b\u7f51\u7edc\u6d41\u91cf\u200b\u5206\u7c7b\u200b
  • \u200b\u8bbe\u5907\u200b\u5de5\u4f5c\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
"},{"location":"support_list/pipelines_list_npu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"support_list/pipelines_list_xpu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(XPU)","text":""},{"location":"support_list/pipelines_list_xpu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
"},{"location":"support_list/pipelines_list_xpu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"blog/index.html","title":"Blog","text":""},{"location":"en/index.html#introduction","title":"\ud83d\udd0d Introduction","text":"

PaddleX 3.0 is a low-code development tool for AI models built on the PaddlePaddle framework. It integrates numerousready-to-use pre-trained models, enablingfull-process developmentfrom model training to inference, supportinga variety of mainstream hardware both domestic and international, and aiding AI developers in industrial practice.

Image Classification Multi-label Image Classification Object Detection Instance Segmentation Semantic Segmentation Image Anomaly Detection OCR Table Recognition PP-ChatOCRv3-doc Time Series Forecasting Time Series Anomaly Detection Time Series Classification"},{"location":"en/index.html#why-paddlex","title":"\ud83c\udf1f Why PaddleX ?","text":"

\ud83c\udfa8 Rich Models One-click Call: Integrate over 200 PaddlePaddle models covering multiple key areas such as OCR, object detection, and time series forecasting into 19 pipelines. Experience the model effects quickly through easy Python API calls. Also supports more than 20 modules for easy model combination use by developers.

\ud83d\ude80 High Efficiency and Low barrier of entry: Achieve model full-process development based on graphical interfaces and unified commands, creating 8 featured model pipelines that combine large and small models, semi-supervised learning of large models, and multi-model fusion, greatly reducing the cost of iterating models.

\ud83c\udf10 Flexible Deployment in Various Scenarios: Support various deployment methods such as high-performance inference, service deployment, and lite deployment to ensure efficient operation and rapid response of models in different application scenarios.

\ud83d\udd27 Efficient Support for Mainstream Hardware: Support seamless switching of various mainstream hardware such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU to ensure efficient operation.

"},{"location":"en/index.html#recent-updates","title":"\ud83d\udce3 Recent Updates","text":"

\ud83d\udd25\ud83d\udd25 \"PaddleX Document Information Personalized Extraction Upgrade\", PP-ChatOCRv3 innovatively provides custom development functions for OCR models based on data fusion technology, offering stronger model fine-tuning capabilities. Millions of high-quality general OCR text recognition data are automatically integrated into vertical model training data at a specific ratio, solving the problem of weakened general text recognition capabilities caused by vertical model training in the industry. Suitable for practical scenarios in industries such as automated office, financial risk control, healthcare, education and publishing, and legal and government sectors. October 24th (Thursday) 19:00 Join our live session for an in-depth analysis of the open-source version of PP-ChatOCRv3 and the outstanding advantages of PaddleX 3.0 Beta1 in terms of accuracy and speed. Registration Link

\u2757 more courses

\ud83d\udd25\ud83d\udd25 9.30, 2024, PaddleX 3.0 Beta1 open source version is officially released, providing more than 200 models that can be called with a simple Python API; achieve model full-process development based on unified commands, and open source the basic capabilities of the PP-ChatOCRv3 pipeline; support more than 100 models for high-performance inference and service-oriented deployment (iterating continuously), more than 7 key visual models for edge-deployment; more than 70 models have been adapted for the full development process of Ascend 910B, more than 15 models have been adapted for the full development process of Kunlun chips and Cambricon

\ud83d\udd25 6.27, 2024, PaddleX 3.0 Beta open source version is officially released, supporting the use of various mainstream hardware for pipeline and model development in a low-code manner on the local side.

\ud83d\udd25 3.25, 2024, PaddleX 3.0 cloud release, supporting the creation of pipelines in the AI Studio Galaxy Community in a zero-code manner.

more

"},{"location":"en/index.html#explanation-of-pipeline","title":"\ud83d\udd20 Explanation of Pipeline","text":"

PaddleX is dedicated to achieving pipeline-level model training, inference, and deployment. A pipeline refers to a series of predefined development processes for specific AI tasks, which includes a combination of single models (single-function modules) capable of independently completing a certain type of task.

"},{"location":"en/index.html#what-can-paddlex-do","title":"\ud83d\udcca What can PaddleX do\uff1f","text":"

All pipelines of PaddleX support online experience on AI Studio and local fast inference. You can quickly experience the effects of each pre-trained pipeline. If you are satisfied with the effects of the pre-trained pipeline, you can directly perform high-performance inference / serving deployment / edge deployment on the pipeline. If not satisfied, you can also Custom Development to improve the pipeline effect. For the complete pipeline development process, please refer to the PaddleX pipeline Development Tool Local Use Tutorial.

In addition, PaddleX provides developers with a full-process efficient model training and deployment tool based on a cloud-based GUI. Developers do not need code development, just need to prepare a dataset that meets the pipeline requirements to quickly start model training. For details, please refer to the tutorial \"Developing Industrial-level AI Models with Zero Barrier\".

Pipeline Online Experience Local Inference High-Performance Inference Service-Oriented Deployment Edge Deployment Custom Development Zero-Code Development On AI Studio OCR Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 PP-ChatOCRv3 Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Table Recognition Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Object Detection Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Instance Segmentation Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Image Classification Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Semantic Segmentation Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Time Series Forecasting Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Anomaly Detection Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Classification Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Small Object Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Multi-label Image Classification \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Anomaly Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Layout Parsing \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Formula Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Seal Recognition \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Pedestrian Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Vehicle Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Face Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7

\u2757Note: The above capabilities are implemented based on GPU/CPU. PaddleX can also perform local inference and custom development on mainstream hardware such as Kunlunxin, Ascend, Cambricon, and Haiguang. The table below details the support status of the pipelines. For specific supported model lists, please refer to the Model List (Kunlunxin XPU)/Model List (Ascend NPU)/Model List (Cambricon MLU)/Model List (Haiguang DCU). We are continuously adapting more models and promoting the implementation of high-performance and service-oriented deployment on mainstream hardware.

\ud83d\udd25\ud83d\udd25 Support for Domestic Hardware Capabilities

Pipeline Ascend 910B Kunlunxin R200/R300 Cambricon MLU370X8 Haiguang Z100 OCR \u2705 \u2705 \u2705 \ud83d\udea7 Table Recognition \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Object Detection \u2705 \u2705 \u2705 \ud83d\udea7 Instance Segmentation \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Classification \u2705 \u2705 \u2705 \u2705 Semantic Segmentation \u2705 \u2705 \u2705 \u2705 Time Series Forecasting \u2705 \u2705 \u2705 \ud83d\udea7 Time Series Anomaly Detection \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Time Series Classification \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7"},{"location":"en/index.html#discussion","title":"\ud83d\udcac Discussion","text":"

We warmly welcome and encourage community members to raise questions, share ideas, and feedback in the Discussions section. Whether you want to report a bug, discuss a feature request, seek help, or just want to keep up with the latest project news, this is a great platform.

"},{"location":"en/index.html#license","title":"\ud83d\udcc4 License","text":"

The release of this project is licensed under the Apache 2.0 license.

"},{"location":"en/CHANGLOG.html","title":"Version Update Information","text":""},{"location":"en/CHANGLOG.html#latest-version-information","title":"Latest Version Information","text":""},{"location":"en/CHANGLOG.html#paddlex-v300beta1-9302024","title":"PaddleX v3.0.0beta1 (9.30/2024)","text":"

PaddleX 3.0 Beta1 offers over 200 models accessible through a streamlined Python API for one-click deployment; realizes full-process model development based on unified commands, and opens source the foundational capabilities of the PP-ChatOCRv3 special model pipeline; supports high-performance inference and service-oriented deployment for over 100 models, as well as edge deployment for 7 key vision models; and fully adapts the development process of over 70 models to Huawei Ascend 910B, and over 15 models to XPU and MLU.

  • Rich Models with One-click Deployment: Integrates over 200 PaddlePaddle models across key domains such as document image intelligent analysis, OCR, object detection, and time series prediction into 13 model pipelines, enabling rapid model experience through a streamlined Python API. Additionally, supports over 20 individual functional modules for convenient model combination.
  • Enhanced Efficiency and Lowered Thresholds: Implements full-process model development based on a graphical interface and unified commands, creating 8 special model pipelines that combine large and small models, leverage large model semi-supervised learning, and multi-model fusion, significantly reducing iteration costs.
  • Flexible Deployment Across Scenarios: Supports various deployment methods including high-performance, service-oriented, and edge deployment, ensuring efficient model operation and rapid response across different application scenarios.
  • Efficient Support for Mainstream Hardware: Seamlessly switches between NVIDIA GPUs, XPU, Ascend, and MLU, ensuring efficient operation.
"},{"location":"en/CHANGLOG.html#paddlex-v300beta-6272024","title":"PaddleX v3.0.0beta (6.27/2024)","text":"

PaddleX 3.0beta integrates the advantages of the PaddlePaddle ecosystem, covering 7 major scenario tasks, constructs 16 model pipelines, and provides a low-code development mode to assist developers in realizing full-process model development on various mainstream hardware.

  • Basic Model Pipelines (Rich Models, Comprehensive Scenarios): Selects 68 high-quality PaddlePaddle models, covering tasks such as image classification, object detection, image segmentation, OCR, text image layout analysis, and time series prediction.
  • Special Model Pipelines (Significant Efficiency Improvement): Provides efficient solutions combining large and small models, large model semi-supervised learning, and multi-model fusion.
  • Low-code Development Mode (Convenient Development and Deployment): Offers both zero-code and low-code development methods.
  • Zero-code Development: Users can interactively submit background training tasks through a graphical user interface (GUI), bridging online and offline deployment, and supporting API-based online service invocation.
  • Low-code Development: Achieves full-process development across 16 model pipelines through unified API interfaces, while supporting user-defined model process serialization.
  • Multi-hardware Local Support (Strong Compatibility): Supports NVIDIA GPUs, XPU, Ascend, and MLU, enabling pure offline usage.
"},{"location":"en/CHANGLOG.html#paddlex-v210-12102021","title":"PaddleX v2.1.0 (12.10/2021)","text":"

Added the ultra-lightweight classification model PPLCNet, achieving approximately 5ms prediction speed for a single image on Intel CPUs, with a Top-1 Accuracy of 80.82% on the ImageNet-1K dataset, surpassing ResNet152's performance. Experience it now! Added the lightweight detection model PP-PicoDet, the first to surpass 30+ mAP(0.5:0.95) within 1M parameters (at 416px input), achieving up to 150FPS prediction on ARM CPUs. Experience it now! Upgraded PaddleX Restful API to support PaddlePaddle's dynamic graph development mode. Experience it now! Added negative sample training strategies for detection models. Experience it now! Added lightweight Python-based service deployment. Experience it now!

"},{"location":"en/CHANGLOG.html#paddlex-v200-9102021","title":"PaddleX v2.0.0 (9.10/2021)","text":"
  • PaddleX API
  • Added visualization of prediction results for detection and instance segmentation tasks, as well as analysis of prediction errors to assist in model effect analysis
  • Introduced negative sample optimization for detection tasks to suppress false detections in background regions
  • Improved prediction results for semantic segmentation tasks, supporting the return of predicted categories and normalized prediction confidence
  • Enhanced prediction results for image classification tasks, supporting the return of normalized prediction confidence
  • Prediction Deployment
  • Completed PaddleX Python prediction deployment, enabling rapid deployment with just 2 APIs
  • Comprehensively upgraded PaddleX C++ deployment, supporting end-to-end unified deployment capabilities for PaddlePaddle vision suites including PaddleDetection, PaddleClas, PaddleSeg, and PaddleX
  • Newly released Manufacture SDK, providing a pre-compiled PaddlePaddle deployment development kit (SDK) for industrial-grade multi-end and multi-platform deployment acceleration, enabling rapid inference deployment through configuring business logic flow files in a low-code manner
  • PaddleX GUI
  • Upgraded PaddleX GUI to support 30-series graphics cards
  • Added PP-YOLO V2 model for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Newly added the ability to export API training scripts for seamless switching to PaddleX API training
  • Industrial Practice Cases
  • Added tutorial cases for steel bar counting and defect detection, focusing on object detection tasks
  • Added tutorial cases for robotic arm grasping, focusing on instance segmentation tasks
  • Added tutorial cases for training and deployment of industrial meter readings, which combines object detection, semantic segmentation, and traditional vision algorithms
  • Added a deployment case tutorial using C# language under Windows system
"},{"location":"en/CHANGLOG.html#paddlex-v200rc0-5192021","title":"PaddleX v2.0.0rc0 (5.19/2021)","text":"
  • Fully supports PaddlePaddle 2.0 dynamic graphs for an easier development mode
  • Added PP-YOLOv2 for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Comprehensive upgrade of C++ deployment module
    • PaddleInference deployment adapted to 2.0 prediction library (Usage Documentation)
    • Supports deployment of models from PaddleDetection, PaddleSeg, PaddleClas, and PaddleX
    • Added multi-GPU prediction based on PaddleInference (Usage Documentation)
    • GPU deployment added TensorRT high-performance acceleration engine deployment method based on ONNX
    • GPU deployment added Triton service-oriented deployment method based on ONNX (Docker Usage Documentation)
"},{"location":"en/CHANGLOG.html#paddlex-v130-12192020","title":"PaddleX v1.3.0 (12.19/2020)","text":"
  • Model Updates

    • Image Classification model ResNet50_vd adds a pre-trained model with 100,000 categories.
    • Object Detection model FasterRCNN adds model pruning support.
    • Object Detection models now support multi-channel image training.
  • Model Deployment Updates

    • Fixed bugs in OpenVINO deployment C++ code.
    • Raspberry Pi deployment adds Arm V8 support.
  • Industry Case Updates

    • Added an industrial quality inspection case, providing GPU and CPU deployment scenarios for industrial quality inspection, along with optimization strategies related to quality inspection.
  • New RESTful API Module A new RESTful API module is added, enabling developers to quickly develop training platforms based on PaddleX.

    • Added an HTML Demo based on RESTful API.
    • Added a Remote version of the visualization client based on RESTful API. Added deployment solutions for models through OpenVINO.
"},{"location":"en/CHANGLOG.html#paddlex-v120-992020","title":"PaddleX v1.2.0 (9.9/2020)","text":"
  • Model Updates

    • Added the object detection model PPYOLO.
    • FasterRCNN, MaskRCNN, YOLOv3, DeepLabv3p, and other models now have pre-trained models on the COCO dataset.
    • Object Detection models FasterRCNN and MaskRCNN add the backbone HRNet_W18.
    • Semantic Segmentation model DeepLabv3p adds the backbone MobileNetV3_large_ssld.
  • Model Deployment Updates

    • Added deployment solutions for models through OpenVINO.
    • Added deployment solutions for models on Raspberry Pi.
    • Optimized data preprocessing and postprocessing code performance for PaddleLite Android deployment.
    • Optimized Paddle Server-side C++ deployment code, added parameters such as use_mkl, significantly improving model prediction performance on CPUs through mkldnn.
  • Industry Case Updates

    • Added an RGB image remote sensing segmentation case.
    • Added a multi-channel remote sensing segmentation case.
  • Others

    • Added a dataset splitting function, supporting command-line splitting of ImageNet, PascalVOC, MSCOCO, and semantic segmentation datasets.

### PaddleX v1.1.0 (7.13/2020) - Model Updates

  • Added new semantic segmentation models: HRNet, FastSCNN
  • Added HRNet backbone for object detection (FasterRCNN) and instance segmentation (MaskRCNN)
  • Pre-trained models on COCO dataset for object detection and instance segmentation
  • Integrated X2Paddle, enabling all PaddleX classification and semantic segmentation models to export to ONNX protocol
  • Model Deployment Updates
  • Added support for model encryption on Windows platform
  • New deployment and prediction solutions for Jetson and PaddleLite
  • C++ deployment code now supports batch prediction and utilizes OpenMP for parallel acceleration of preprocessing
  • Added 2 PaddleX Industrial Cases
  • Portrait segmentation case
  • Industrial meter reading case
  • New data format conversion feature, converting data annotated by LabelMe, Jingling Annotation Assistant, and EasyData platform to formats supported by PaddleX
  • Updated PaddleX documentation, optimizing the document structure
"},{"location":"en/CHANGLOG.html#paddlex-v100-5212020","title":"PaddleX v1.0.0 (5.21/2020)","text":"
  • End-to-End Pipeline
  • Data Preparation: Supports the EasyData Intelligent Data Service Platform data protocol, facilitating intelligent annotation and low-quality data cleaning through the platform. It is also compatible with mainstream annotation tool protocols, helping developers complete data preparation faster.
  • Model Training: Integrates PaddleClas, PaddleDetection, PaddleSeg vision development kits, providing a rich selection of high-quality pre-trained models for faster achievement of industrial-grade model performance.
  • Model Tuning: Built-in model interpretability modules and VisualDL visualization analysis components, providing abundant information for better understanding and optimizing models.
  • Secure Multi-platform Deployment: Integrated with PaddleSlim model compression tools and model encryption deployment modules, facilitating high-performance and secure multi-platform deployment in conjunction with Paddle Inference or Paddle Lite.

  • Integrated Industrial Practices

  • Selects mature model architectures from PaddlePaddle's industrial practices, opening up case study tutorials to accelerate developers' industrial implementation.

  • Easy-to-Use and Easy-to-Integrate

  • Unified and user-friendly end-to-end APIs, enabling model training in 5 steps and high-performance Python/C++ deployment with just 10 lines of code.
  • Provides PaddleX-GUI, a cross-platform visualization tool centered on PaddleX, for a quick experience of the full PaddlePaddle deep learning pipeline.
"},{"location":"en/FAQ.html#q-what-is-paddlex","title":"Q: What is PaddleX?","text":"

A: PaddleX is a low-code development tool featuring selected models and pipelines launched by the PaddlePaddle team. It aims to provide developers with a more convenient and efficient development environment. This tool supports model training and inference on multiple mainstream domestic and international hardware, and is compatible with various system configurations, thereby meeting users' needs in different application scenarios. PaddleX has a wide range of applications, covering industries such as industry, energy, finance, transportation, and education, providing professional support and solutions for these industries. By using PaddleX, developers can more easily apply deep learning technology to actual industrial practices, thereby realizing technology implementation and transformation, and promoting digital transformation and intelligent upgrading across industries.

"},{"location":"en/FAQ.html#q-what-is-a-pipeline-what-is-a-module-what-is-the-relationship-between-them","title":"Q: What is a Pipeline? What is a Module? What is the relationship between them?","text":"

A: In PaddleX, a module is defined as the smallest unit that implements basic functions, meaning each module undertakes a specific task, such as text detection. Within this framework, a pipeline is the actual functionality achieved by one or more modules working together, often forming more complex application scenarios, such as Optical Character Recognition (OCR) technology. Therefore, the relationship between modules and pipelines can be understood as the relationship between basics and applications. Modules, as the smallest units, provide the foundation for construction, while pipelines demonstrate the practical application effects of these foundational modules after reasonable combination and configuration. This design approach allows users to flexibly select and combine different modules to achieve the functions they need, significantly enhancing development flexibility and efficiency. The official pipelines also support users with high-performance inference, service-oriented deployment, and other deployment capabilities.

"},{"location":"en/FAQ.html#q-how-to-choose-between-the-wheel-package-installation-mode-and-the-plugin-installation-mode","title":"Q: How to choose between the Wheel package installation mode and the plugin installation mode?","text":"

A: If your application scenario in using PaddleX mainly focuses on model inference and integration, we highly recommend choosing a more convenient and lightweight installation method, namely the Wheel package installation mode. This installation mode aims to provide users with a quick and simple installation experience, especially suitable for scenarios requiring rapid deployment and integration of models. Installing with Wheel packages can significantly reduce the complexity of the installation process, avoid unnecessary configuration issues, and allow developers to focus more time and effort on the practical application and optimization of models. Whether you are a novice or an experienced developer, this lightweight installation method will greatly facilitate your workflow. Therefore, when performing model inference and integration, choosing the Wheel package installation mode will undoubtedly make your entire development process more efficient and smooth.

"},{"location":"en/FAQ.html#q-what-is-the-difference-between-paddlex-and-baidu-aistudio-communitys-zero-code-pipeline","title":"Q: What is the difference between PaddleX and Baidu AIStudio Community's Zero-Code Pipeline?","text":"

A: Baidu AIStudio Community's Zero-Code Pipeline is the cloud-based carrier of PaddleX, with its underlying code consistent with PaddleX, and can be considered as a cloud-based PaddleX. The design philosophy of Baidu AIStudio Community's Zero-Code Pipeline is to enable users to quickly build and deploy model applications without needing to delve deeply into programming and algorithm knowledge. On this basis, Baidu AIStudio Community's Zero-Code Pipeline also provides many special pipelines, such as training high-precision models with a small number of samples and solving complex time-series problems using multi-model fusion schemes. PaddleX, on the other hand, is a local development tool that provides users with powerful functions supporting more in-depth secondary development. This means developers can flexibly adjust and expand based on PaddleX to create solutions that better fit specific application scenarios. Additionally, PaddleX offers a rich set of model interfaces, supporting users in freely combining models for use.

"},{"location":"en/FAQ.html#q-when-i-encounter-problems-while-using-paddlex-how-should-i-provide-feedback","title":"Q: When I encounter problems while using PaddleX, how should I provide feedback?","text":"

A: Welcome to the Discussion Area to communicate with a vast number of developers! If you find errors or deficiencies in PaddleX, you are also welcome to submit an issue, and our on-duty team members will respond to your questions as soon as possible.

"},{"location":"en/quick_start.html","title":"Quick Start","text":""},{"location":"en/quick_start.html#installation","title":"\ud83d\udee0\ufe0f Installation","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

  • Installing PaddlePaddle
# cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

\u2757For more PaddlePaddle versions, please refer to the PaddlePaddle official website.

  • Installing PaddleX
pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n

\u2757For more installation methods, refer to the PaddleX Installation Guide.

"},{"location":"en/quick_start.html#cli-usage","title":"\ud83d\udcbb CLI Usage","text":"

One command can quickly experience the pipeline effect, the unified CLI format is:

paddlex --pipeline [Pipeline Name] --input [Input Image] --device [Running Device]\n

You only need to specify three parameters: * pipeline: The name of the pipeline * input: The local path or URL of the input image to be processed * device: The GPU number used (for example, gpu:0 means using the 0th GPU), you can also choose to use the CPU (cpu)

For example, using the OCR pipeline:

paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png  --device gpu:0\n

{\n'input_path': '/root/.paddlex/predict_input/general_ocr_002.png',\n'dt_polys': [array([[161,  27],\n       [353,  22],\n       [354,  69],\n       [162,  74]], dtype=int16), array([[426,  26],\n       [657,  21],\n       [657,  58],\n       [426,  62]], dtype=int16), array([[702,  18],\n       [822,  13],\n       [824,  57],\n       [704,  62]], dtype=int16), array([[341, 106],\n       [405, 106],\n       [405, 128],\n       [341, 128]], dtype=int16)\n       ...],\n'dt_scores': [0.758478200014338, 0.7021546472698513, 0.8536622648391111, 0.8619181462164781, 0.8321051217096188, 0.8868756173427551, 0.7982964727675609, 0.8289939036796322, 0.8289428877522524, 0.8587063317632897, 0.7786755892491615, 0.8502032769081344, 0.8703346500042997, 0.834490931790065, 0.908291103353393, 0.7614978661708064, 0.8325774055997542, 0.7843421347676149, 0.8680889482955594, 0.8788859304537682, 0.8963341277518075, 0.9364654810069546, 0.8092413027028257, 0.8503743089091863, 0.7920740420391101, 0.7592224394793805, 0.7920547400069311, 0.6641757962457888, 0.8650289477605955, 0.8079483304467047, 0.8532207681055275, 0.8913377034754717],\n'rec_text': ['\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', 'CLASS', '\u200b\u5e8f\u53f7\u200b SERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200b', '\u200b\u65e5\u671f\u200b DATE', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHW', '035', 'MU2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', \u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE10MINUTESBEFOREDEPARTURETIME'],\n'rec_score': [0.9985831379890442, 0.999696917533874512, 0.9985735416412354, 0.9842517971992493, 0.9383274912834167, 0.9943678975105286, 0.9419361352920532, 0.9221674799919128, 0.9555020928382874, 0.9870321154594421, 0.9664073586463928, 0.9988052248954773, 0.9979352355003357, 0.9985110759735107, 0.9943482875823975, 0.9991195797920227, 0.9936401844024658, 0.9974591135978699, 0.9743705987930298, 0.9980487823486328, 0.9874696135520935, 0.9900962710380554, 0.9952947497367859, 0.9950481653213501, 0.989926815032959, 0.9915552139282227, 0.9938777685165405, 0.997239887714386, 0.9963340759277344, 0.9936134815216064, 0.97223961353302]}\n

The visualization result is as follows:

To use the command line for other pipelines, simply adjust the pipeline parameter to the name of the corresponding pipeline. Below are the commands for each pipeline:

Pipeline Name Command Image Classification paddlex --pipeline image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Object Detection paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 Instance Segmentation paddlex --pipeline instance_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png --device gpu:0 Semantic Segmentation paddlex --pipeline semantic_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png --device gpu:0 Image Multi-label Classification paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Small Object Detection paddlex --pipeline small_object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/small_object_detection.jpg --device gpu:0 Image Anomaly Detection paddlex --pipeline anomaly_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_grid.png --device gpu:0 OCR paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 Table Recognition paddlex --pipeline table_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg --device gpu:0 Layout Parsing paddlex --pipeline layout_parsing --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/demo_paper.png --device gpu:0 Formula Recognition paddlex --pipeline formula_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/demo_image/general_formula_recognition.png --device gpu:0 Seal Recognition paddlex --pipeline seal_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/seal_text_det.png --device gpu:0 Time Series Forecasting paddlex --pipeline ts_fc --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv --device gpu:0 Time Series Anomaly Detection paddlex --pipeline ts_ad --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv --device gpu:0 Time Series Classification paddlex --pipeline ts_cls --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv --device gpu:0"},{"location":"en/quick_start.html#python-script-usage","title":"\ud83d\udcdd Python Script Usage","text":"

With just a few lines of code, you can quickly perform inference on a production line. The unified Python script format is as follows:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=[PipelineName])\noutput = pipeline.predict([InputImageName])\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n
The following steps are executed:

  • create_pipeline() instantiates the production line object.
  • An image is passed in and the predict method of the production line object is called for inference and prediction.
  • The prediction results are processed.

For other production lines using the Python script, you only need to adjust the pipeline parameter of the create_pipeline() method to the corresponding production line name. Below is a list of each production line's corresponding parameter name and detailed usage explanation:

Production Line Name Corresponding Parameter Detailed Explanation Document Scene Information Extraction v3 PP-ChatOCRv3-doc Document Scene Information Extraction v3 Python Script Instructions General Image Classification image_classification General Image Classification Python Script Instructions General Object Detection object_detection General Object Detection Python Script Instructions General Instance Segmentation instance_segmentation General Instance Segmentation Python Script Instructions General Semantic Segmentation semantic_segmentation General Semantic Segmentation Python Script Instructions Image Multi-label Classification multi_label_image_classification Image Multi-label Classification Python Script Instructions Small Object Detection small_object_detection Small Object Detection Python Script Instructions Image Anomaly Detection anomaly_detection Image Anomaly Detection Python Script Instructions General OCR OCR General OCR Python Script Instructions General Table Recognition table_recognition General Table Recognition Python Script Instructions General Layout Parsing layout_parsing General Layout Parsing Python Script Instructions Formula Recognition formula_recognition Formula Recognition Python Script Instructions Seal Text Recognition seal_recognition Seal Text Recognition Python Script Instructions Time Series Forecasting ts_fc Time Series Forecasting Python Script Instructions Time Series Anomaly Detection ts_ad Time Series Anomaly Detection Python Script Instructions Time Series Classification ts_cls Time Series Classification Python Script Instructions"},{"location":"en/data_annotations/cv_modules/image_classification.html","title":"PaddleX Image Classification Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for image classification related single models. Click on the above link to refer to the homepage documentation for installing the data annotation tool and viewing detailed usage procedures.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical interface. It can be used for tasks such as image classification, object detection, and image segmentation. In instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_classification.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt for the dataset to be annotated in the pets folder, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat and dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_classification.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py script to convert the annotated dataset to the ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the path to the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_classification.html#2-data-format","title":"2. Data Format","text":"
  • The dataset defined by PaddleX for image classification tasks is named ClsDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot```bash\nclassname1\nclassname2\nclassname3\n...\n
Modified label.txt:

```bash 0 classname1 1 classname2 2 classname3 ...

"},{"location":"en/data_annotations/cv_modules/image_feature.html","title":"PaddleX Image Feature Task Module Data Annotation Tutorial","text":"

This section will introduce how to use the Labelme annotation tool to complete data annotation for image feature-related single models. Click the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. In image feature annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt in the pets folder for the dataset to be annotated, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat-dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_feature.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select the save path upon the first save. If autosave is enabled, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py to convert the annotated dataset to ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_feature.html#134-data-format-conversion","title":"1.3.4 Data Format Conversion","text":"

After obtaining data in LabelMe format, the data format needs to be converted to ShiTuRecDataset format. Below is a code example that demonstrates how to convert the data labeled using LabelMe according to the previous tutorial.

# Download and unzip the LabelMe format example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n# Convert the LabelMe example dataset\npython main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#3-data-format","title":"3. Data Format","text":"

The dataset defined by PaddleX for image classification tasks is named ShiTuRecDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but should correspond to the content of train.txt, query.txt, gallery.txt\n\u251c\u2500\u2500 gallery.txt   # Annotation file for the gallery set, the file name cannot be changed. Each line gives the path of the image to be retrieved and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_2_side.jpg 3997\n\u2514\u2500\u2500 query.txt     # Annotation file for the query set, the file name cannot be changed. Each line gives the path of the database image and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_1_front.jpg 3997\n

The annotation files use an image feature format. Please refer to the above specifications to prepare your data. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html","title":"PaddleX Instance Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to instance segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is a fruit instance segmentation dataset, covering five different types of fruits, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as fruit.
  • Create an images directory (must be named images) within fruit and store the images to be annotated in the images directory, as shown below:
  • Create a category label file label.txt in the fruit folder for the dataset to be annotated, and write the categories of the dataset to be annotated into label.txt by line. Taking the fruit instance segmentation dataset's label.txt as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/fruit\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* labels is the path to the category labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting labelme, it will look like this:

* Click Edit to select the annotation type, choose Create Polygons. * Create polygons on the image to outline the boundaries of the segmentation areas.

* Click again to select the category of the segmentation area.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

  • Then click Next Image to annotate the next image.

* The final annotated label file will look like this.

  • Adjusting Directory Structure to Obtain a Standard labelme Format Dataset for Fruit Instance Segmentation

  • Prepare the train_anno_list.txt and val_anno_list.txt text files in the root directory of your dataset. Populate these files with the paths of all json files in the annotations directory, distributing them into train_anno_list.txt and val_anno_list.txt at a specified ratio. Alternatively, you can include all paths in train_anno_list.txt and create an empty val_anno_list.txt file, intending to use a zero-code data splitting feature for re-partitioning upon upload. The specific format for filling train_anno_list.txt and val_anno_list.txt is illustrated as follows:

  • The final directory structure after organization should resemble the following:

  • Compress the fruit directory into a .tar or .zip format archive to obtain the standard labelme format dataset for fruit instance segmentation.
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named COCOInstSegDataset for instance segmentation tasks, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Training set annotation file, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Validation set annotation file, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

Annotation files adopt the COCO format. Please refer to the above specifications for data preparation. Additionally, refer to: Example Dataset.

When using PaddleX 2.x version for instance segmentation datasets, please refer to the corresponding format conversion section in Instance Segmentation Module Development Tutorial to convert VOC format datasets to COCO datasets. (Note in module development documentation)

Note:

  • Instance segmentation data requires the use of the COCO data format to annotate the pixel boundaries and categories of each target area in each image in the dataset. The polygon boundaries (segmentation) of objects are represented as [x1,y1,x2,y2,...,xn,yn], where (xn,yn) denotes the coordinates of each corner point of the polygon. Annotation information is stored in json files under the annotations directory, with separate files for the training set (instance_train.json) and validation set (instance_val.json).
  • If you have a batch of unlabeled data, we recommend using LabelMe for data annotation. PaddleX Pipelines support data format conversion for datasets annotated with LabelMe.
  • To ensure successful format conversion, please strictly follow the file naming and organization of the example dataset: LabelMe Example Dataset.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html","title":"PaddleX Multi-Label Classification Task Data Annotation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for multi-label classification tasks with a single model. Click on the above links to install the annotation tools and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is manually collected, covering two categories: safety helmets and human heads, with photos taken from different angles. Image examples:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for image classification, object detection, image segmentation, and other tasks. In object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated into label.txt by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After labeling, click Save. (If the output field is not specified when starting Labelme, it will prompt you to select a save path the first time you save. If the autosave field is used for automatic saving, there is no need to click the Save button).

* Then click Next Image to label the next image.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • It can also be installed with pip in one step
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in the browser after starting. Next, you can start the annotation process based on the task.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#32-annotation-process-with-paddlelabel","title":"3.2 Annotation Process with PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and click on Object Detection.

* Fill in the project name and dataset path. Note that the path is the absolute path on the local machine. Click Create after completion.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding id. Click Add Category to create the required category names. * Start annotating * Select the label you want to annotate with. * Click the rectangular selection button on the left. * Draw a bounding box around the desired region in the image, ensuring semantic partitioning. If there are multiple columns, annotate each separately. * After completing the annotation, the result will appear in the lower-right corner. Check if the annotation is correct. * Once done, click Project Overview.

  • Export Annotated Files

  • In the Project Overview, segment the dataset as needed and click \"Export Dataset\".

  • Fill in the export path and format. The export path should be an absolute path, and the format should be coco.

  • After successful export, the annotated files will be available in the specified path.

  • Adjust directories to obtain COCO-formatted dataset for helmet detection

  • Rename the three json files and the image directory as follows:

Original File/Directory Name Renamed File/Directory Name train.json instance_train.json

|val.json|instance_val.json|

|test.json|instance_test.json| |image|images|

  • Create an annotations directory in the root of the dataset and move all json files into it. The final dataset structure should look like this:

  • Compress the helmet directory into a .tar or .zip file to obtain the COCO-formatted dataset for helmet detection.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#4-image-multi-label-classification-data-format-conversion","title":"4. Image Multi-Label Classification Data Format Conversion","text":"

After obtaining data in COCO format, you need to convert the data format to MLClsDataset format. Below is a code example that follows the previous tutorial to use LabelMe or PaddleLabel annotated data and perform data format conversion:

# Download and unzip the COCO example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n# Convert the COCO example dataset to MLClsDataset\npython main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#5-data-format","title":"5. Data Format","text":"

The dataset defined by PaddleX for image multi-label classification tasks is named MLClsDataset, with the following directory structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot be changed. Each line gives the category ID and category name, for example: 45 wallflower\n\u251c\u2500\u2500 train.txt  # Annotation file for the training set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0041_2456602544.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n\u2514\u2500\u2500 val.txt    # Annotation file for the validation set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0045_845243484.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n

The annotation files use the multi-label classification format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/object_detection.html","title":"PaddleX Object Detection Task Data Preparation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for single-model object detection tasks. Click the above links to install the annotation tools and view detailed usage instructions.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/object_detection.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated, line by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After annotation, click Save. (If output is not specified when starting Labelme, it will prompt to select a save path upon the first save. If autosave is enabled, no need to click Save.)

* Click Next Image to annotate the next.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/object_detection.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • Alternatively, you can install it with pip in one command:
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in your browser after startup. You can then proceed with the annotation process based on your task.
"},{"location":"en/data_annotations/cv_modules/object_detection.html#32-annotation-process-of-paddlelabel","title":"3.2 Annotation Process of PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and then click on Object Detection.

* Fill in the project name and dataset path. Note that the path should be an absolute path on your local machine. Click Create when done.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding ID. Click Add Category to create the required category names. * Start Annotating * First, select the label you need to annotate. * Click the rectangular selection button on the left. * Draw a bounding box around the desired area in the image, paying attention to semantic partitioning. If there are multiple columns, please annotate each separately. * After completing the annotation, the annotation result will appear in the lower right corner. You can check if the annotation is correct. * When all annotations are complete, click Project Overview.

* Export Annotation Files * In Project Overview, divide the dataset as needed, then click Export Dataset.

* Fill in the export path and export format. The export path should also be an absolute path, and the export format should be selected as coco.

* After successful export, you can obtain the annotation files in the specified path.

* Adjust the directory to obtain the standard coco format dataset for helmet detection * Rename the three json files and the image directory according to the following correspondence:

Original File (Directory) Name Renamed File (Directory) Name train.json instance_train.json val.json instance_val.json test.json instance_test.json image images
  • Create an annotations directory in the root directory of the dataset and move all json files to the annotations directory. The final dataset directory structure will look like this:

* Compress the helmet directory into a .tar or .zip format compressed package to obtain the standard coco format dataset for helmet detection.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#4-data-format","title":"4. Data Format","text":"

The dataset defined by PaddleX for object detection tasks is named COCODetDataset, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Annotation file for the training set, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Annotation file for the validation set, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

The annotation files use the COCO format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html","title":"PaddleX Semantic Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to semantic segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":"

This dataset is a manually collected street scene dataset, covering two categories of vehicles and roads, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is an image annotation software written in python with a graphical interface. It can be used for tasks such as image classification, object detection, and semantic segmentation. In semantic segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as seg_dataset
  • Create an images directory within seg_dataset (the directory name can be modified, but ensure the subsequent command's image directory name is correct), and store the images to be annotated in the images directory, as shown below:
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#232-launch-labelme","title":"2.3.2 Launch Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and launch the labelme annotation tool.

# Windows\ncd C:\\path\\to\\seg_dataset\n# Mac/Linux\ncd path/to/seg_dataset\n
labelme images --nodata --autosave --output annotations\n
* nodata stops storing image data in the JSON file * autosave enables automatic saving * output specifies the path for storing label files

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#233-start-image-annotation","title":"2.3.3 Start Image Annotation","text":"
  • After launching labelme, it will look like this:

* Click \"Edit\" to select the annotation type

* Choose to create polygons

* Draw the target contour on the image

  • When the contour line is closed as shown in the left image below, a category selection box will pop up, allowing you to input or select the target category

Typically, only the foreground objects need to be labeled with their respective categories, while other pixels are automatically considered as background. If manual background labeling is required, the category must be set to background, otherwise errors may occur during dataset format conversion. For noisy parts or irrelevant sections in the image that should not participate in model training, the ignore class can be used, and the model will automatically skip those parts during training. For objects with holes, after outlining the main object, draw polygons along the edges of the holes and assign a specific category to the holes. If the hole represents background, assign it as background. An example is shown below:

  • After labeling, click \"Save\". (If the output field is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is enabled, the save button is not required.)

* Then click \"Next Image\" to proceed to the next image for labeling.

  • The final labeled file will look like this:

  • Adjust the directory structure to obtain a standard LabelMe format dataset for safety helmet detection: a. Download and execute the directory organization script in the root directory of your dataset, seg_dataset. After executing the script, the train_anno_list.txt and val_anno_list.txt files will contain content as shown:

    python format_seg_labelme_dataset.py\n
    b. The final directory structure after organization will look like this:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with LabelMe, the data format needs to be converted to the Seg data format. Below is a code example for converting data labeled using LabelMe according to the above tutorial.

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n\npython main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#data-format","title":"Data Format","text":"

The dataset defined by PaddleX for image segmentation tasks is named SegDataset, with the following organizational structure and annotation format:

dataset_dir         # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations     # Directory for storing annotated images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 images          # Directory for storing original images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 train.txt       # Annotation file for the training set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/P0005.jpg annotations/P0005.png\n\u2514\u2500\u2500 val.txt         # Annotation file for the validation set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/N0139.jpg annotations/N0139.png\n
Label images should be single-channel grayscale or single-channel pseudo-color images, and it is recommended to save them in PNG format. Each pixel value in the label image represents a category, and the categories should start from 0 and increase sequentially, for example, 0, 1, 2, 3 represent 4 categories. The pixel storage of the label image is 8bit, so a maximum of 256 categories are supported for labeling.

Please prepare your data according to the above specifications. Additionally, you can refer to: Example Dataset

"},{"location":"en/data_annotations/ocr_modules/table_recognition.html","title":"PaddleX Table Structure Recognition Task Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/table_recognition.html#1-data-annotation","title":"1. Data Annotation","text":"

For annotating table data, use the PPOCRLabelv2 tool. Detailed steps can be found in: \u3010Video Demonstration\u3011

Table annotation focuses on structured extraction of table data, converting tables in images into Excel format. Therefore, annotation requires the use of an external software to open Excel simultaneously. In PPOCRLabel, complete the annotation of text information within the table (text and position), and in the Excel file, complete the annotation of table structure information. The recommended steps are:

  1. Table Recognition: Open the table image, click the Table Recognition button in the upper right corner of the software. The software will call the table recognition model in PP-Structure to automatically label the table, and simultaneously open an Excel file.
  2. Modify Annotation Results: Add annotation boxes with each cell as the unit (i.e., all text within a cell is marked as one box). Right-click on the annotation box and select Cell Re-recognition to automatically recognize the text within the cell using the model.
  3. Adjust Cell Order: Click View - Show Box Number to display the annotation box numbers. Drag all results under the Recognition Results column on the right side of the software interface to arrange the annotation box numbers in order from left to right and top to bottom, annotating by row.
  4. Annotate Table Structure: In an external Excel software, mark cells with text as any identifier (e.g., 1), ensuring that the cell merging in Excel matches the original image (i.e., the text in Excel cells does not need to be identical to the text in the image).
  5. Export JSON Format: Close all Excel files corresponding to the table images, click File - Export Table Annotation, and generate the gt.txt annotation file.
"},{"location":"en/data_annotations/ocr_modules/table_recognition.html#2-data-format","title":"2. Data Format","text":"

The dataset structure and annotation format defined by PaddleX for table recognition tasks are as follows:

```ruby dataset_dir # Root directory of the dataset, the directory name can be changed \u251c\u2500\u2500 images # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt \u251c\u2500\u2500 train.txt # Training set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"\u3001\", \"\u200b\u81ea\u200b\", \"\u200b\u6211\u200b\"], \"bbox\": [[[5, 2], [231, 2], [231, 35], [5, 35]]]}, {\"tokens\": [\"9\"], \"bbox\": [[[168, 68], [231, 68], [231, 98], [168, 98]]]}]}, \"gt\": \"\u3001\u200b\u81ea\u6211\u200bAghas\u200b\u5931\u5434\u200b\u6708\u200b\uff0clonwyCau9\"} \u2514\u2500\u2500 val.txt # Validation set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/no_border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"a"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html","title":"PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#2-ppocrlabel-annotation","title":"2. PPOCRLabel Annotation","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#21-introduction-to-ppocrlabel-annotation-tool","title":"2.1 Introduction to PPOCRLabel Annotation Tool","text":"

PPOCRLabel is a semi-automatic graphical annotation tool tailored for OCR tasks, featuring automatic annotation and re-recognition of data using the built-in PP-OCR model. Written in Python3 and PyQT5, it supports rectangular box annotation, table annotation, irregular text annotation, and key information annotation modes. In OCR annotation tasks, labels are stored as txt files.

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#22-installation-and-running-ppocrlabel","title":"2.2 Installation and Running PPOCRLabel","text":"

PPOCRLabel can be launched through whl packages or Python scripts. The whl package method is more convenient, and only this method is provided here:

  • For Windows:
    pip install PPOCRLabel  # Installation\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n

[!NOTE] Installing PPOCRLabel via whl packages will automatically download the paddleocr whl package. The shapely dependency may encounter a \"[winRrror 126] The specified module could not be found.\" error. It is recommended to download and install the shapely installation package separately.

  • For MacOS:
    pip3 install PPOCRLabel\npip3 install opencv-contrib-python-headless==4.2.0.32 # Add \"-i https://mirror.baidu.com/pypi/simple\" for faster downloads\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n
"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#23-annotation-process-for-text-detection-and-text-recognition","title":"2.3 Annotation Process for Text Detection and Text Recognition","text":"
  1. Installation and Running: Use the above commands to install and run the program.
  2. Open Folder: Click \"File\" - \"Open Directory\" to select the folder containing images to be annotated.

3. Auto Annotation: Click \"Auto Annotation\" to use the PP-OCR ultra-lightweight model to automatically annotate images with a file status of \"X\".

4. Manual Annotation: Click \"Rectangle Annotation\" (recommended to press \"W\" directly in English mode), and users can manually draw bounding boxes for parts undetected by the model in the current image. Press \"Q\" on the keyboard to use the four-point annotation mode (or click \"Edit\" - \"Four-point Annotation\"), and users click 4 points in sequence, double-clicking the left mouse button to indicate completion. 5. After drawing the bounding box, click \"Confirm\", and the detection box will be pre-assigned a \"To Be Recognized\" label. 6. Re-Recognition: After drawing/adjusting all detection boxes in the image, click \"Re-Recognition\", and the PP-OCR model will re-recognize all detection boxes in the current image.

7. Content Modification: Click on the recognition result to manually modify inaccurate recognition results. 8. Confirm Annotation: Click \"Confirm\", the image status changes to \"\u221a\", and proceed to the next image. 9. Deletion: Click \"Delete Image\", and the image will be deleted to the Recycle Bin. 10. Export Results: Users can manually export results through \"File - Export Annotation Results\" or enable automatic export by clicking \"File - Auto Export Annotation Results\". Manually confirmed annotations will be stored in Label.txt under the opened image folder. Clicking \"File - Export Recognition Results\" in the menu bar will save the recognition training data of such images in the crop_img folder, and the recognition labels will be saved in rec_gt.txt.

Notes:

  • PPOCRLabel uses folders as the basic unit for labeling. After opening the folder containing images to be labeled, the images will not be displayed in the window bar. Instead, clicking \"Select Folder\" will directly import the images under the folder into the program.
  • The image status indicates whether the current image has been manually saved by the user. An \"X\" indicates it has not been manually saved, while a \"\u221a\" indicates it has. After clicking the \"Auto Label\" button, PPOCRLabel will not relabel images with a status of \"\u221a\".
  • Clicking \"Re-recognize\" will overwrite the recognition results in the image. Therefore, if manual changes have been made to the recognition results before this, they may be altered after re-recognition.
  • Files generated by PPOCRLabel are placed in the folder containing the labeled images, including the following types. Do not manually modify their contents as it may cause program exceptions.
File Name Description Label.txt Detection labels, which can be directly used for PPOCR detection model training. The program automatically writes to this file every 5 confirmed detection results, or when the application is closed or the file path is changed. fileState.txt Image status marker file, which saves the names of images in the current folder that have been manually confirmed by the user. Cache.cach Cache file, which saves the results of automatic recognition by the model. rec_gt.txt Recognition labels. Can be directly used for PPOCR recognition model training. Generated by manually clicking \"Export Recognition Results\" in the menu bar. crop_img Recognition data. Images cropped according to the detection boxes. Generated simultaneously with rec_gt.txt.

If data partitioning is required, follow these steps:

cd ./PPOCRLabel # Switch to the PPOCRLabel folder\npython gen_ocr_train_val_test.py --trainValTestRatio 7:3:0 --datasetRootPath ../train_data\n
* trainValTestRatio is the ratio for dividing images into training, validation, and test sets. Set it according to your needs. The default is 6:2:2. * datasetRootPath is the full path to the dataset labeled by PPOCRLabel. The default path is PaddleOCR/train_data. Before partitioning the dataset, the structure should be as follows:

|-train_data\n  |-crop_img\n    |- word_001_crop_0.png\n    |- word_002_crop_0.jpg\n    |- word_003_crop_0.jpg\n    | ...\n  | Label.txt\n  | rec_gt.txt\n  |- word_001.png\n  |- word_002.jpg\n  |- word_003.jpg\n  | ...\n
For more tool usage instructions, please refer to Detailed Instructions

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named TextDetDataset specifically for text detection tasks. The organized and annotated data should follow the following file organization and naming conventions:

dataset_dir     # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images      # Directory to store images, the directory name can be changed but should correspond to the content in train.txt and val.txt\n\u251c\u2500\u2500 train.txt   # Annotation file for the training set, the file name cannot be changed. Example content: images/img_0.jpg \\t [{\"transcription\": \"MASA\", \"points\": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]\n\u2514\u2500\u2500 val.txt     # Annotation file for the validation set, the file name cannot be changed. Example content: images/img_61.jpg \\t [{\"transcription\": \"TEXT\", \"points\": [[31, 10], [310, 140], [420, 220], [310, 170]]}, {...}]\n
Place the images in the images directory, and rename the generated Label.txt annotation file to train.txt for the training set. Similarly, rename the Label.txt annotation file for the validation set to val.txt. Both files should be placed in the dataset_dir (the name of which can be changed) directory. Note that the image paths in train.txt/val.txt should be in the format images/xxx.

Each line in the annotation files contains the path to an image and a list of dictionaries. The path and the list must be separated by a tab character \u2018\\t\u2019, not spaces.

For the list of dictionaries, the points key represents the coordinates (x, y) of the four vertices of the text box, starting from the top-left vertex and proceeding clockwise. The transcription key indicates the text within the text box. If the transcription content is \"###\", it indicates that the text box is invalid and will not be used for training. For reference, see the example dataset.

If you use PPOCRLabel to annotate your data, simply rename det_gt_train.txt in the text detection (det) directory to train.txt and det_gt_test.txt to val.txt after dividing your dataset.

"},{"location":"en/data_annotations/time_series_modules/time_series_anomaly_detection.html","title":"PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial","text":"

Time series anomaly detection is an unsupervised learning task, thus there is no need to annotate training data. The collected training samples should ideally consist solely of normal data, i.e., no anomalies (represented by 0 for no anomaly). In the training set, the label column indicating anomalies can be set to 0 or omitted entirely. For the validation set, to evaluate model accuracy, annotations are required. For points that are anomalous at a specific time, set the label for that time point to 1, and the labels for other normal time points to 0.

"},{"location":"en/data_annotations/time_series_modules/time_series_classification.html","title":"PaddleX Time Series Classification Task Data Annotation Tutorial","text":"

When annotating time series classification data, based on the collected real-world data, clearly define the classification objectives of the time series data and establish corresponding classification labels. In the csv file, set a group_id column to represent samples, where the same group_id indicates that the data points belong to the same sample. For example, in stock price prediction, labels might be \"Rise\" (0), \"Flat\" (1), or \"Fall\" (2). For a time series that exhibits an \"upward\" trend over a period, it can be considered as one sample (group), where each time point in this series shares the same group_id, and the label column is set to 0. Similarly, for a time series that exhibits a \"downward\" trend, it forms another sample (group), where each time point shares the same group_id, and the label column is set to 2. As shown in the figure below, the green box represents one sample (group_id=0) with a label of 1, while the red box represents another time series classification sample (group_id=1) with a label of 0. If there are n samples, you can set group_id=0,...,n-1; each sample has a length (time=0,...,9) of 10, and the feature dimensions (dim_0, dim_1) are 2.

"},{"location":"en/data_annotations/time_series_modules/time_series_forecasting.html","title":"PaddleX Time Series Forecasting Task Data Annotation Tutorial","text":"

Data for time series forecasting tasks does not require annotation. Simply collect real-world data and arrange it in a csv file in chronological order. During training, the data will be automatically segmented into multiple time slices to form training samples, as shown in the figure below. The historical time series data and future sequences represent the input data for training the model and its corresponding prediction targets, respectively. To ensure data quality and completeness, missing values can be filled based on expert experience or statistical methods.

"},{"location":"en/installation/installation.html","title":"PaddleX Local Installation Tutorial","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

"},{"location":"en/installation/installation.html#1-quick-installation","title":"1. Quick Installation","text":"

Welcome to PaddleX, Baidu's low-code development tool for AI. Before we dive into the local installation process, please clarify your development needs and choose the appropriate installation mode.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. Below, we introduce their respective application scenarios:

"},{"location":"en/installation/installation.html#11-wheel-package-installation-mode","title":"1.1 Wheel Package Installation Mode","text":"

If your use case for PaddleX involves model inference and integration, we recommend the more convenient and lightweight Wheel package installation mode.

After installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the PaddleX Wheel package by executing the following commands:

\u2757 Note: Please ensure that PaddlePaddle is successfully installed before proceeding to the next step.

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n
"},{"location":"en/installation/installation.html#12-plugin-installation-mode","title":"1.2 Plugin Installation Mode","text":"

If your use case for PaddleX involves custom development (e.g. retraining models, fine-tuning models, customizing model structures, customizing inference codes, etc.), we recommend the more powerful plugin installation mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration with the supported models but also conduct advanced operations such as model training for custom development.

The plugins supported by PaddleX are listed below. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection PP-ChatOCRv3-doc Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionText Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Forecasting Time Series Forecasting Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS Image Multi-Label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin you need to install is PaddleXXX, after installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the corresponding PaddleX plugin by executing the following commands:

git clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\npip install -e .\npaddlex --install PaddleXXX\n

\u2757 Note: The two installation methods are not mutually exclusive, and you can install both simultaneously.

Next, we provide detailed installation tutorials for your reference. If you are using a Linux operating system, please refer to 2. Detailed Tutorial for Installing PaddleX on Linux.

"},{"location":"en/installation/installation.html#2-detailed-tutorial-for-installing-paddlex-on-linux","title":"2. Detailed Tutorial for Installing PaddleX on Linux","text":"

When installing PaddleX on Linux, we strongly recommend using the official PaddleX Docker image. Alternatively, you can use other custom installation methods.

When using the official Docker image, PaddlePaddle, PaddleX (including the wheel package and all plugins), and the corresponding CUDA environment are already pre-installed. You can simply obtain the Docker image and start the container to begin using it.

When using custom installation methods, you need to first install the PaddlePaddle framework, then obtain the PaddleX source code, and finally choose the PaddleX installation mode.

"},{"location":"en/installation/installation.html#21-get-paddlex-based-on-docker","title":"2.1 Get PaddleX based on Docker","text":"

Using the PaddleX official Docker image, create a container called 'paddlex' and map the current working directory to the '/paddle' directory inside the container by following the command.

If your Docker version >= 19.03, please use:

# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • If you want to delve deeper into the principles or usage of Docker, please refer to the Docker Official Website or the Docker Official Tutorial.

"},{"location":"en/installation/installation.html#22-custom-installation-of-paddlex","title":"2.2 Custom Installation of PaddleX","text":"

Before installation, please ensure you have completed the local installation of PaddlePaddle by referring to the PaddlePaddle Local Installation Tutorial.

"},{"location":"en/installation/installation.html#221-obtain-paddlex-source-code","title":"2.2.1 Obtain PaddleX Source Code","text":"

Next, use the following command to obtain the latest PaddleX source code from GitHub:

git clone https://github.com/PaddlePaddle/PaddleX.git\n
If accessing GitHub is slow, you can download from Gitee instead, using the following command:

git clone https://gitee.com/paddlepaddle/PaddleX.git\n
"},{"location":"en/installation/installation.html#222-install-paddlex","title":"2.2.2 Install PaddleX","text":"

After obtaining the latest PaddleX source code, you can choose between Wheel package installation mode or plugin installation mode.

  • If you choose Wheel package installation mode, execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n
  • If you choose plugin installation mode and the plugin you need is named PaddleXXX (there can be multiple), execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX plugins\npaddlex --install PaddleXXX\n

For example, if you need to install the PaddleOCR and PaddleClas plugins, execute the following commands to install the plugins:

# Install PaddleOCR and PaddleClas plugins\npaddlex --install PaddleOCR PaddleClas\n

If you need to install all plugins, you do not need to specify the plugin names, just execute the following command:

# Install all PaddleX plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com as a clone source. You can specify the clone source using --platform.

For example, if you need to use gitee.com as the clone source to install all PaddleX plugins, just execute the following command:

# Install PaddleX plugins\npaddlex --install --platform gitee.com\n

After installation, you will see the following prompt:

All packages are installed.\n

For PaddleX installation on more hardware environments, please refer to the PaddleX Multi-hardware Usage Guide

"},{"location":"en/installation/paddlepaddle_install.html","title":"PaddlePaddle Local Installation Tutorial","text":"

When installing PaddlePaddle, you can choose to install it via Docker or pip.

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-docker","title":"Installing PaddlePaddle via Docker","text":"

If you choose to install via Docker, please refer to the following commands to use the official PaddlePaddle Docker image to create a container named paddlex and map the current working directory to the /paddle directory inside the container:

If your Docker version >= 19.03, please use:

# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\nnvidia-docker run --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • Note: For more official PaddlePaddle Docker images, please refer to the PaddlePaddle official website

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-pip","title":"Installing PaddlePaddle via pip","text":"

If you choose to install via pip, please refer to the following commands to install PaddlePaddle in your current environment using pip:

# CPU\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# GPU, this command is only suitable for machines with CUDA version 11.8\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# GPU, this command is only suitable for machines with CUDA version 12.3\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n
Note: For more PaddlePaddle Wheel versions, please refer to the PaddlePaddle official website.

For installing PaddlePaddle on other hardware, please refer to PaddleX Multi-hardware Usage Guide.

After installation, you can verify if PaddlePaddle is successfully installed using the following command:

python -c \"import paddle; print(paddle.__version__)\"\n
If the installation is successful, the following content will be output:

3.0.0-beta2\n

\u2757 Note: If you encounter any issues during the installation process, feel free to submit an issue in the Paddle repository.

"},{"location":"en/module_usage/instructions/config_parameters_common.html","title":"PaddleX Common Model Configuration File Parameter Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_common.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_common.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; Image classification, pedestrian attribute recognition, vehicle attribute recognition, document orientation classification, object detection, pedestrian detection, vehicle detection, face detection, anomaly detection, text detection, seal text detection, text recognition, table recognition, image rectification, and layout area detection do not support data format conversion; Image multi-label classification supports COCO format conversion; Image feature, semantic segmentation, and instance segmentation support LabelMe format conversion; Object detection and small object detection support VOC and LabelMe format conversion; Formula recognition supports PKL format conversion; Time series prediction, time series anomaly detection, and time series classification support xlsx and xls format conversion False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null split.gallery_percent int Sets the percentage of gallery samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and query_percent is 100; This parameter is only used in the image feature module null split.query_percent int Sets the percentage of query samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and gallery_percent is 100; This parameter is only used in the image feature module null"},{"location":"en/module_usage/instructions/config_parameters_common.html#train","title":"Train","text":"Parameter Name Data Type Description Default Value num_classes int Number of classes in the dataset; If you need to train on a private dataset, you need to set this parameter; Image rectification, text detection, seal text detection, text recognition, formula recognition, table recognition, time series prediction, time series anomaly detection, and time series classification do not support this parameter Number of classes specified in the YAML file epochs_iters int Number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Training batch size Training batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file pretrain_weight_path str Pre-trained weight path null warmup_steps int Warm-up steps Warm-up steps specified in the YAML file resume_path str Model resume path after interruption null log_interval int Training log printing interval Training log printing interval specified in the YAML file eval_interval int Model evaluation interval Model evaluation interval specified in the YAML file save_interval int Model saving interval; not supported for anomaly detection, semantic segmentation, image rectification, time series forecasting, time series anomaly detection, and time series classification Model saving interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights log_interval int Evaluation log printing interval Evaluation log printing interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_common.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html","title":"PaddleX Time Series Task Model Configuration File Parameters Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; time series prediction, anomaly detection, and classification support data conversion from xlsx and xls formats False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#common-parameters-for-time-series-tasks","title":"Common Parameters for Time Series Tasks","text":"Parameter Name Data Type Description Default Value epochs_iters int The number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Batch size Batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file time_col str Time column, set the column name of the time series dataset's time column based on your data. Time column specified in the YAML file freq str or int Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h. Frequency specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-forecasting-parameters","title":"Time Series Forecasting Parameters","text":"Parameter Name Data Type Description Default Value target_cols str Target variable column(s), set the column name(s) of the target variable(s) in the time series dataset, can be multiple, separated by commas OT input_len int For time series forecasting tasks, this parameter represents the length of historical time series input to the model; the input length should be considered in conjunction with the prediction length, generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy. 96 predict_len int The length of the future sequence that you want the model to predict; the prediction length should be considered in conjunction with the actual scenario, generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy. 96 patience int Early stopping mechanism parameter, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; a larger patience value generally results in longer training time. 10"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-anomaly-detection","title":"Time Series Anomaly Detection","text":"Parameter Name Data Type Description Default Value input_len int For time series anomaly detection tasks, this parameter represents the length of the time series input to the model, which will slice the time series according to this length to predict whether there is an anomaly in this segment of the time series; the input length should be considered in conjunction with the actual scenario. For example, an input length of 96 indicates that you want to predict whether there are anomalies in 96 time points. 96 feature_cols str Feature variables indicating variables related to whether the device is abnormal, e.g., whether the device is abnormal may be related to the heat dissipation during its operation. Set the column name(s) of the feature variable(s) based on your data, can be multiple, separated by commas. feature_0,feature_1 label_col str Represents the number indicating whether a time series point is abnormal, with 1 for abnormal points and 0 for normal points. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-classification","title":"Time Series Classification","text":"Parameter Name Data Type Description Default Value target_cols str Feature variable columns used for category discrimination. You need to set the column names of the target variables in the time series dataset based on your own data. It can be multiple, separated by commas. dim_0,dim_1,dim_2 freq str or int Frequency, which needs to be set based on your own data. Examples of time frequencies include: 1min, 5min, 1h. 1 group_id str A group ID represents a time series sample. Time series sequences with the same ID constitute a sample. Set the column name of the specified group ID based on your own data, e.g., group_id. group_id static_cov_cols str Represents the category number column of the time series. The labels of the same sample are the same. Set the column name of the category based on your own data, e.g., label. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/model_python_API.html","title":"PaddleX Single Model Python Usage Instructions","text":"

Before using Python scripts for single model quick inference, please ensure you have completed the installation of PaddleX following the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/instructions/model_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification model as an example, the usage is as follows:

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, just three steps:

  • Call the create_model() method to instantiate the prediction model object;
  • Call the predict() method of the prediction model object to perform inference prediction;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/module_usage/instructions/model_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/module_usage/instructions/model_python_API.html#1-instantiate-the-prediction-model-object-by-calling-the-create_model-method","title":"1. Instantiate the Prediction Model Object by Calling the create_model() Method","text":"
  • create_model: Instantiate the prediction model object;
  • Parameters:
    • model_name: str type, model name or local inference model file path, such as \"PP-LCNet_x1_0\", \"/path/to/PP-LCNet_x1_0_infer/\";
    • device: str type, used to set the model inference device, such as \"cpu\", \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/module_usage/instructions/model_python_API.html#2-perform-inference-prediction-by-calling-the-predict-method-of-the-prediction-model-object","title":"2. Perform Inference Prediction by Calling the predict() Method of the Prediction Model Object","text":"
  • predict: Use the defined prediction model to predict the input data;
  • Parameters:
    • input: Any type, supports str type representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV models, supports numpy.ndarray representing image data; for TS models, supports pandas.DataFrame type data; also supports list types composed of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/module_usage/instructions/model_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/module_usage/instructions/model_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes_1","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html","title":"Unsupervised Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#i-overview","title":"I. Overview","text":"

Unsupervised anomaly detection is a technology that automatically identifies and detects anomalies or rare samples that are significantly different from the majority of data in a dataset, without labels or with a small amount of labeled data. This technology is widely used in many fields such as industrial manufacturing quality control and medical diagnosis.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link ROCAUC\uff08Avg\uff09 Model Size (M) Description STFPMInference Model/Trained Model 0.962 22.5 An unsupervised anomaly detection algorithm based on representation consists of a pre-trained teacher network and a student network with the same structure. The student network detects anomalies by matching its own features with the corresponding features in the teacher network.

The above model accuracy indicators are measured from the MVTec_AD dataset.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the unsupervised anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the unsupervised anomaly detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"STFPM\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"uad_grid.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better unsupervised anomaly detection models. Before using PaddleX to develop unsupervised anomaly detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mvtec_examples.tar -P ./dataset\ntar -xf ./dataset/mvtec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"train_samples\": 264,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"val_samples\": 57,\n    \"num_classes\": 231\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mvtec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 264;
  • attributes.val_samples: The number of validation samples in this dataset is 57;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of STFPM as an example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is STFPM.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's STFPM.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"uad_grid.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is STFPM.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The unsupervised anomaly detection module can be integrated into PaddleX pipelines such as Image_anomaly_detection. Simply replace the model path to update the unsupervised anomaly detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the unsupervised anomaly detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html","title":"Face Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#i-overview","title":"I. Overview","text":"

Face detection is a fundamental task in object detection, aiming to automatically identify and locate the position and size of faces in input images. It serves as the prerequisite and foundation for subsequent tasks such as face recognition and face analysis. Face detection accomplishes this by constructing deep neural network models that learn the feature representations of faces, enabling efficient and accurate face detection.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 An improved model of BlazeFace, incorporating FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face Detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face Detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the face detection module. You can switch models under this module freely, and you can also integrate the model inference of the face detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet_LCNet_x2_5_face\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_detection.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better face detection models. Before using PaddleX to develop face detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerface_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerface_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_849.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_Parade_0_904.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_799.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_384.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_538.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_429.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerface_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1;
  • attributes.train_samples: The number of training samples in this dataset is 500;
  • attributes.val_samples: The number of validation samples in this dataset is 100;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Face detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet_LCNet_x2_5_face as an example:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet_LCNet_x2_5_face.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet_LCNet_x2_5_face.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_detection.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet_LCNet_x2_5_face.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The face detection module can be integrated into PaddleX pipelines such as Face Recognition. Simply replace the model path to update the face detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the face detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html","title":"Face Feature Module Usage Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#i-overview","title":"I. Overview","text":"

Face feature models typically take standardized face images processed through detection, extraction, and keypoint correction as input. These models extract highly discriminative facial features from these images for subsequent modules, such as face matching and verification tasks.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"\ud83d\udc49Details of Model List ModelModel Download Link Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face feature model trained on MobileFaceNet with MS1Mv3 dataset ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face feature model trained on ResNet50 with MS1Mv3 dataset

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Tutorial

After installing the whl package, a few lines of code can complete the inference of the face feature module. You can switch models under this module freely, and you can also integrate the model inference of the face feature module into your project. Before running the following code, please download the example image to your local machine.

from paddlex import create_model\n\nmodel_name = \"MobileFaceNet\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_recognition_001.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n

For more information on using the PaddleX single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better face feature models. Before developing face feature models with PaddleX, ensure you have installed the PaddleX PaddleClas plugin. The installation process can be found in the PaddleX Local Installation Tutorial

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the official demo data. If you wish to use a private dataset for subsequent model training, the training dataset for the face feature module is organized in a general image classification dataset format. You can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial. If you wish to use a private dataset for subsequent model evaluation, note that the validation dataset format for the face feature module differs from the training dataset format. Please refer to Section 4.1.4 Data Organization Face Feature Module

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_rec_examples.tar -P ./dataset\ntar -xf ./dataset/face_rec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_label_file\": \"../../dataset/face_rec_examples/train/label.txt\",\n    \"train_num_classes\": 995,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/01378592.jpg\",\n      \"check_dataset/demo_img/04331410.jpg\",\n      \"check_dataset/demo_img/03485713.jpg\",\n      \"check_dataset/demo_img/02382123.jpg\",\n      \"check_dataset/demo_img/01722397.jpg\",\n      \"check_dataset/demo_img/02682349.jpg\",\n      \"check_dataset/demo_img/00272794.jpg\",\n      \"check_dataset/demo_img/03151987.jpg\",\n      \"check_dataset/demo_img/01725764.jpg\",\n      \"check_dataset/demo_img/02580369.jpg\"\n    ],\n    \"val_label_file\": \"../../dataset/face_rec_examples/val/pair_label.txt\",\n    \"val_num_classes\": 2,\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/Don_Carcieri_0001.jpg\",\n      \"check_dataset/demo_img/Eric_Fehr_0001.jpg\",\n      \"check_dataset/demo_img/Harry_Kalas_0001.jpg\",\n      \"check_dataset/demo_img/Francis_Ford_Coppola_0001.jpg\",\n      \"check_dataset/demo_img/Amer_al-Saadi_0001.jpg\",\n      \"check_dataset/demo_img/Sergei_Ivanov_0001.jpg\",\n      \"check_dataset/demo_img/Erin_Runnion_0003.jpg\",\n      \"check_dataset/demo_img/Bill_Stapleton_0001.jpg\",\n      \"check_dataset/demo_img/Daniel_Bruehl_0001.jpg\",\n      \"check_dataset/demo_img/Clare_Short_0004.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/face_rec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_num_classes: The number of classes in this training dataset is 995;
  • attributes.val_num_classes: The number of classes in this validation dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 1000;
  • attributes.val_samples: The number of validation samples in this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or adding hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

The face feature module does not support data format conversion or dataset splitting.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#414-data-organization-for-face-feature-module","title":"4.1.4 Data Organization for Face Feature Module","text":"

The format of the validation dataset for the face feature module differs from the training dataset. If you need to evaluate model accuracy on private data, please organize your dataset as follows:

face_rec_dataroot      # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 train              # Directory for saving the training dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500label.txt       # Training set annotation file, the file name cannot be changed. Each line gives the relative path of the image to `train` and the face image class (face identity) id, separated by a space. Example content: images/image_06765.jpg 0\n\u251c\u2500\u2500 val                # Directory for saving the validation dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in pair_label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500 pair_label.txt  # Validation dataset annotation file, the file name cannot be changed. Each line gives the paths of two images to be compared and a 0 or 1 label indicating whether the pair of images belong to the same person, separated by spaces.\n

Example content of the validation set annotation file pair_label.txt:

# Face image 1.jpg Face image 2.jpg Label (0 indicates the two face images do not belong to the same person, 1 indicates they do)\nimages/Angela_Merkel_0001.jpg images/Angela_Merkel_0002.jpg 1\nimages/Bruce_Gebhardt_0001.jpg images/Masao_Azuma_0001.jpg 0\nimages/Francis_Ford_Coppola_0001.jpg images/Francis_Ford_Coppola_0002.jpg 1\nimages/Jason_Kidd_0006.jpg images/Jason_Kidd_0008.jpg 1\nimages/Miyako_Miyazaki_0002.jpg images/Munir_Akram_0002.jpg 0\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here is an example of training MobileFaceNet:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file for the model (here it is MobileFaceNet.yaml)
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or by appending parameters in the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • When training other models, specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU). After completing model training, all outputs are saved in the specified output directory (default is ./output/). Typically, the following outputs are included:
  • train_result.json: A file that records the training results, indicating whether the training task was successfully completed, and includes metrics, paths to related files, etc.
  • train.log: A log file that records changes in model metrics, loss variations, and other details during the training process.
  • config.yaml: A configuration file that logs the hyperparameter settings for the current training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Files related to model weights, including network parameters, optimizer, EMA (Exponential Moving Average), static graph network parameters, and static graph network structure.
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/face_detection/MobileFaceNet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `MobileFaceNet.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to [PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand) During model evaluation, the path to the model weights file needs to be specified. Each configuration file has a default weight save path built in. If you need to change it, you can set it by appending a command line parameter, such as `-o Evaluate.weight_path=\"./output/best_model/best_model/model.pdparams\"`. After completing the model evaluation, an `evaluate_result.json` file will be produced, which records the evaluation results. Specifically, it records whether the evaluation task was completed normally and the model's evaluation metrics, including Accuracy. ### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be implemented through two methods: command line and wheel package. #### 4.4.1 Model Inference * To perform inference predictions through the command line, you only need the following command. Before running the following code, please download the [example image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/face_recognition_001.jpg) to your local machine.
python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the path to the model's `.yaml` configuration file (here it is `MobileFaceNet.yaml`) * Specify the mode as model inference prediction: `-o Global.mode=predict` * Specify the path to the model weights: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the path to the input data: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.md). #### 4.4.2 Model Integration The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The face feature module can be integrated into the PaddleX pipeline for [Face Recognition](../../../pipeline_usage/tutorials/face_recognition_pipelines/face_recognition.en.md). You only need to replace the model path to update the face feature module of the relevant pipeline. In pipeline integration, you can use high-performance deployment and service-oriented deployment to deploy the model you obtained. 2. Module Integration The weights you produced can be directly integrated into the face feature module. You can refer to the Python example code in [Quick Integration](#III.-Quick-Integration) and only need to replace the model with the path to the model you trained."},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html","title":"Human Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#i-overview","title":"I. Overview","text":"

Human detection is a subtask of object detection, which utilizes computer vision technology to identify the presence of pedestrians in images or videos and provide the specific location information for each pedestrian. This information is crucial for various applications such as intelligent video surveillance, human behavior analysis, autonomous driving, and intelligent robots.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Human detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The evaluation set for the above accuracy metrics is CrowdHuman dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform human detection with just a few lines of code. You can easily switch between models in this module and integrate the human detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_human\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"human_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better human detection models. Before using PaddleX to develop human detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerperson_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerperson_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000041.jpg\",\n      \"check_dataset/demo_img/000042.jpg\",\n      \"check_dataset/demo_img/000044.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/001138.jpg\",\n      \"check_dataset/demo_img/001140.jpg\",\n      \"check_dataset/demo_img/001141.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerperson_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Human detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE-S_human as an example:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE-S_human.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE-S_human.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer toPaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"human_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-YOLOE-S_human.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the human detection module. You can refer to the Python sample code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html","title":"Image Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#i-overview","title":"I. Overview","text":"

The image classification module is a crucial component in computer vision systems, responsible for categorizing input images. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. Typically, the image classification module receives an image as input and, through deep learning or other machine learning algorithms, classifies it into predefined categories based on its characteristics and content. For instance, in an animal recognition system, the image classification module might need to classify an input image as \"cat,\" \"dog,\" \"horse,\" etc. The classification results from the image classification module are then output for use by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can complete image classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the image classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better image classification models. Before using PaddleX to develop image classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset\ntar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

One command is all you need to complete data validation:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Results Details (Click to Expand)
{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"dataset/label.txt\",\n    \"num_classes\": 102,\n    \"train_samples\": 1020,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/image_01904.jpg\",\n      \"check_dataset/demo_img/image_06940.jpg\"\n    ],\n    \"val_samples\": 1020,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/image_01937.jpg\",\n      \"check_dataset/demo_img/image_06958.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/cls_flowers_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The above validation results, with check_pass being True, indicate that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 102;
  • attributes.train_samples: The number of training set samples in this dataset is 1020;
  • attributes.val_samples: The number of validation set samples in this dataset is 1020;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Image classification does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
  • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which should be an integer between 0-100, ensuring that the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters also support being set through appending command line arguments:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image classification model PP-LCNet_x1_0 as an example:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml. When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. Using PaddleX for model evaluation, a single command can complete the model evaluation:

python main.py -c  paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
Similar to model training, the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path of the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including val.top1, val.top5;

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_classification_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The image classification module can be integrated into the General Image Classification Pipeline of PaddleX. Simply replace the model path to update the image classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

2.Module Integration

The weights you produce can be directly integrated into the image classification module. You can refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html","title":"Image Feature Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#i-overview","title":"I. Overview","text":"

The image feature module is one of the important tasks in computer vision, primarily referring to the automatic extraction of useful features from image data using deep learning methods, to facilitate subsequent image retrieval tasks. The performance of this module directly affects the accuracy and efficiency of the subsequent tasks. In practical applications, image features typically output a set of feature vectors, which can effectively represent the content, structure, texture, and other information of the image, and will be passed as input to the subsequent retrieval module for processing.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_recInference Model/Trained Model 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: object detection, feature extraction, and vector retrieval. These models are part of the feature extraction module and can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_baseInference Model/Trained Model 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_largeInference Model/Trained Model 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are Recall@1 from AliProducts. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the image feature module. You can switch between models under this module freely, and you can also integrate the model inference of the image feature module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-ShiTuV2_rec\")\noutput = model.predict(\"general_image_recognition_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better image feature models. Before developing image feature models with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Feature Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/Inshop_examples.tar -P ./dataset\ntar -xf ./dataset/Inshop_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/05_1_front.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/04_2_side.jpg\",\n      \"check_dataset/demo_img/12_1_front.jpg\",\n      \"check_dataset/demo_img/07_2_side.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/01_1_front.jpg\"\n    ],\n    \"gallery_samples\": 110,\n    \"gallery_sample_paths\": [\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/01_4_full.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/03_4_full.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\",\n      \"check_dataset/demo_img/03_2_side.jpg\"\n    ],\n    \"query_samples\": 125,\n    \"query_sample_paths\": [\n      \"check_dataset/demo_img/08_7_additional.jpg\",\n      \"check_dataset/demo_img/01_7_additional.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/09_7_additional.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/02_7_additional.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/Inshop_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ShiTuRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 1000; * attributes.gallery_samples: The number of gallery (or reference) samples in this dataset is 110; * attributes.query_samples: The number of query samples in this dataset is 125; * attributes.train_sample_paths: A list of relative paths to the visual images of training samples in this dataset; * attributes.gallery_sample_paths: A list of relative paths to the visual images of gallery (or reference) samples in this dataset; * attributes.query_sample_paths: A list of relative paths to the visual images of query samples in this dataset;

Additionally, the dataset verification also analyzes the number of images and image categories within the dataset, and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is null, optional value is LabelMe;

For example, if you want to convert a LabelMe format dataset to ShiTuRecDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, the dataset will be re-split, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, the type is any integer between 0-100, and it needs to ensure that the sum of gallery_percent and query_percent values is 100;

For example, if you want to re-split the dataset with 70% training set, 20% gallery set, and 10% query set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 70\n    gallery_percent: 20\n    query_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=70 \\\n    -o CheckDataset.split.gallery_percent=20 \\\n    -o CheckDataset.split.query_percent=10\n

\u2757Note: Due to the specificity of image feature model evaluation, data partitioning is meaningful only when the train, query, and gallery sets belong to the same category system. During the evaluation of recognition models, it is imperative that the gallery and query sets belong to the same category system, which may or may not be the same as the train set. If the gallery and query sets do not belong to the same category system as the train set, the evaluation after data partitioning becomes meaningless. It is recommended to proceed with caution.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the image feature model PP-ShiTuV2_rec as an example:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

\u2757 Note: The inference result of the recognition model is a set of vectors, which requires a retrieval module to complete image feature.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image feature module can be integrated into the General Image Recognition Pipeline (comming soon) of PaddleX. Simply replace the model path to update the image feature module of the relevant pipeline. In pipeline integration, you can use service-oriented deployment to deploy your trained model.

2.Module Integration

The weights you produce can be directly integrated into the image feature module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html","title":"Image Multi-Label Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#i-overview","title":"I. Overview","text":"

The image multi-label classification module is a crucial component in computer vision systems, responsible for assigning multiple labels to input images. Unlike traditional image classification tasks that assign a single category to an image, multi-label classification tasks require assigning multiple relevant categories to an image. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The image multi-label classification module typically takes an image as input and, through deep learning or other machine learning algorithms, classifies it into multiple predefined categories based on its characteristics and content. For example, an image containing both a cat and a dog might be labeled as both \"cat\" and \"dog\" by the image multi-label classification module. These classification labels are then output for subsequent processing and analysis by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(%) Model Size (M) Description CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 325.6 M CLIP_ML is an image multi-label classification model based on CLIP, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 M PP-HGNetV2_ML is an image multi-label classification model based on PP-HGNetV2, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 M PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 M PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 M PP-LCNet_ML is an image multi-label classification model based on PP-LCNet, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. ResNet50_MLInference Model/Trained Model 83.50 108.9 M ResNet50_ML is an image multi-label classification model based on ResNet50, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder.

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete multi-label classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the multi-label classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_ML\")\noutput = model.predict(\"multilabel_classification_005.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better multi-label classification models. Before using PaddleX to develop multi-label classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Multi-Label Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mlcls_nus_examples.tar -P ./dataset\ntar -xf ./dataset/mlcls_nus_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/mlcls_nus_examples/label.txt\",\n    \"num_classes\": 33,\n    \"train_samples\": 17463,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0543_4338693.jpg\",\n      \"check_dataset/demo_img/0272_347806939.jpg\",\n      \"check_dataset/demo_img/0069_2291994812.jpg\",\n      \"check_dataset/demo_img/0012_1222850604.jpg\",\n      \"check_dataset/demo_img/0238_53773041.jpg\",\n      \"check_dataset/demo_img/0373_541261977.jpg\",\n      \"check_dataset/demo_img/0567_519506868.jpg\",\n      \"check_dataset/demo_img/0023_289621557.jpg\",\n      \"check_dataset/demo_img/0581_484524659.jpg\",\n      \"check_dataset/demo_img/0325_120753036.jpg\"\n    ],\n    \"val_samples\": 17463,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0546_130758157.jpg\",\n      \"check_dataset/demo_img/0284_2230710138.jpg\",\n      \"check_dataset/demo_img/0090_1491261559.jpg\",\n      \"check_dataset/demo_img/0013_392798436.jpg\",\n      \"check_dataset/demo_img/0246_2248376356.jpg\",\n      \"check_dataset/demo_img/0377_1349296474.jpg\",\n      \"check_dataset/demo_img/0570_2457645006.jpg\",\n      \"check_dataset/demo_img/0027_309333946.jpg\",\n      \"check_dataset/demo_img/0584_132639537.jpg\",\n      \"check_dataset/demo_img/0329_206031527.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/mlcls_nus_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 33;
  • attributes.train_samples: The number of training set samples in this dataset is 17463;
  • attributes.val_samples: The number of validation set samples in this dataset is 17463;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)(2) Dataset Splitting","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

The multi-label image classification supports the conversion of COCO format datasets to MLClsDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Multi-label image classification supports converting COCO format datasets to MLClsDataset format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with the optional value of COCO;

For example, if you want to convert a COCO format dataset to MLClsDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: COCO\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image multi-label classification model PP-LCNet_x1_0_ML as an example:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_ML.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"multilabel_classification_005.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image multi-label classification module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the image multi-label classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the image multi-label classification module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html","title":"Instance Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#i-overview","title":"I. Overview","text":"

The instance segmentation module is a crucial component in computer vision systems, responsible for identifying and marking pixels that contain specific object instances in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The instance segmentation module typically outputs pixel-level masks (masks) for each target instance, which are then passed as input to the object recognition module for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the instance segmentation module. You can switch models under this module freely, and you can also integrate the model inference of the instance segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"Mask-RT-DETR-L\")\noutput = model.predict(\"general_instance_segmentation_004.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better instance segmentation models. Before using PaddleX to develop instance segmentation models, please ensure that you have installed the relevant model training plugins for segmentation in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides data verification functionality for each module, and only data that passes the verification can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the officially provided demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_coco_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#412-data-verification","title":"4.1.2 Data Verification","text":"

Data verification can be completed with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 2,\n    \"train_samples\": 79,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/pexels-photo-634007.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-59576.png\"\n    ],\n    \"val_samples\": 19,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/peasant-farmer-farmer-romania-botiza-47862.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-715546.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/instance_seg_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 79;
  • attributes.val_samples: The number of validation samples in this dataset is 19;
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset; Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The instance segmentation task supports converting LabelMe format to COCO format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Below are some example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Set to True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. The available source format is LabelMe; For example, if you want to convert a LabelMe dataset to COCO format, you need to modify the configuration file as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset will be re-split. The default is False;
  • train_percent: If the dataset is to be re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After data splitting, the original annotation files will be renamed as xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete model training. Taking the training of the instance segmentation model Mask-RT-DETR-L as an example:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
The following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is Mask-RT-DETR-L.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify the first 2 GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters Instructions.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is Mask-RT-DETR-L.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_instance_segmentation_004.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's Mask-RT-DETR-L.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX Pipeline or into your own project.

1.Pipeline Integration

The instance segmentation module can be integrated into the General Instance Segmentation Pipeline of PaddleX. Simply replace the model path to update the instance segmentation module of the relevant pipeline.

2.Module Integration The weights you produce can be directly integrated into the instance segmentation module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html","title":"Mainbody detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#i-overview","title":"I. Overview","text":"

Mainbody detection is a fundamental task in object detection, aiming to identify and extract the location and size of specific target objects, people, or entities from images and videos. By constructing deep neural network models, mainbody detection learns the feature representations of image subjects to achieve efficient and accurate detection.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_detInference Model/Trained Model 41.5 62.0 33.7 537.0 27.54 A mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common subjects simultaneously.

Note: The evaluation set for the above accuracy metrics is PaddleClas mainbody detection dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform mainbody detection inference with just a few lines of code. You can easily switch between models under this module, and integrate the mainbody detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-ShiTuV2_det\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better mainbody detection models. Before developing mainbody detection models with PaddleX, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mainbody_det_examples.tar -P ./dataset\ntar -xf ./dataset/mainbody_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mainbody_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 701.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 176.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Mainbody detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-ShiTuV2_det as an example:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-ShiTuV2_det.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-ShiTuV2_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The main body detection module can be integrated into PaddleX pipelines such as General Object Detection (comming soon). Simply replace the model path to update the main body detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the main body detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html","title":"Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#i-overview","title":"I. Overview","text":"

The object detection module is a crucial component in computer vision systems, responsible for locating and marking regions containing specific objects in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The object detection module typically outputs bounding boxes for the target regions, which are then passed as input to the object recognition module for further processing.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before proceeding with quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can perform object detection inference with just a few lines of code. You can easily switch between models within the module and integrate the object detection inference into your projects. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PicoDet-S\")\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher precision from existing models, you can leverage PaddleX's custom development capabilities to develop better object detection models. Before developing object detection models with PaddleX, ensure you have installed the object detection related training plugins. For installation instructions, refer to the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, prepare the corresponding dataset for the task module. PaddleX provides a data validation feature for each module, and only datasets that pass validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Object Detection Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Validate your dataset with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\",\n      \"check_dataset/demo_img/road237.png\",\n      \"check_dataset/demo_img/road733.png\",\n      \"check_dataset/demo_img/road861.png\",\n      \"check_dataset/demo_img/road762.png\",\n      \"check_dataset/demo_img/road515.png\",\n      \"check_dataset/demo_img/road754.png\",\n      \"check_dataset/demo_img/road173.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\",\n      \"check_dataset/demo_img/road544.png\",\n      \"check_dataset/demo_img/road596.png\",\n      \"check_dataset/demo_img/road857.png\",\n      \"check_dataset/demo_img/road203.png\",\n      \"check_dataset/demo_img/road589.png\",\n      \"check_dataset/demo_img/road655.png\",\n      \"check_dataset/demo_img/road245.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 704;
  • attributes.val_samples: The number of validation samples in this dataset is 176;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes in the dataset and generates a histogram (histogram.png) for visualization:

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, dataset splitting is performed. Default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After dataset splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the object detection model PicoDet-S as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The object detection module can be integrated into the General Object Detection Pipeline of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the object detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Pedestrian attribute recognition is a crucial component in computer vision systems, responsible for locating and labeling specific attributes of pedestrians in images or videos, such as gender, age, clothing color, and type. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The pedestrian attribute recognition module typically outputs attribute information for each pedestrian, which is then passed as input to other modules (e.g., pedestrian tracking, pedestrian re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the pedestrian attribute recognition module. You can easily switch models under this module and integrate the model inference of pedestrian attribute recognition into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_pedestrian_attribute\")\noutput = model.predict(\"pedestrian_attribute_006.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

Note: The index of the output value represents the following attributes: index 0 indicates whether a hat is worn, index 1 indicates whether glasses are worn, indexes 2-7 represent the style of the upper garment, indexes 8-13 represent the style of the lower garment, index 14 indicates whether boots are worn, indexes 15-17 represent the type of bag carried, index 18 indicates whether an object is held in front, indexes 19-21 represent age, index 22 represents gender, and indexes 23-25 represent orientation. Specifically, the attributes include the following types:

- Gender: Male, Female\n- Age: Under 18, 18-60, Over 60\n- Orientation: Front, Back, Side\n- Accessories: Glasses, Hat, None\n- Holding Object in Front: Yes, No\n- Bag: Backpack, Shoulder Bag, Handbag\n- Upper Garment Style: Striped, Logo, Plaid, Patchwork\n- Lower Garment Style: Striped, Patterned\n- Short-sleeved Shirt: Yes, No\n- Long-sleeved Shirt: Yes, No\n- Long Coat: Yes, No\n- Pants: Yes, No\n- Shorts: Yes, No\n- Skirt: Yes, No\n- Boots: Yes, No\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better pedestrian attribute recognition models. Before developing pedestrian attribute recognition with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/pedestrian_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/pedestrian_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/pedestrian_attribute_examples/label.txt\",\n    \"num_classes\": 26,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/020907.jpg\",\n      \"check_dataset/demo_img/004274.jpg\",\n      \"check_dataset/demo_img/009412.jpg\",\n      \"check_dataset/demo_img/026873.jpg\",\n      \"check_dataset/demo_img/030560.jpg\",\n      \"check_dataset/demo_img/022846.jpg\",\n      \"check_dataset/demo_img/009055.jpg\",\n      \"check_dataset/demo_img/015399.jpg\",\n      \"check_dataset/demo_img/006435.jpg\",\n      \"check_dataset/demo_img/055307.jpg\"\n    ],\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/080381.jpg\",\n      \"check_dataset/demo_img/080469.jpg\",\n      \"check_dataset/demo_img/080146.jpg\",\n      \"check_dataset/demo_img/080003.jpg\",\n      \"check_dataset/demo_img/080283.jpg\",\n      \"check_dataset/demo_img/080104.jpg\",\n      \"check_dataset/demo_img/080149.jpg\",\n      \"check_dataset/demo_img/080313.jpg\",\n      \"check_dataset/demo_img/080131.jpg\",\n      \"check_dataset/demo_img/080412.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/pedestrian_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 26;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Pedestrian attribute recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command-line arguments:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Taking the training of the PP-LCNet pedestrian attribute recognition model (PP-LCNet_x1_0_pedestrian_attribute) as an example:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"pedestrian_attribute_006.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" . Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The pedestrian attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the pedestrian attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the pedestrian attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html","title":"Semantic Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#i-overview","title":"I. Overview","text":"

Semantic segmentation is a technique in computer vision that classifies each pixel in an image, dividing the image into distinct semantic regions, with each region corresponding to a specific category. This technique generates detailed segmentation maps, clearly revealing objects and their boundaries in the image, providing powerful support for image analysis and understanding.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Semantic Segmentation module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Semantic Segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LiteSeg-T\")\noutput = model.predict(\"general_semantic_segmentation_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Semantic Segmentation models. Before developing a Semantic Segmentation model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Semantic Segmentation Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset\ntar -xf ./dataset/seg_optic_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/P0005.jpg\",\n      \"check_dataset/demo_img/P0050.jpg\"\n    ],\n    \"train_samples\": 267,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/N0139.jpg\",\n      \"check_dataset/demo_img/P0137.jpg\"\n    ],\n    \"val_samples\": 76,\n    \"num_classes\": 2\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/seg_optic_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 267;
  • attributes.val_samples: The number of validation samples in this dataset is 76;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Semantic segmentation supports converting LabelMe format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting LabelMe format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null, and the supported source dataset format is LabelMe;

For example, if you want to convert a LabelMe format dataset, you can download a sample LabelMe format dataset as follows:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n

After downloading, modify the paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the semantic segmentation model (PP-LiteSeg-T) as an example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mIoU.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model\" \\\n    -o Predict.input=\"general_semantic_segmentation_002.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document semantic segmentation module can be integrated into PaddleX pipelines such as the Semantic Segmentation Pipeline (Seg). Simply replace the model path to update the The document semantic segmentation module's model.

  1. Module Integration

The weights you produce can be directly integrated into the semantic segmentation module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html","title":"Small Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#i-overview","title":"I. Overview","text":"

Small object detection typically refers to accurately detecting and locating small-sized target objects in images or videos. These objects often have a small pixel size in images, typically less than 32x32 pixels (as defined by datasets like MS COCO), and may be obscured by the background or other objects, making them difficult to observe directly by the human eye. Small object detection is an important research direction in computer vision, aiming to precisely detect small objects with minimal visual features in images.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description (VisDrone) PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 52.1 57.1 1007.0 324.93 PP-YOLOE_plus small object detection model trained on VisDrone. VisDrone is a benchmark dataset specifically for unmanned aerial vehicle (UAV) visual data, which is used for small object detection due to the small size of the targets and the inherent challenges they pose. PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 42.8 65.5 324.4 77.29 PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 65.9 458.5 11172.7 340.42

Note: The evaluation set for the above accuracy metrics is VisDrone-DET dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete the inference of the small object detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the small object detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE_plus_SOD-S\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"small_object_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better small object detection models. Before using PaddleX to develop small object detection models, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/small_det_examples.tar -P ./dataset\ntar -xf ./dataset/small_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 1610,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/9999938_00000_d_0000352.jpg\",\n      \"check_dataset/demo_img/9999941_00000_d_0000014.jpg\",\n      \"check_dataset/demo_img/9999973_00000_d_0000043.jpg\"\n    ],\n    \"val_samples\": 548,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0000330_00801_d_0000804.jpg\",\n      \"check_dataset/demo_img/0000103_00180_d_0000026.jpg\",\n      \"check_dataset/demo_img/0000291_04001_d_0000888.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/small_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 10.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 1610.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 548.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Small object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Small object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE_plus_SOD-S as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o Train.num_classes=10\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE_plus_SOD-S.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"small_object_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Explanation.
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own projects.

  1. Pipeline Integration

The small object detection module can be integrated into the Small Object Detection Pipeline of PaddleX. Simply replace the model path to update the small object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the small object detection module. You can refer to the Python example code in Quick Integration, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, license plate number, etc. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The vehicle attribute recognition module typically outputs bounding boxes (Bounding Boxes) containing vehicle attribute information, which are then passed as input to other modules (e.g., vehicle tracking, vehicle re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the vehicle attribute recognition module. You can easily switch models under this module, and you can also integrate the model inference of the vehicle attribute recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_vehicle_attribute\")\noutput = model.predict(\"vehicle_attribute_007.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

Note: In the output, values indexed from 0-9 represent color attributes, corresponding to the following colors respectively: yellow, orange, green, gray, red, blue, white, golden, brown, black. Indices 10-18 represent vehicle type attributes, corresponding to the following vehicle types: sedan, suv, van, hatchback, mpv, pickup, bus, truck, estate.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better vehicle attribute recognition models. Before using PaddleX to develop vehicle attribute recognition models, ensure you have installed the classification-related model training plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/vehicle_attribute_examples/label.txt\",\n    \"num_classes\": 19,\n    \"train_samples\": 1200,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0018_c017_00033140_0.jpg\",\n      \"check_dataset/demo_img/0010_c019_00034275_0.jpg\",\n      \"check_dataset/demo_img/0015_c019_00068660_0.jpg\",\n      \"check_dataset/demo_img/0016_c017_00049590_1.jpg\",\n      \"check_dataset/demo_img/0018_c016_00052280_0.jpg\",\n      \"check_dataset/demo_img/0023_c001_00006995_0.jpg\",\n      \"check_dataset/demo_img/0022_c004_00065910_0.jpg\",\n      \"check_dataset/demo_img/0007_c019_00048655_1.jpg\",\n      \"check_dataset/demo_img/0022_c007_00072970_0.jpg\",\n      \"check_dataset/demo_img/0022_c008_00065785_0.jpg\"\n    ],\n    \"val_samples\": 300,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0025_c003_00054095_0.jpg\",\n      \"check_dataset/demo_img/0023_c013_00006350_1.jpg\",\n      \"check_dataset/demo_img/0024_c003_00046320_0.jpg\",\n      \"check_dataset/demo_img/0025_c005_00054795_2.jpg\",\n      \"check_dataset/demo_img/0024_c012_00041770_0.jpg\",\n      \"check_dataset/demo_img/0024_c007_00060845_1.jpg\",\n      \"check_dataset/demo_img/0023_c017_00013150_0.jpg\",\n      \"check_dataset/demo_img/0024_c014_00040410_0.jpg\",\n      \"check_dataset/demo_img/0025_c002_00050685_1.jpg\",\n      \"check_dataset/demo_img/0025_c005_00032645_0.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/vehicle_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 19;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1200;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 300;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle attribute recognition does not support dataset format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Training a model can be done with a single command, taking the training of the PP-LCNet vehicle attribute recognition model (PP-LCNet_x1_0_vehicle_attribute) as an example:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_vehicle_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_attribute_007.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The vehicle attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the vehicle attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the vehicle attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html","title":"Vehicle Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#i-overview","title":"I. Overview","text":"

Vehicle detection is a subtask of object detection, specifically referring to the use of computer vision technology to determine the presence of vehicles in images or videos and provide specific location information for each vehicle (such as the coordinates of the bounding box). This information is of great significance for various fields such as intelligent transportation systems, autonomous driving, and video surveillance.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicle 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicle 63.9 32.6 775.6 196.02 Note: The evaluation set for the above accuracy metrics is PPVehicle dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision. ## III. Quick Integration > \u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the [PaddleX Local Installation Guide](../../../installation/installation.en.md) After installing the wheel package, you can complete the inference of the vehicle detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the vehicle detection module into your project. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_vehicle\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"vehicle_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the [PaddleX Single-Model Python Script Usage Instructions](../../instructions/model_python_API.en.md). ## IV. Custom Development If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better vehicle detection models. Before using PaddleX to develop vehicle detection models, please ensure that you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the [PaddleX Local Installation Guide](../../../installation/installation.en.md). ### 4.1 Data Preparation Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to [PaddleX Object Detection Task Module Data Annotation Tutorial](../../../data_annotations/cv_modules/object_detection.en.md). #### 4.1.1 Demo Data Download You can download the demo dataset to a specified folder using the following commands:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_coco_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_coco_examples.tar -C ./dataset/\n
#### 4.1.2 Data Validation You can complete data validation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message `Check dataset passed !`. The validation result file will be saved in `./output/check_dataset_result.json`, and related outputs will be saved in the `./output/check_dataset` directory of the current directory. The output directory includes visualized example images and histograms of sample distributions. \ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20011__img00001.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00005.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00009.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20032__img00401.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00405.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00409.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/vehicle_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 4.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

#### 4.1.3 Dataset Format Conversion / Dataset Splitting (Optional) After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters. \ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
### 4.2 Model Training Model training can be completed with a single command, taking the training of `PP-YOLOE-S_vehicle` as an example:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
The steps required are: * Specify the `.yaml` configuration file path for the model (here it is `PP-YOLOE-S_vehicle.yaml`,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the [PaddleX Model List (CPU/GPU)](../../../support_list/models_list.en.md)) * Specify the mode as model training: `-o Global.mode=train` * Specify the training dataset path: `-o Global.dataset_dir` Other related parameters can be set by modifying the `Global` and `Train` fields in the `.yaml` configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: `-o Global.device=gpu:0,1`; to set the number of training epochs to 10: `-o Train.epochs_iters=10`. For more modifiable parameters and their detailed explanations, refer to the [PaddleX Common Configuration Parameters for Model Tasks](../../instructions/config_parameters_common.en.md). \ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `PP-YOLOE-S_vehicle.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to[PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package. #### 4.4.1 Model Inference The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The object detection module can be integrated into the [General Object Detection Pipeline](../../../pipeline_usage/tutorials/cv_pipelines/object_detection.en.md) of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model. 2. Module Integration The weights you produced can be directly integrated into the object detection module. You can refer to the Python example code in [Quick Integration](#\u200b\u4e09\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b), simply replace the model with the path to your trained model. * To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_detection.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the `.yaml` configuration file path of the model (here it is `PP-YOLOE-S_vehicle.yaml`) * Set the mode to model inference prediction: `-o Global.mode=predict` * Specify the model weight path: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the input data path: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.en.md). #### 4.4.2 Model Integration The weights you produced can be directly integrated into the vehicle detection module. You can refer to the Python example code in [Quick Integration](#iii-quick-integration), simply replace the model with the path to your trained model."},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html","title":"Document Image Orientation Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#i-overview","title":"I. Overview","text":"

The document image orientation classification module is aim to distinguish the orientation of document images and correct them through post-processing. In processes such as document scanning and ID card photography, capturing devices are sometimes rotated to obtain clearer images, resulting in images with varying orientations. Standard OCR pipelines cannot effectively handle such data. By utilizing image classification technology, we can pre-judge the orientation of document or ID card images containing text regions and adjust their orientations, thereby enhancing the accuracy of OCR processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as IDs and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

Just a few lines of code can complete the inference of the document image orientation classification module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the document image orientation classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_doc_ori\")\noutput = model.predict(\"img_rot180_demo.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/demo.png\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better document image orientation classification models. Before developing a document image orientation classification model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Classification Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/text_image_orientation.tar -P ./dataset\ntar -xf ./dataset/text_image_orientation.tar  -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"..\\/..\\/text_image_orientation\\/label.txt\",\n    \"num_classes\": 4,\n    \"train_samples\": 1553,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_10351.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_3908.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_7712.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_7480.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot270_9599.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_10323.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4885.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_3939.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7153.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1747.jpg\"\n    ],\n    \"val_samples\": 2593,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_3190.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_10272.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_9930.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_918.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_2079.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_8574.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7595.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_1751.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1573.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4401.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/text_image_orientation\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 1552;
  • attributes.val_samples: The number of validation samples in this dataset is 2593;
  • attributes.train_sample_paths: A list of relative paths to visual sample images for the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Document image orientation classification does not currently support dataset format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the document image orientation classification model (PP-LCNet_x1_0_doc_ori) as an example:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

You need to follow these steps:

  • Specify the path to the model's .yaml configuration file (here, PP-LCNet_x1_0_doc_ori.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train.
  • Specify the training dataset path: -o Global.dataset_dir.

Other relevant parameters can be set by modifying fields under Global and Train in the .yaml configuration file, or by appending arguments to the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and detailed explanations, refer to the PaddleX General Model Configuration File Parameters.

\ud83d\udc49 More Information (click to expand)
  • During model training, PaddleX automatically saves the model weight files, defaulting to output. If you want to specify a different save path, you can set it using the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concept of dynamic graph weights and static graph weights. During model training, it produces both dynamic and static graph weights. For model inference, it defaults to using static graph weights.
  • After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which records whether the training task was completed normally, as well as the output weight metrics and related file paths.

  • train.log: Training log file, which records changes in model metrics and loss during training.
  • config.yaml: Training configuration file, which records the hyperparameter configuration for this training.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. With PaddleX, model evaluation can be done with just one command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_doc_ori.yaml).
  • Set the mode to model inference prediction: -o Global.mode=predict.
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/best_model/inference\".
  • Specify the input data path: -o Predict.input=\"...\". Other relevant parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Description.
\ud83d\udc49 More Information (click to expand)
  • When conducting model evaluation, it is necessary to specify the model weight file path. Each configuration file has a built-in default path for saving weights. If you need to change this path, you can simply append a command line argument to set it, for example: -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

  • After the model evaluation is completed, typically, the following outputs are generated:

  • Upon finishing the model evaluation, an evaluate_result.json file is produced, which records the results of the evaluation. Specifically, it logs whether the evaluation task was successfully completed and the evaluation metrics of the model, including Top1 Accuracy (Top1 Acc).

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"img_rot180_demo.jpg\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

1.Pipeline Integration

The document image classification module can be integrated into PaddleX pipelines such as the Document Scene Information Extraction Pipeline (PP-ChatOCRv3). Simply replace the model path to update the The document image classification module's model.

2.Module Integration

The weights you produce can be directly integrated into the document image orientation classification module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html","title":"Formula Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#i-overview","title":"I. Overview","text":"

The formula recognition module is a crucial component of OCR (Optical Character Recognition) systems, responsible for converting mathematical formulas in images into editable text or computer-readable formats. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The module typically outputs LaTeX or MathML codes of mathematical formulas, which are then passed on to the text understanding module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Normed Edit Distance BLEU Score ExpRate (%) Model Size (M) Description LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 89.7 M LaTeX-OCR is a formula recognition algorithm based on an autoregressive large model. By adopting Hybrid ViT as the backbone network and transformer as the decoder, it significantly improves the accuracy of formula recognition.

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, a few lines of code can complete the inference of the formula recognition module. You can switch models under this module freely, and you can also integrate the model inference of the formula recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"LaTeX_OCR_rec\")\noutput = model.predict(\"general_formula_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better formula recognition models. Before developing formula recognition models with PaddleX, ensure you have installed the PaddleOCR-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the LaTeX-OCR Formula Recognition Project.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_latexocr_dataset_example.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_latexocr_dataset_example.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 9452,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0109284.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0217434.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0166758.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0022294.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0071799.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0017043.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0026204.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0209202.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0157332.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0232582.png\"\n    ],\n    \"val_samples\": 1050,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0070221.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0157901.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0085392.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0196480.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0096180.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0136149.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0143310.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0004560.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0115191.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0015323.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_latexocr_dataset_example\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"LaTeXOCRDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 9452; * attributes.val_samples: The number of validation samples in this dataset is 1050; * attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset; * attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format ( PKL format ). The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format, default is True;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is MSTextRecDataset;

For example, if you want to convert a MSTextRecDataset format dataset to LaTeXOCRDataset format, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: MSTextRecDataset\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=MSTextRecDataset\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, dataset splitting is performed, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, which is an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% for the training set and 10% for the validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the formula recognition model LaTeX_OCR_rec as an example:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_formula_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the formula recognition module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html","title":"Layout Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#i-overview","title":"I. Overview","text":"

The core task of structure analysis is to parse and segment the content of input document images. By identifying different elements in the image (such as text, charts, images, etc.), they are classified into predefined categories (e.g., pure text area, title area, table area, image area, list area, etc.), and the position and size of these regions in the document are determined.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the structure analysis module. You can switch models under this module freely, and you can also integrate the model inference of the structure analysis module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet-L_layout_3cls\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"layout.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better structure analysis models. Before developing a structure analysis model with PaddleX, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_layout_examples.tar -P ./dataset\ntar -xf ./dataset/det_layout_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 11,\n    \"train_samples\": 90,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/train_0077.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0028.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0012.jpg\"\n    ],\n    \"val_samples\": 20,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/val_0007.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0019.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0010.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/det_layout_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 11;
  • attributes.train_samples: The number of training samples in this dataset is 90;
  • attributes.val_samples: The number of validation samples in this dataset is 20;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Layout detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet-L_layout_3cls as an example:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet-L_layout_3cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet-L_layout_3cls.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"layout.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet-L_layout_3cls.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own project. To integrate, simply add the model_dir=\"/output/best_model/inference\" parameter to the create_model(model_name=model_name, kernel_option=kernel_option) function in the quick integration method from Step 3.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into PaddleX pipelines or into your own projects.

  1. Pipeline Integration The structure analysis module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the layout area localization module. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  2. Module Integration The weights you produce can be directly integrated into the layout area localization module. You can refer to the Python example code in the Quick Integration section, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html","title":"Seal Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#i-overview","title":"I. Overview","text":"

The seal text detection module typically outputs multi-point bounding boxes around text regions, which are then passed as inputs to the distortion correction and text recognition modules for subsequent processing to identify the textual content of the seal. Recognizing seal text is an integral part of document processing and finds applications in various scenarios such as contract comparison, inventory access auditing, and invoice reimbursement verification. The seal text detection module serves as a subtask within OCR (Optical Character Recognition), responsible for locating and marking the regions containing seal text within an image. The performance of this module directly impacts the accuracy and efficiency of the entire seal text OCR system.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Hmean\uff08%\uff09 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 M The server-side seal text detection model of PP-OCRv4 boasts higher accuracy and is suitable for deployment on better-equipped servers. PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 M The mobile-side seal text detection model of PP-OCRv4, on the other hand, offers greater efficiency and is suitable for deployment on end devices.

Note: The evaluation set for the above accuracy metrics is a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Seal Text Detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Seal Text Detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_server_seal_det\")\noutput = model.predict(\"seal_text_det.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Seal Text Detection models. Before developing a Seal Text Detection model with PaddleX, ensure you have installed PaddleOCR plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Text Detection and Recognition Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_curve_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_curve_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 606,\n    \"train_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07834.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09943.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04079.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05701.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08324.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07451.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09562.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08237.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug01788.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06481.png\"\n    ],\n    \"val_samples\": 152,\n    \"val_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03724.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06456.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04029.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03603.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05454.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06269.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00624.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug02818.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00538.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04935.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/ocr_curve_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 606;
  • attributes.val_samples: The number of validation samples in this dataset is 152;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Seal text detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Seal Text Detection model (PP-OCRv4_server_seal_det) as an example:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including precision, recall and Hmean.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"seal_text_det.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_server_seal_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document Seal Text Detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text detection module of the relevant pipeline.

  1. Module Integration

The weights you produce can be directly integrated into the Seal Text Detection module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html","title":"Table Structure Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#i-overview","title":"I. Overview","text":"

Table structure recognition is a crucial component in table recognition systems, converting non-editable table images into editable table formats (e.g., HTML). The goal of table structure recognition is to identify the rows, columns, and cell positions of tables. The performance of this module directly impacts the accuracy and efficiency of the entire table recognition system. The module typically outputs HTML or LaTeX code for the table area, which is then passed to the table content recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddlePaddle Vision Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddlePaddle's Vision Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the table structure recognition module. You can easily switch models within this module and integrate the model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"SLANet\")\noutput = model.predict(\"table_recognition.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better table structure recognition models. Before developing table structure recognition models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Table Structure Recognition Task Module Data Annotation Tutorial

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/table_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/table_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 2000,\n    \"train_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_right_7384_X9UFEPKVMLALY7DDB11A.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_13708_VE2DGBD4DCQU2ITLBTEA.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_6490_14Z6ZN6G52GG4XA0K4XU.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_14236_DG96EX0EDKIIDK8P6ENG.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_19648_SV8B7X34RTYRAT2T5CPI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_7186_HODBC25HISMCSVKY0HJ9.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_5773_4K4H9OVK9X9YVHE4Y1BQ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_7760_8C62CCH5T57QUGE0NTHZ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_15707_B1YVOU3X4NHHB6TL269O.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_5223_HLG406UK35UD5EUYC2AV.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_2945_L7MSRHBZRW6Y347G39O6.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_4825_LH9WI6X104CP3VFXPSON.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_16837_79KHWU9WDM9ZQHNBGQAL.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_10107_9ENLLC29SQ6XI8WZY53E.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_16668_JIS0YFDZKTKETZIEKCKX.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_18653_J9SSKHLFTRJD4J8W17OW.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_8396_VJ3QJ3I0DP63P4JR77FE.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_9017_K2V7QBWSU2BA4R3AJSO7.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_19494_SDFMWP92NOB2OT7109FI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_288_6LK683JUCMOQ38V5BV29.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/table_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"PubTabTableRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 2000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 100;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Table structure recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the table structure recognition model SLANet as an example:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is SLANet.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc ;

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/table_recognition/SLANet.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"table_recognition.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The table structure recognition module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the table structure recognition module in the relevant pipelines. For pipeline integration, you can deploy your obtained model using high-performance inference and service-oriented deployment.

2.Module Integration

The model weights you produce can be directly integrated into the table structure recognition module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html","title":"Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#i-overview","title":"I. Overview","text":"

The text detection module is a crucial component in OCR (Optical Character Recognition) systems, responsible for locating and marking regions containing text within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text detection module typically outputs bounding boxes for text regions, which are then passed on to the text recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#ii-supported-models","title":"II. Supported Models","text":"ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

Just a few lines of code can complete the inference of the text detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_det\")\noutput = model.predict(\"general_ocr_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek even higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better text detection models. Before developing text detection models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After executing the above command, PaddleX will validate the dataset and gather basic information about it. Once the command runs successfully, Check dataset passed ! will be printed in the log. The validation result file is saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory in the current directory. The output directory includes sample images and histograms of sample distribution.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 200,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/train_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/train_img_289.jpg\"\n    ],\n    \"val_samples\": 50,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/val_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/val_img_137.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. The explanation of other metrics is as follows:

  • attributes.train_samples: The number of training samples in the dataset is 200;
  • attributes.val_samples: The number of validation samples in the dataset is 50;
  • attributes.train_sample_paths: List of relative paths for visualizing training sample images in the dataset;
  • attributes.val_sample_paths: List of relative paths for visualizing validation sample images in the dataset;

Additionally, the dataset validation also analyzed the distribution of the length and width of all images in the dataset and plotted a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Text detection does not support data format conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Below are some example explanations for the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text detection model (PP-OCRv4_mobile_det):

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (in this case, PP-OCRv4_mobile_det.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Instructions.

\ud83d\udc49 More Instructions (Click to Expand)

During model evaluation, you need to specify the path to the model weight file. Each configuration file has a built-in default weight save path. If you need to change it, you can set it by adding a command line argument, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including precision, recall, and hmean.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_mobile_det.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline, Table Recognition Pipeline, and PP-ChatOCRv3-doc. Simply replace the model path to update the text detection module of the relevant pipeline.

2.Module Integration

The model weights you produce can be directly integrated into the text detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html","title":"Text Image Unwarping Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#i-overview","title":"I. Overview","text":"

The primary purpose of Text Image Unwarping is to perform geometric transformations on images in order to correct issues such as document distortion, tilt, perspective deformation, etc., enabling more accurate recognition by subsequent text recognition modules.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link MS-SSIM \uff08%\uff09 Model Size (M) information UVDocInference Model/Trained Model 54.40 30.3 M High-precision Text Image Unwarping Model

The accuracy metrics of the above models are measured on the DocUNet benchmark dataset.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Text Image Unwarping module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Text Image Unwarping module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"UVDoc\")\noutput = model.predict(\"doc_test.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iv-custom-development","title":"IV. Custom Development","text":"

The current module temporarily does not support fine-tuning training and only supports inference integration. Fine-tuning training for this module is planned to be supported in the future.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html","title":"Text Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#i-overview","title":"I. Overview","text":"

The text recognition module is the core component of an OCR (Optical Character Recognition) system, responsible for extracting text information from text regions within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text recognition module typically receives bounding boxes of text regions output by the text detection module as input. Through complex image processing and deep learning algorithms, it converts the text in images into editable and searchable electronic text. The accuracy of text recognition results is crucial for subsequent applications such as information extraction and data mining.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 4 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the text recognition module. You can switch models under this module freely, and you can also integrate the model inference of the text recognition module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_rec\")\noutput = model.predict(\"general_ocr_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better text recognition models. Before using PaddleX to develop text recognition models, please ensure that you have installed the relevant model training plugins for OCR in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX offers Demo datasets for each module, allowing you to complete subsequent development based on the officially provided Demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can use the following commands to download the Demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 4468,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_10.png\"\n    ],\n    \"val_samples\": 2077,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_10.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 4468;
  • attributes.val_samples: The number of validation set samples in this dataset is 2077;
  • attributes.train_sample_paths: A list of relative paths to the visualized training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation set samples in this dataset; Additionally, the dataset validation also analyzes the distribution of character length ratios in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Text recognition does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and it must sum up to 100 with val_percent; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n

After data splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text recognition model (PP-OCRv4_mobile_rec):

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

```bash\npython main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Information (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc\u3001norm_edit_dis\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text recognition module can be integrated into PaddleX pipelines such as the General OCR Pipeline, General Table Recognition Pipeline, and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text recognition module of the relevant pipeline.

2.Module Integration

The weights you produce can be directly integrated into the text recognition module. Refer to the Quick Integration Python example code. Simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#i-overview","title":"I. Overview","text":"

Time series anomaly detection focuses on identifying abnormal points or periods in time series data that do not conform to expected patterns, trends, or periodic regularities. These anomalies can be caused by system failures, external shocks, data entry errors, or rare events, and are of great significance for timely response, risk assessment, and business decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Precision Recall F1-Score Model Size (M) Description AutoEncoder_ad_adInference Model/Trained Model 0.9898 0.9396 0.9641 72.8K AutoEncoder_ad_ad is a simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_adInference Model/Trained Model 0.9855 0.8895 0.9351 1.5MB Based on the transformer structure, optimized for anomaly detection in non-stationary time series AutoEncoder_adInference Model/Trained Model 0.9936 0.8436 0.9125 32K AutoEncoder_ad is a classic autoencoder-based, efficient, and easy-to-use time series anomaly detection model PatchTST_adInference Model/Trained Model 0.9878 0.9070 0.9457 164K PatchTST is a high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_adInference Model/Trained Model 0.9837 0.9480 0.9656 732K Through multi-period analysis, TimesNet is an adaptive and high-precision time series anomaly detection model

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the time series anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the time series anomaly detection module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"AutoEncoder_ad\")\noutput = model.predict(\"ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better time series anomaly detection models. Before developing time series anomaly models with PaddleX, please ensure that the PaddleTS plugin is installed. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to the PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_anomaly_examples.tar -P ./dataset\ntar -xf ./dataset/ts_anomaly_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22032,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        0.0,\n        0.7326893750079723,\n        \"...\",\n        0.1382488479262673,\n        0.0\n      ]\n    ],\n    \"val_samples\": 198290,\n    \"val_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        22032.0,\n        0.8604795809835284,\n        \"...\",\n        0.1428571428571428,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_anomaly_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 22032;
  • attributes.val_samples: The number of validation samples in this dataset is 198290;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset. Note: Only data that has passed validation can be used for training and evaluation.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time series anomaly detection supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, supporting xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, time series anomaly detection only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (AutoEncoder_ad) as an example:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's AutoEncoder_ad.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, the following outputs are typically generated:

Upon completion of model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically indicating whether the evaluation task was completed successfully and the model's evaluation metrics, including f1, recall, and precision.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions through the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_ad.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Anomaly Detection. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series anomaly detection module. Refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html","title":"Time Series Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#i-overview","title":"I. Overview","text":"

Time series classification involves identifying and categorizing different patterns in time series data by analyzing trends, periodicity, seasonality, and other factors that vary over time. This technique is widely used in medical diagnosis and other fields, effectively classifying key information in time series data to provide robust support for decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Acc(%) Model Size (M) Description TimesNet_clsInference Model/Trained Model 87.5 792K TimesNet is an adaptive and high-accuracy time series classification model through multi-period analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform inference for the time series classification module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the time series classification module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better time series classification models. Before using PaddleX to develop time series classification models, ensure you have installed the PaddleTS plugin. Refer to the PaddleX Local Installation Guide for the installation process.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to PaddleX Time Series Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.000949,\n        ...,\n        0.12107,\n        1.0,\n        0.0\n      ]\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.004578,\n        ...,\n        0.15728,\n        1.0,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;

Furthermore, the dataset validation also involved an analysis of the distribution of sample numbers across all categories within the dataset, and a distribution histogram (histogram.png) was generated accordingly.

Note: Only data that has passed validation can be used for training and evaluation.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time-series classification supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, supporting conversion from xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, True to enable, default is False;
  • src_dataset_type: If dataset format conversion is performed, time-series classification only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (TimesNet_cls) as an example:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's TimesNet_cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other relevant parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, an evaluate_result.json file is produced, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including Top-1 Accuracy and F1 score.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_cls.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml - Note: This should likely be TimesNet_cls.yaml for consistency)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other relevant parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipeline or directly into your own projects.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Classification. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series classification module. Refer to the Python example code in Quick Integration (Note: This section header is in Chinese and should be translated or removed for consistency), simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html","title":"Time Series Forecasting Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#i-overview","title":"I. Overview","text":"

Time series forecasting aims to predict the possible values or states at a future point in time or within a future time period by analyzing patterns, trends, periodicity, and other characteristics in historical data. This helps enterprises and organizations make more accurate decisions, optimize resource allocation, reduce risks, and seize potential market opportunities. These time series data typically originate from various sensors, economic activities, social behaviors, and other real-world application scenarios. For example, stock prices, temperature changes, website traffic, sales data, and the like are all typical examples of time series data.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mse mae Model Size (M) Introduce DLinearInference Model/Trained Model 0.382 0.394 76k Simple structure, high efficiency and easy-to-use time series prediction model NonstationaryInference Model/Trained Model 0.600 0.515 60.3M Based on the transformer structure, targeted optimization of long-term time series prediction models for non-stationary time series PatchTSTInference Model/Trained Model 0.385 0.397 2.2M High-precision long-term time series prediction model that takes into account both local patterns and global dependencies TiDEInference Model/Trained Model 0.405 0.412 34.9M High-precision model suitable for handling multivariate, long-term time series prediction problems TimesNetInference Model/Trained Model 0.417 0.431 5.2M Through multi-period analysis, TimesNet is a highly adaptable high-precision time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset, with an input sequence length of 96, and a prediction sequence length of 96 for all models except TiDE, which has a prediction sequence length of 720.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Time Series Forecasting module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Time Series Forecasting module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Time Series Forecasting models. Before developing a Time Series Forecasting model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Time Series Forecasting Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ts_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 12194,\n    \"train_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2016-07-01 00:00:00\",\n        5.827000141143799,\n        2.009000062942505,\n        1.5989999771118164,\n        0.4620000123977661,\n        4.203000068664552,\n        1.3400000333786009,\n        30.5310001373291\n      ],\n      [\n        \"2016-07-01 01:00:00\",\n        5.692999839782715,\n        2.075999975204468,\n        1.4919999837875366,\n        0.4259999990463257,\n        4.142000198364259,\n        1.371000051498413,\n        27.78700065612793\n      ]\n    ],\n    \"val_samples\": 3484,\n    \"val_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2017-11-21 02:00:00\",\n        12.994000434875488,\n        4.889999866485597,\n        10.055999755859377,\n        2.878000020980835,\n        2.559000015258789,\n        1.2489999532699585,\n        4.7129998207092285\n      ],\n      [\n        \"2017-11-21 03:00:00\",\n        11.92199993133545,\n        4.554999828338623,\n        9.097000122070312,\n        3.0920000076293945,\n        2.559000015258789,\n        1.2790000438690186,\n        4.8540000915527335\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_dataset_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Time Series Forecasting supports converting xlsx and xls format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting xlsx and xls format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null.

Modify the paddlex/configs/ts_forecast/DLinear.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (DLinear) as an example:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mse and mae.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_fc.csv\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's DLinear.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The Time Series Forecasting module can be integrated into PaddleX pipelines such as the Time Series Forecasting Pipeline (ts_fc). Simply replace the model path to update the Time Series Forecasting module's model.

  1. Module Integration

The weights you produce can be directly integrated into the Time Series Forecasting module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html","title":"PaddleX Multi-Hardware Usage Guide","text":"

This document focuses on the usage guide of PaddleX for Huawei Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU hardware platforms.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#1-installation","title":"1. Installation","text":""},{"location":"en/other_devices_support/multi_devices_use_guide.html#11-paddlepaddle-installation","title":"1.1 PaddlePaddle Installation","text":"

First, please complete the installation of PaddlePaddle according to your hardware platform. The installation tutorials for each hardware are as follows:

Ascend NPU: Ascend NPU PaddlePaddle Installation Guide

Cambricon MLU: Cambricon MLU PaddlePaddle Installation Guide

Kunlun XPU: Kunlun XPU PaddlePaddle Installation Guide

Hygon DCU: Hygon DCU PaddlePaddle Installation Guide

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#12-paddlex-installation","title":"1.2 PaddleX Installation","text":"

Welcome to use PaddlePaddle's low-code development tool, PaddleX. Before we officially start the local installation, please clarify your development needs and choose the appropriate installation mode based on your requirements.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. The following details the application scenarios and installation methods for these two modes.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#121-wheel-package-installation-mode","title":"1.2.1 Wheel Package Installation Mode","text":"

If your application scenario for PaddleX is model inference and integration, we recommend using the more convenient and lightweight Wheel Package Installation Mode.

After installing PaddlePaddle, you can directly execute the following commands to quickly install the PaddleX Wheel package:

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b1-py3-none-any.whl\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#122-plugin-installation-mode","title":"1.2.2 Plugin Installation Mode","text":"

If your application scenario for PaddleX is secondary development, we recommend using the more powerful Plugin Installation Mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration on the models supported by the plugins but also conduct more advanced operations such as model training for secondary development.

The plugins supported by PaddleX are as follows. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR General Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection Document Scene Information Extraction v3 Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionDocument Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Prediction Time Series Prediction Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS General Multi-label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin(s) you need to install is/are PaddleXXX (can be multiple), after installing PaddlePaddle, you can directly execute the following commands to quickly install the corresponding PaddleX plugin(s):

# obtain PaddleX source code\ngit clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX Plugins\npaddlex --install PaddleXXX\n
For example, if you need to install the PaddleOCR and PaddleClas plugins, you can execute the following command:

# Install PaddleOCR and PaddleClas Plugins\npaddlex --install PaddleOCR PaddleClas\n

If you wish to install all plugins, you do not need to specify the plugin names. Simply execute the following command:

# Install All PaddleX Plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com. You can specify the clone source using --platform.

For instance, if you want to install all PaddleX plugins using the gitee.com clone source, execute the following command:

# Install PaddleX Plugins using gitee.com\npaddlex --install --platform gitee.com\n

Upon successful installation, you will see the following prompt:

All packages are installed.\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#2-usage","title":"2. Usage","text":"

The usage of PaddleX model pipeline development tool on hardware platforms such as Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU is identical to that on GPU. You only need to modify the device configuration parameters according to your hardware platform. For detailed usage tutorials, please refer to PaddleX Pipeline Development Tool Local Usage Guide.

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html","title":"Hygon DCU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Haiguang Z100 series chips. Considering environmental differences, we recommend using the officially released Haiguang DCU development image by PaddlePaddle, which is pre-installed with the Haiguang DCU basic runtime library (DTK).

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. Note that this image is only for development environments and does not include pre-compiled PaddlePaddle installation packages.

docker pull registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-dcu-dev -v `pwd`:/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#2-install-paddlepaddle-package","title":"2. Install PaddlePaddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle's official website. Note: The DCU version of PaddlePaddle framework only supports Hygon C86 architecture.

# Download and install the wheel package\npip install paddlepaddle-rocm -i https://www.paddlepaddle.org.cn/packages/nightly/dcu\n

After the installation package is installed, run the following command to verify it:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is as follows:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html","title":"Cambricon MLU Installation Tutorial for PaddlePaddle","text":"

Currently, PaddleX supports the Cambricon MLU370X8 chip. Considering environmental differences, we recommend using the Cambricon MLU development image provided by PaddlePaddle to prepare your environment.

"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is for development only and does not include a pre-compiled PaddlePaddle installation package.

# Applicable to X86 architecture, Arch64 architecture image is not provided for now\ndocker pull registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-mlu-dev -v $(pwd):/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v /usr/bin/cnmon:/usr/bin/cnmon \\\n  registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle. Currently, Python 3.10 wheel packages are provided. If you require other Python versions, refer to the PaddlePaddle official documentation for compilation and installation instructions.

# Download and install the wheel package\n# Note: You need to install the CPU version of PaddlePaddle first\npython -m pip install paddlepaddle==3.0.0.dev20240624 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython -m pip install paddle-custom-mlu==3.0.0.dev20240806 -i https://www.paddlepaddle.org.cn/packages/nightly/mlu/\n

Verify the installation. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 mlu.\nPaddlePaddle works well on 16 mlus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html","title":"Ascend NPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports the Ascend 910B chip (more models are under support. If you have a related need for other models, please submit an issue to inform us). The Ascend driver version is 23.0.3. Considering the differences in environments, we recommend using the Ascend development image provided by PaddlePaddle to complete the environment preparation.

"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"
  • Pull the image. This image is only for the development environment and does not contain a pre-compiled PaddlePaddle installation package. The image has CANN-8.0.T13, the Ascend operator library, installed by default.
    # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-x86_64-gcc84-py39\n# For Aarch64 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-aarch64-gcc84-py39\n
  • Start the container with the following command. ASCEND_RT_VISIBLE_DEVICES specifies the visible NPU card numbers.
    docker run -it --name paddle-npu-dev -v $(pwd):/work \\\n    --privileged --network=host --shm-size=128G -w=/work \\\n    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \\\n    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\\n    -v /usr/local/dcmi:/usr/local/dcmi \\\n    -e ASCEND_RT_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" \\\n    registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-$(uname -m)-gcc84-py39 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python 3.9 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

  • Download and install the Python 3.9 wheel installation package
    # Note: You need to install the CPU version of PaddlePaddle first\npython3.9 -m pip install paddlepaddle==3.0.0.dev20240520 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython3.9 -m pip install paddle_custom_npu==3.0.0.dev20240719 -i https://www.paddlepaddle.org.cn/packages/nightly/npu/\n
  • After verifying that the installation package is installed, run the following command
    python -c \"import paddle; paddle.utils.run_check()\"\n
    The expected output is as follows
Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 npu.\nPaddlePaddle works well on 8 npus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html","title":"Kunlun XPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Kunlun R200/R300 and other chips. Considering environmental differences, we recommend using the Kunlun XPU development image officially released by PaddlePaddle, which is pre-installed with the Kunlun basic runtime environment library (XRE).

"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is only for the development environment and does not include a pre-compiled PaddlePaddle installation package.

docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # For ARM architecture\n
Refer to the following command to start the container:

docker run -it --name=xxx -m 81920M --memory-swap=81920M \\\n    --shm-size=128G --privileged --net=host \\\n    -v $(pwd):/workspace -w /workspace \\\n    registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python3.10 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

Install the Python3.10 wheel installation package:

pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # For X86 architecture\npip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # For ARM architecture\n

Verify the installation package. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/pipeline_deploy/edge_deploy.html","title":"PaddleX Edge Deployment Demo Usage Guide","text":"
  • PaddleX Edge Deployment Demo Usage Guide
  • Installation Process and Usage
    • Environment Preparation
    • Material Preparation
    • Deployment Steps
  • Reference Materials
  • Feedback Section

This guide mainly introduces the operation method of the PaddleX edge deployment demo on the Android shell. This guide applies to 8 models across 6 modules:

Module Specific Model CPU GPU Object Detection PicoDet-S \u2705 \u2705 PicoDet-L \u2705 \u2705 Layout Area Detection PicoDet_layout_1x \u2705 \u2705 Semantic Segmentation PP-LiteSeg-T \u2705 \u2705 Image Classification PP-LCNet_x1_0 \u2705 \u2705 MobileNetV3_small_x1_0 \u2705 \u2705 Text Detection PP-OCRv4_mobile_det \u2705 Text Recognition PP-OCRv4_mobile_rec \u2705

Note - GPU refers to mapping computations to GPU execution using OpenCL to fully utilize GPU hardware computing power and improve inference performance.

"},{"location":"en/pipeline_deploy/edge_deploy.html#installation-process-and-usage","title":"Installation Process and Usage","text":""},{"location":"en/pipeline_deploy/edge_deploy.html#environment-preparation","title":"Environment Preparation","text":"
  1. Install CMake build tool locally and download the required version of NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK official website.

    Environment Requirements - CMake >= 3.10 (Minimum version not verified, recommend 3.20 and above) - Android NDK >= r17c (Minimum version not verified, recommend r20b and above)

    Tested Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Locate Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install ADB tool on your computer for debugging. ADB installation methods:

    3.1. For Mac:

    brew cask install android-platform-tools\n

    3.2. For Linux:

    # Debian-based Linux distributions\nsudo apt update\nsudo apt install -y wget adb\n\n# Red Hat-based Linux distributions\nsudo yum install adb\n

    3.3. For Windows:

    Install ADB by downloading the ADB software package from Google's Android platform: Link

    Open a terminal, connect your phone to the computer, and enter in the terminal:

     adb devices\n

    If there is an output from the device, it indicates that the installation was successful.

     List of devices attached\n 744be294    device\n
"},{"location":"en/pipeline_deploy/edge_deploy.html#material-preparation","title":"Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified unzip directory, switch to the specified unzip directory, and execute the unzip command.

    • Object Detection Survey
    • Semantic Segmentation Survey
    • Image Classification Survey
    • OCR Survey

    Below is an example of the unzip operation for object_detection. Refer to the table below for other pipelines.

    # 1. Switch to the specified unzip directory\ncd PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection\n\n# 2. Execute the unzip command\nunzip object_detection.zip\n

    Pipeline Name Unzip Directory Unzip Command Object Detection PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection unzip object_detection.zip Semantic Segmentation PaddleX-Lite-Deploy/semantic_segmentation/android/shell/cxx/semantic_segmentation unzip semantic_segmentation.zip Image Classification PaddleX-Lite-Deploy/image_classification/android/shell/cxx/image_classification unzip image_classification.zip OCR PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo unzip ocr.zip

"},{"location":"en/pipeline_deploy/edge_deploy.html#deployment-steps","title":"Deployment Steps","text":"
  1. Switch the working directory to PaddleX_Lite_Deploy/libs and run the download.sh script to download the necessary Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/assets, run the download.sh script to download the paddle_lite_opt tool optimized model, test images, label files, etc.

  3. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the build.sh script to complete the compilation and execution of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the run.sh script to complete the prediction on the edge.

    Note: - {Pipeline_Name} and {Demo_Name} are placeholders. Refer to the table at the end of this section for specific values. - download.sh and run.sh support passing in model names to specify models. If not specified, the default model will be used. Refer to the Model_Name column in the table at the end of this section for currently supported models. - To use your own trained model, refer to the Model Conversion Method to obtain the .nb model, place it in the PaddleX_Lite_Deploy/{Pipeline_Name}/assets/{Model_Name} directory, where {Model_Name} is the model name, e.g., PaddleX_Lite_Deploy/object_detection/assets/PicoDet-L. - Before running the build.sh script, change the path specified by NDK_ROOT to the actual installed NDK path. - Keep ADB connected when running the build.sh script. - On Windows systems, you can use Git Bash to execute the deployment steps. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME to windows in CMakeLists.txt. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME to darwin in CMakeLists.txt.

Below is an example for object_detection. For other demos, change the directories switched in steps 2 and 3 according to the table at the end of this section.

# 1. Download the necessary Paddle Lite prediction library\ncd PaddleX_Lite_Deploy/libs\nsh download.sh\n\n# 2. Download the paddle_lite_opt tool optimized model, test images, and label files\ncd ../object_detection/assets\nsh download.sh\n# Supports passing in model names to specify the downloaded model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh download.sh PicoDet-L\n\n# 3. Complete the compilation of the executable file\ncd ../android/app/shell/cxx/picodet_detection\nsh build.sh\n\n# 4. Prediction\nsh run.sh\n# Supports passing in model names to specify the prediction model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh run.sh PicoDet-L\n

The run results are shown below, and a result image named dog_picodet_detection_result.jpg is generated:

======= benchmark summary =======\ninput_shape(s) (NCHW): {1, 3, 320, 320}\nmodel_dir:./models/PicoDet-S/model.nb\nwarmup:1\nrepeats:10\npower_mode:1\nthread_num:0\n<b>* time info(ms) </b>*\n1st_duration:320.086\nmax_duration:277.331\nmin_duration:272.67\navg_duration:274.91\n\n====== output summary ======\ndetection, image size: 768, 576, detect object: bicycle, score: 0.905929, location: x=125, y=1\n

This section describes the deployment steps applicable to the demos listed in the following table:

Pipeline Pipeline_Name Module Demo_Name Specific Model Model_Name General Object Detection object_detection Object Detection picodet_detection PicoDet-S PicoDet-S\uff08default\uff09PicoDet-S_gpu PicoDet-L PicoDet-LPicoDet-L_gpu PicoDet_layout_1x PicoDet_layout_1xPicoDet_layout_1x_gpu General Semantic Segmentation semantic_segmentation Semantic Segmentation semantic_segmentation PP-LiteSeg-T PP-LiteSeg-T\uff08default\uff09PP-LiteSeg-T_gpu General Image Classification image_classification Image Classification image_classification PP-LCNet_x1_0 PP-LCNet_x1_0\uff08default\uff09PP-LCNet_x1_0_gpu MobileNetV3_small_x1_0 MobileNetV3_small_x1_0MobileNetV3_small_x1_0_gpu General OCR ocr Text Detection ppocr_demo PP-OCRv4_mobile_det PP-OCRv4_mobile_det Text Recognition PP-OCRv4_mobile_rec PP-OCRv4_mobile_rec

Note - Currently, there is no demo for deploying the Layout Area Detection module on the edge, so the picodet_detection demo is reused to deploy the PicoDet_layout_1x model.

"},{"location":"en/pipeline_deploy/edge_deploy.html#reference-materials","title":"Reference Materials","text":"

This guide only introduces the basic installation and usage process of the edge deployment demo. If you want to learn more detailed information, such as code introduction, code explanation, updating models, updating input and output preprocessing, updating prediction libraries, etc., please refer to the following documents:

  • Object Detection
  • Semantic Segmentation
  • Image Classification
  • OCR
"},{"location":"en/pipeline_deploy/edge_deploy.html#feedback-section","title":"Feedback Section","text":"

The edge deployment capabilities are continuously optimized. Welcome to submit issue to report problems and needs, and we will follow up promptly.

"},{"location":"en/pipeline_deploy/high_performance_inference.html","title":"PaddleX High-Performance Inference Guide","text":"

In real-world production environments, many applications have stringent standards for deployment strategy performance metrics, particularly response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins designed to deeply optimize model inference and pre/post-processing, achieving significant speedups in the end-to-end process. This document will first introduce the installation and usage of the high-performance inference plugins, followed by a list of pipelines and models currently supporting the use of these plugins.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#1-installation-and-usage-of-high-performance-inference-plugins","title":"1. Installation and Usage of High-Performance Inference Plugins","text":"

Before using the high-performance inference plugins, ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial, and have successfully run the quick inference of the pipeline using either the PaddleX pipeline command line instructions or the Python script instructions.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#11-installing-high-performance-inference-plugins","title":"1.1 Installing High-Performance Inference Plugins","text":"

Find the corresponding installation command based on your processor architecture, operating system, device type, and Python version in the table below and execute it in your deployment environment. Please replace {paddlex version number} with the actual paddlex version number, such as the current latest stable version 3.0.0b2. If you need to use the version corresponding to the development branch, replace {paddlex version number} with 0.0.0.dev0.

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0(CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • For Linux systems, execute the installation instructions using Bash.
  • When using NVIDIA GPUs, please use the installation instructions corresponding to the CUDA and cuDNN versions that match your environment. Otherwise, you will not be able to use the high-performance inference plugin properly.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/pipeline_deploy/high_performance_inference.html#12-obtaining-serial-numbers-and-activation","title":"1.2 Obtaining Serial Numbers and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Platform page, under the \"Open-source Pipeline Deployment Serial Number Inquiry and Acquisition\" section, select \"Acquire Now\" as shown in the following image:

Select the pipeline you wish to deploy and click \"Acquire\". Afterwards, you can find the acquired serial number in the \"Open-source Pipeline Deployment SDK Serial Number Management\" section at the bottom of the page:

After using the serial number to complete activation, you can utilize high-performance inference plugins. PaddleX provides both online and offline activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and enable online activation to automatically complete the process.
  • Offline Activation: Follow the instructions in the serial number management interface (click \"Offline Activation\" under \"Operations\") to obtain the device fingerprint of your machine. Bind the serial number with the device fingerprint to obtain a certificate and complete the activation. For this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI.

Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

For Linux systems, if using the high-performance inference plugin in a Docker container, please mount the host machine's /dev/disk/by-uuid and ${HOME}/.baidu/paddlex/licenses directories to the container.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate the license online, specify --update_license when using the serial number for the first time. Taking the general image classification pipeline as an example:

paddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number} \\\n    --update_license\n

For PaddleX Python API, enabling the high-performance inference plugin is similar. Still taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"image_classification\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": \"{serial_number}\"},\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\n

The inference results obtained with the high-performance inference plugin enabled are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache the relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent runs to improve initialization speed.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#14-modifying-high-performance-inference-configurations","title":"1.4 Modifying High-Performance Inference Configurations","text":"

PaddleX combines model information and runtime environment information to provide default high-performance inference configurations for each model. These default configurations are carefully prepared to be applicable in several common scenarios and achieve relatively optimal performance. Therefore, users typically may not need to be concerned with the specific details of these configurations. However, due to the diversity of actual deployment environments and requirements, the default configuration may not yield ideal performance in certain scenarios and could even result in inference failures. In cases where the default configuration does not meet the requirements, users can manually adjust the configuration by modifying the Hpi field in the inference.yml file within the model directory (if this field does not exist, it needs to be added). The following are two common situations:

  • Switching inference backends:

    When the default inference backend is not available, the inference backend needs to be switched manually. Users should modify the selected_backends field (if it does not exist, it needs to be added).

    Hpi:\n  ...\n  selected_backends:\n    cpu: paddle_infer\n    gpu: onnx_runtime\n  ...\n

    Each entry should follow the format {device type}: {inference backend name}.

    The currently available inference backends are:

    • paddle_infer: The Paddle Inference engine. Supports CPU and GPU. Compared to the PaddleX quick inference, TensorRT subgraphs can be integrated to enhance inference performance on GPUs.
    • openvino: OpenVINO, a deep learning inference tool provided by Intel, optimized for model inference performance on various Intel hardware. Supports CPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • onnx_runtime: ONNX Runtime, a cross-platform, high-performance inference engine. Supports CPU and GPU. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • tensorrt: TensorRT, a high-performance deep learning inference library provided by NVIDIA, optimized for NVIDIA GPUs to improve speed. Supports GPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
  • Modifying dynamic shape configurations for Paddle Inference or TensorRT:

    Dynamic shape is the ability of TensorRT to defer specifying parts or all of a tensor\u2019s dimensions until runtime. If the default dynamic shape configuration does not meet requirements (e.g., the model may require input shapes beyond the default range), users need to modify the trt_dynamic_shapes or dynamic_shapes field in the inference backend configuration:

    Hpi:\n  ...\n  backend_configs:\n    # Configuration for the Paddle Inference backend\n    paddle_infer:\n      ...\n      trt_dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n    # Configuration for the TensorRT backend\n    tensorrt:\n      ...\n      dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n

    In trt_dynamic_shapes or dynamic_shapes, each input tensor requires a specified dynamic shape in the format: {input tensor name}: [{minimum shape}, [{optimal shape}], [{maximum shape}]]. For details on minimum, optimal, and maximum shapes and further information, please refer to the official TensorRT documentation.

    After completing the modifications, please delete the cache files in the model directory (shape_range_info.pbtxt and files starting with trt_serialized).

"},{"location":"en/pipeline_deploy/high_performance_inference.html#2-pipelines-and-models-supporting-high-performance-inference-plugins","title":"2. Pipelines and Models Supporting High-Performance Inference Plugins","text":"Pipeline Pipeline Module Specific Models General Image Classification Image Classification ResNet18ResNet34 moreResNet50ResNet101ResNet152ResNet18_vdResNet34_vdResNet50_vdResNet101_vdResNet152_vdResNet200_vdPP-LCNet_x0_25PP-LCNet_x0_35PP-LCNet_x0_5PP-LCNet_x0_75PP-LCNet_x1_0PP-LCNet_x1_5PP-LCNet_x2_0PP-LCNet_x2_5PP-LCNetV2_smallPP-LCNetV2_basePP-LCNetV2_largeMobileNetV3_large_x0_35MobileNetV3_large_x0_5MobileNetV3_large_x0_75MobileNetV3_large_x1_0MobileNetV3_large_x1_25MobileNetV3_small_x0_35MobileNetV3_small_x0_5MobileNetV3_small_x0_75MobileNetV3_small_x1_0MobileNetV3_small_x1_25ConvNeXt_tinyConvNeXt_smallConvNeXt_base_224ConvNeXt_base_384ConvNeXt_large_224ConvNeXt_large_384MobileNetV1_x0_25MobileNetV1_x0_5MobileNetV1_x0_75MobileNetV1_x1_0MobileNetV2_x0_25MobileNetV2_x0_5MobileNetV2_x1_0MobileNetV2_x1_5MobileNetV2_x2_0SwinTransformer_tiny_patch4_window7_224SwinTransformer_small_patch4_window7_224SwinTransformer_base_patch4_window7_224SwinTransformer_base_patch4_window12_384SwinTransformer_large_patch4_window7_224SwinTransformer_large_patch4_window12_384PP-HGNet_smallPP-HGNet_tinyPP-HGNet_basePP-HGNetV2-B0PP-HGNetV2-B1PP-HGNetV2-B2PP-HGNetV2-B3PP-HGNetV2-B4PP-HGNetV2-B5PP-HGNetV2-B6CLIP_vit_base_patch16_224CLIP_vit_large_patch14_224 General Object Detection Object Detection PP-YOLOE_plus-SPP-YOLOE_plus-M morePP-YOLOE_plus-LPP-YOLOE_plus-XYOLOX-NYOLOX-TYOLOX-SYOLOX-MYOLOX-LYOLOX-XYOLOv3-DarkNet53YOLOv3-ResNet50_vd_DCNYOLOv3-MobileNetV3RT-DETR-R18RT-DETR-R50RT-DETR-LRT-DETR-HRT-DETR-XPicoDet-SPicoDet-L General Semantic Segmentation Semantic Segmentation Deeplabv3-R50Deeplabv3-R101 moreDeeplabv3_Plus-R50Deeplabv3_Plus-R101PP-LiteSeg-TOCRNet_HRNet-W48OCRNet_HRNet-W18SeaFormer_tinySeaFormer_smallSeaFormer_baseSeaFormer_largeSegFormer-B0SegFormer-B1SegFormer-B2SegFormer-B3SegFormer-B4SegFormer-B5 General Instance Segmentation Instance Segmentation Mask-RT-DETR-LMask-RT-DETR-H Seal Text Recognition Layout Analysis PicoDet-S_layout_3clsPicoDet-S_layout_17cls morePicoDet-L_layout_3clsPicoDet-L_layout_17clsRT-DETR-H_layout_3clsRT-DETR-H_layout_17cls Seal Text Detection PP-OCRv4_server_seal_detPP-OCRv4_mobile_seal_det Text Recognition PP-OCRv4_mobile_recPP-OCRv4_server_rec General OCR Text Detection PP-OCRv4_server_detPP-OCRv4_mobile_det Text Recognition PP-OCRv4_server_recPP-OCRv4_mobile_recch_RepSVTR_recch_SVTRv2_rec General Table Recognition Layout Detection PicoDet_layout_1x Table Recognition SLANet SLANet_plus Text Detection PP-OCRv4_server_detPP-OCRv4_mobile_det Text Recognition PP-OCRv4_server_recPP-OCRv4_mobile_recch_RepSVTR_recch_SVTRv2_rec Document Scene Information Extraction v3 Table Recognition SLANet SLANet_plus Layout Detection PicoDet_layout_1x Text Detection PP-OCRv4_server_det PP-OCRv4_mobile_det Text Recognition PP-OCRv4_server_rec PP-OCRv4_mobile_rec ch_RepSVTR_rec ch_SVTRv2_rec Seal Text Detection PP-OCRv4_server_seal_det PP-OCRv4_mobile_seal_det Text Image Rectification UVDoc Document Image Orientation Classification PP-LCNet_x1_0_doc_ori"},{"location":"en/pipeline_deploy/service_deploy.html","title":"PaddleX Serving Deployment Guide","text":"

Serving deployment is a common form of deployment in real-world production environments. By encapsulating inference capabilities as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost serving deployment for production lines. This document will first introduce the basic process of serving deployment using PaddleX, followed by considerations and potential operations when using the service in a production environment.

Note - Serving deployment provides services for model pipelines, not specific to individual pipeline modules.

Serving Deployment Example Diagram:

"},{"location":"en/pipeline_deploy/service_deploy.html#1-basic-process","title":"1. Basic Process","text":""},{"location":"en/pipeline_deploy/service_deploy.html#11-install-the-serving-deployment-plugin","title":"1.1 Install the Serving Deployment Plugin","text":"

Execute the following command to install the serving deployment plugin:

paddlex --install serving\n
"},{"location":"en/pipeline_deploy/service_deploy.html#12-start-the-service","title":"1.2 Start the Service","text":"

Start the service through the PaddleX CLI with the following command format:

paddlex --serve --pipeline {pipeline_name_or_path} [{other_command_line_options}]\n

Taking the General Image Classification Pipeline as an example:

paddlex --serve --pipeline image_classification\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or the path to a local pipeline configuration file. PaddleX uses this to build the pipeline and deploy it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General Image Classification Pipeline Tutorial.

Command-line options related to serving deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Defaults to cpu (If GPU is unavailable) or gpu (If GPU is available). --host Hostname or IP address bound to the server. Defaults to 0.0.0.0. --port Port number listened to by the server. Defaults to 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Activates the license online if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/pipeline_deploy/service_deploy.html#13-call-the-service","title":"1.3 Call the Service","text":"

Please refer to the \"Development Integration/Deployment\" section in the usage tutorials for each pipeline. You can find the pipeline tutorials here.

"},{"location":"en/pipeline_deploy/service_deploy.html#2-deploy-services-for-production","title":"2. Deploy Services for Production","text":"

When deploying services into production environments, the stability, efficiency, and security of the services are of paramount importance. Below are some recommendations for deploying services into production.

"},{"location":"en/pipeline_deploy/service_deploy.html#21-utilize-paddlex-high-performance-inference-plugin","title":"2.1 Utilize PaddleX high-performance inference Plugin","text":"

In scenarios where strict response time requirements are imposed on applications, the PaddleX high-performance inference Plugin can be used to accelerate model inference and pre/post-processing, thereby reducing response time and increasing throughput.

To use the PaddleX high-performance inference Plugin, please refer to the PaddleX High-Performance Inference Guide for installing the high-performance inference plugin, obtaining serial numbers, and activating the plugin. Additionally, not all pipelines, models, and environments support the use of the high-performance inference plugin. For detailed support information, please refer to the section on pipelines and models that support the high-performance inference plugin.

When starting the PaddleX pipeline service, you can specify --use_hpip along with the serial number to use the high-performance inference plugin. If you wish to perform online activation, you should also specify --update_license. Example usage:

paddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number} --update_license\n
"},{"location":"en/pipeline_deploy/service_deploy.html#22-consider-security","title":"2.2 Consider Security","text":"

A typical scenario involves an application accepting inputs from the network, with the PaddleX pipeline service acting as a module within the application, interacting with other modules through APIs. In this case, the position of the PaddleX pipeline service within the application is crucial. The service-oriented deployment solution provided by PaddleX focuses on efficiency and ease of use but does not perform sufficient security checks on request bodies. Malicious requests from the network, such as excessively large images or carefully crafted data, can lead to severe consequences like service crashes. Therefore, it is recommended to place the PaddleX pipeline service within the application's internal network, avoiding direct processing of external inputs, and ensuring it only processes trustworthy requests. Appropriate protective measures, such as input validation and authentication, should be added at the application's outer layer.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html","title":"Overview of PaddleX Model Pipeline Usage","text":"

If you have already experienced the pre-trained model pipeline effects in PaddleX and wish to proceed directly with model fine-tuning, you can jump to Model Selection.

The complete PaddleX model pipeline development process is illustrated in the following diagram:

PaddleX Model Pipeline Development Flowchart

graph LR\n    select_pipeline(Select Pipeline) --> online_experience[Quick Experience]\n    online_experience --> online_ok{Satisfied with Results?}\n    online_ok --No--> select_model[Select Model]\n    select_model --> model_finetune[Model Fine-tuning]\n    online_ok --Yes--> development_integration(Development Integration/Deployment)\n    model_finetune --> pipeline_test[Pipeline Testing]\n    pipeline_test --> test_ok{Satisfied with Results?}\n    test_ok --No--> select_model\n    test_ok --Yes--> development_integration

The pre-trained model pipelines provided by PaddleX allow for quick experience of effects. If the pipeline effects meet your requirements, you can directly proceed with development integration/deployment of the pre-trained model pipeline. If the effects are not as expected, you can use your private data to fine-tune the models within the pipeline until satisfactory results are achieved.

Below, let's take the task of boarding pass recognition as an example to introduce the local usage process of the PaddleX model pipeline tool. Before use, please ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#1-select-pipeline","title":"1. Select Pipeline","text":"

Each pipeline in PaddleX can solve specific task scenarios such as object detection, time series prediction, semantic segmentation, etc. You need to select the pipeline for subsequent development based on the specific task. For example, for the boarding pass recognition task, the corresponding PaddleX pipeline is the General OCR Pipeline. More task-pipeline correspondences can be found in the PaddleX Models List (CPU/GPU).

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#2-quick-start","title":"2. Quick Start","text":"

Each pipeline in PaddleX integrates numerous pre-trained models. You can first experience the effects of the PaddleX pre-trained model pipeline. If the effects of the pre-trained model pipeline meet your expectations, you can proceed directly with Development Integration/Deployment. If not, optimize the pipeline effects according to the subsequent steps.

PaddleX provides three ways to quickly experience pipeline effects. You can choose the appropriate method based on your needs:

  • Online Quick Experience URL: PaddleX Pipeline List (CPU/GPU)
  • Command Line Quick Experience: PaddleX Pipeline Command Line Usage Instructions
  • Python Script Quick Experience: PaddleX Pipeline Python API Usage Instructions

To demonstrate the OCR pipeline for the boarding pass recognition task, you can quickly experience the pipeline's effect in three ways:

\ud83c\udf10 Online Experience

You can experience the effects of the universal OCR pipeline in AI Studio online. Use the official demo image provided for recognition, for example:

\ud83d\udcbb Command Line Experience

A single command can quickly experience the pipeline effects. Use the test file, and replace --input with a local path for prediction:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter description:

--pipeline: Pipeline name, which is the OCR pipeline in this case.\n--input: Local path or URL of the input image to be processed.\n--device: GPU serial number used (for example, gpu:0 means using the 0th GPU, gpu:1,2 means using the 1st and 2nd GPUs), or you can choose to use CPU (--device cpu).\n
\ud83d\udc49Click to view the running results

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [array([[ 6, 13],\n       [64, 13],\n       [64, 31],\n       [ 6, 31]], dtype=int16), array([[210,  14],\n       [238,  14],\n       ...\n       [830, 445],\n       [830, 464],\n       [338, 473]], dtype=int16)], 'dt_scores': [0.7629529090100092, 0.7717284653547034, 0.7139251666762622, 0.8057611181556994, 0.8840947658872964, 0.793295938183885, 0.8342027855884783, 0.8081378522874861, 0.8436969344212185, 0.8500845646497226, 0.7932189714842249, 0.8875924621248228, 0.8827884273639948, 0.8322404317386042, 0.8614796803023563, 0.8804252994596097, 0.9069978945305474, 0.8383917914190059, 0.8495824076580516, 0.8825556800041383, 0.852788927706737, 0.8379584696974435, 0.8633519228646618, 0.763234473595298, 0.8602154244410916, 0.9206341882426813, 0.6341425973804049, 0.8490156149797171, 0.758314821564747, 0.8757849788793592, 0.772485060565334, 0.8404023012596349, 0.8190037953773427, 0.851908529295617, 0.6126112758079643, 0.7324388418218587], 'rec_text': ['www.9', '5', 'boarding pass', 'BOARDING', 'PASS', 'cabin class', '', 'CLASS', 'SERIAL NO', 'seat number', 'SEAT NO', 'flight FLIGHT', 'date DATE', '03DEC', 'W', '035', 'MU 2379', 'departure city', 'FROM', 'boarding gate', 'GATE', 'boarding time BDT', 'destination TO', 'Fuzhou', 'Taiyuan', 'G11', 'FUZHOU', 'ID NO', 'NAME', 'ZHANGQIWEI', 'ticket number TKTNO', 'Zhang Qiwei', 'fare FARE', 'ETKT7813699238489/1', 'The boarding gate closes 10 minutes before departure', 'GATES CLOSE 10 MINUTES BEFORE DEPARTURE TIME'], 'rec_score': [0.683099627494812, 0.23417049646377563, 0.9969978928565979, 0.9945957660675049, 0.9787729382514954, 0.9983421564102173, 0.0, 0.9896272420883179, 0.9927973747253418, 0.9976049065589905, 0.9330753684043884, 0.9562691450119019, 0.9312669038772583, 0.9749765396118164, 0.9749416708946228, 0.9988260865211487, 0.9319792985916138, 0.9979889988899231, 0.9956836700439453, 0.9991750717163086, 0.9938803315162659, 0.9982991218566895, 0.9701204299926758, 0.9986245632171631, 0.9888408780097961, 0.9793729782104492, 0.9952947497367859, 0.9945247173309326, 0.9919753670692444, 0.991995632648468, 0.9937331080436707, 0.9963390827178955, 0.9954304695129395, 0.9934715628623962, 0.9974429607391357, 0.9529641270637512]}\n

The visualization result is as follows:

When executing the above command, the default OCR pipeline configuration file is loaded. If you need a custom configuration file, you can follow the steps below:

\ud83d\udc49Click to expand

Get the OCR pipeline configuration file:

paddlex --get_pipeline_config OCR\n

After execution, the OCR pipeline configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ocr.yaml, just execute:

paddlex --pipeline ./ocr.yaml --input general_ocr_002.png\n

Parameters such as --model, --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will prevail.

\ud83d\udcbb Python Script Experience

A few lines of code can quickly experience the pipeline effects:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

The following steps are executed:

  • create_pipeline() instantiates the pipeline object
  • Passes the image and calls the predict method of the pipeline object for inference prediction
  • Processes the prediction results

\u2757 The results obtained from running the Python script are the same as those from the command line method.

If the pre-trained model pipeline meets your expectations, you can proceed directly to development integration/deployment. If not, optimize the pipeline effects according to the following steps.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#3-model-selection-optional","title":"3. Model Selection (Optional)","text":"

Since a pipeline may contain one or more models, when fine-tuning models, you need to determine which model to fine-tune based on testing results. Taking the OCR pipeline for boarding pass recognition as an example, this pipeline includes a text detection model (e.g., PP-OCRv4_mobile_det) and a text recognition model (e.g., PP-OCRv4_mobile_rec). If the text positioning is inaccurate, you need to fine-tune the text detection model. If the text recognition is inaccurate, you need to fine-tune the text recognition model. If you are unsure which models are included in the pipeline, you can refer to the PaddleX Models List (CPU/GPU)

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#4-model-fine-tuning-optional","title":"4. Model Fine-tuning (Optional)","text":"

After determining the model to fine-tune, you need to train the model with your private dataset. PaddleX provides a single-model development tool that can complete model training with a single command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=your/dataset_dir\n
In addition, PaddleX provides detailed tutorials for preparing private datasets for model fine-tuning, single-model inference, and more. For details, please refer to the PaddleX Modules Tutorials

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#5-pipeline-testing-optional","title":"5. Pipeline Testing (Optional)","text":"

After fine-tuning your model with a private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n
Then, refer to the command line method or Python script method to load the modified pipeline configuration file.

If the results are satisfactory, proceed with Development Integration/Deployment. If not, return to Model Selection to continue fine-tuning other task modules until you achieve satisfactory results.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#6-development-integration-and-deployment","title":"6. Development Integration and Deployment","text":"

If the pre-trained pipeline meets your requirements for inference speed and accuracy, you can proceed directly to development integration/deployment.

If you need to apply the pipeline directly in your Python project, you can refer to the PaddleX Pipeline Python Script Usage Guide and the Python example code in the Quick Start section.

In addition, PaddleX also provides three other deployment methods, with detailed instructions as follows:

\ud83d\ude80 high-performance inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

\u2757 PaddleX provides detailed usage instructions for each pipeline. You can choose according to your needs. Here are all the pipelines and their corresponding detailed instructions:

Pipeline Name Detailed Description PP-ChatOCR-doc v3 PP-ChatOCR-doc v3 Pipeline Usage Tutorial Image Classification Image Classification Pipeline Usage Tutorial Object Detection Object Detection Pipeline Usage Tutorial Instance Segmentation Instance Segmentation Pipeline Usage Tutorial Semantic Segmentation Semantic Segmentation Pipeline Usage Tutorial Image Multi-label Classification Image Multi-label Classification Pipeline Usage Tutorial Small Object Detection Small Object Detection Pipeline Usage Tutorial Image Anomaly Detection Image Anomaly Detection Pipeline Usage Tutorial OCR OCR Pipeline Usage Tutorial Table Recognition Table Recognition Pipeline Usage Tutorial Layout Parsing Layout Parsing Pipeline Usage Tutorial Formula Recognition Formula Recognition Pipeline Usage Tutorial Seal Recognition Seal Recognition Pipeline Usage Tutorial Time Series Forecasting Time Series Forecasting Pipeline Usage Tutorial Time Series Anomaly Detection Time Series Anomaly Detection Pipeline Usage Tutorial Time Series Classification Time Series Classification Pipeline Usage Tutorial"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html","title":"PaddleX Pipeline CLI Usage Instructions","text":"

Before using the CLI command line for rapid inference of the pipeline, please ensure that you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#i-usage-example","title":"I. Usage Example","text":""},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#1-quick-experience","title":"1. Quick Experience","text":"

Taking the image classification pipeline as an example, the usage is as follows:

paddlex --pipeline image_classification \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --device gpu:0 \\\n        --save_path ./output/\n
This single step completes the inference prediction and saves the prediction results. Explanations for the relevant parameters are as follows:

  • pipeline: The name of the pipeline or the local path to the pipeline configuration file, such as the pipeline name \"image_classification\", or the path to the pipeline configuration file \"path/to/image_classification.yaml\";
  • input: The path to the data file to be predicted, supporting local file paths, local directories containing data files to be predicted, and file URL links;
  • device: Used to set the model inference device. If set for GPU, you can specify the card number, such as \"cpu\", \"gpu:2\". When not specified, if GPU is available, it will be used; otherwise, CPU will be used;
  • save_path: The save path for prediction results. When not specified, the prediction results will not be saved;
"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#2-custom-pipeline-configuration","title":"2. Custom Pipeline Configuration","text":"

If you need to modify the pipeline configuration, you can retrieve the configuration file and modify it. Still taking the image classification pipeline as an example, the way to retrieve the configuration file is as follows:

paddlex --get_pipeline_config image_classification\n\n# Please enter the path that you want to save the pipeline config file: (default `./`)\n./configs/\n\n# The pipeline config has been saved to: configs/image_classification.yaml\n

After modifying the production line configuration file configs/image_classification.yaml, such as the content for the image classification configuration file:

Global:\n  pipeline_name: image_classification\n  input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\n\nPipeline:\n  model: PP-LCNet_x0_5\n  batch_size: 1\n  device: \"gpu:0\"\n

Once the modification is completed, you can use this configuration file to perform model pipeline inference prediction as follows:

paddlex --pipeline configs/image_classification.yaml \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --save_path ./output/\n\n# {'input_path': '/root/.paddlex/predict_input/general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': array([0.62817, 0.03729, 0.03262, 0.03247, 0.03196]), 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html","title":"PaddleX Model Pipeline Python Usage Instructions","text":"

Before using Python scripts for rapid inference on model pipelines, please ensure you have installed PaddleX following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification pipeline as an example, the usage is as follows:

from paddlex import create_pipeline\npipeline = create_pipeline(\"image_classification\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, there are only three steps:

  • Call the create_pipeline() method to instantiate the prediction model pipeline object;
  • Call the predict() method of the prediction model pipeline object for inference;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#1-instantiate-the-prediction-model-pipeline-object-by-calling-create_pipeline","title":"1. Instantiate the Prediction Model Pipeline Object by Calling create_pipeline()","text":"
  • create_pipeline: Instantiates the prediction model pipeline object;
  • Parameters:
    • pipeline_name: str type, the pipeline name or the local pipeline configuration file path, such as \"image_classification\", \"/path/to/image_classification.yaml\";
    • device: str type, used to set the model inference device, such as \"cpu\" or \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#2-perform-inference-by-calling-the-predict-method-of-the-prediction-model-pipeline-object","title":"2. Perform Inference by Calling the predict() Method of the Prediction Model Pipeline Object","text":"
  • predict: Uses the defined prediction model pipeline to predict input data;
  • Parameters:
    • input: Any type, supporting str representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV tasks, supports numpy.ndarray representing image data; for TS tasks, supports pandas.DataFrame type data; also supports lists of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results of the model pipeline support access, visualization, and saving, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes","title":"Attributes:","text":"
  • str: str type representation of the prediction result;
  • Return Value: str type, string representation of the prediction result;
  • json: Prediction result in JSON format;
  • Return Value: dict type;
  • img: Visualization image of the prediction result;
  • Return Value: PIL.Image type;
  • html: HTML representation of the prediction result;
  • Return Value: str type;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results_1","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_1","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_2","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html","title":"Face Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#1-introduction-to-the-face-recognition-pipeline","title":"1. Introduction to the Face Recognition Pipeline","text":"

Face recognition is a crucial component in the field of computer vision, aiming to automatically identify individuals by analyzing and comparing facial features. This task involves not only detecting faces in images but also extracting and matching facial features to find corresponding identity information in a database. Face recognition is widely used in security authentication, surveillance systems, social media, smart devices, and other scenarios.

The face recognition pipeline is an end-to-end system dedicated to solving face detection and recognition tasks. It can quickly and accurately locate face regions in images, extract facial features, and retrieve and compare them with pre-established features in a feature database to confirm identity information.

The face recognition pipeline includes a face detection module and a face feature module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model size, choose models with smaller storage requirements.

Face Detection Module:

ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 Improved BlazeFace with FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640x640. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Face Recognition Module:

ModelModel Download Link Output Feature Dimension AP (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face recognition model trained on MS1Mv3 based on MobileFaceNet ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face recognition model trained on MS1Mv3 based on ResNet50

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can experience the effects of the face recognition pipeline online or locally using command-line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Oneline Experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the facial recognition pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Command line experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

Please download the test image for testing. In the example of running this pipeline, you need to pre-build a facial feature library. You can refer to the following instructions to download the official demo data to be used for subsequent construction of the facial feature library. You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_demo_gallery.tar\ntar -xf ./face_demo_gallery.tar\n

If you wish to build a facial feature library using a private dataset, please refer to Section 2.3: Data Organization for Building a Feature Library. Afterward, you can complete the establishment of the facial feature library and quickly perform inference with the facial recognition pipeline using just a few lines of code.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a face recognition pipeline object. The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the build_index method of the face recognition pipeline object to build the facial feature library. The specific parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset, with data organization referring to Section 2.3: Data Organization for Building a Feature Library str None index_dir The save path for the feature library. After successfully calling the build_index method, two files will be generated in this path: \"id_map.pkl\" saves the mapping relationship between image IDs and image feature labels; \"vector.index\" stores the feature vectors of each image. str None

(3) Call the predict method of the face recognition pipeline object for inference prediction: The predict method parameter is x, used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory containing the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(4) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(5) Process the prediction results: The prediction result for each sample is of type dict, and it supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: Boolean, whether to format the output with JSON indentation, default is True; - indent: Integer, JSON formatting setting, effective only when format_json is True, default is 4; - ensure_ascii: Boolean, JSON formatting setting, effective only when format_json is True, default is False; save_to_json Save results as a JSON file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name; - indent: Integer, JSON formatting setting, default is 4; - ensure_ascii: Boolean, JSON formatting setting, default is False; save_to_img Save results as an image file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name;

If you have obtained the configuration file, you can customize various settings of the facial recognition pipeline by simply modifying the pipeline parameter value in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/face_recognition.yaml, you just need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/face_recognition.yaml\")\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#223-adding-and-deleting-operations-in-the-face-feature-library","title":"2.2.3 Adding and Deleting Operations in the Face Feature Library","text":"

If you wish to add more face images to the feature library, you can call the add_index method; to delete face image features, you can call the delete_index method.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.add_index(data_root=\"add_gallery\", index_dir=\"face_gallery_index\")\n\npipeline.delete_index(data_root=\"delete_gallery\", index_dir=\"face_gallery_index\")\n

The add_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be added. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library to which features are added. After successfully calling the add_index method, the face image features in data_root will be added to the face feature library originally saved at index_dir. str None

The delete_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be deleted. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library from which features are deleted. After successfully calling the delete_index method, the face image features in data_root will be deleted from the face feature library originally saved at index_dir. str None"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#23-data-organization-for-feature-library-construction","title":"2.3 Data Organization for Feature Library Construction","text":"

The face recognition pipeline example in PaddleX requires a pre-constructed feature library for face feature retrieval. If you wish to build a face feature library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u251c\u2500\u2500 ID0           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502       ...\n\u2502   \u251c\u2500\u2500 ID1           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the face image to be retrieved and the image feature label, separated by a space. Example content: images/Chandler/Chandler00037.jpg Chandler\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the face recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the face recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is successfully processed, the response status code is 200, and the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result attribute of type object, which stores the operation result information.

  • When the request is not successfully processed, the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • infer

Obtain OCR results for an image.

POST /ocr

  • The attributes of the request body are as follows:
Name Type Meaning Required image string The URL of an accessible image file or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The attributes of```markdown

Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image to Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64 encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // Encode the local image to Base64\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // Call the API\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // Process the response data\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outputImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outputImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n\n
``````markdown # Tutorial on Artificial Intelligence and Computer Vision This tutorial, intended for numerous developers, covers the basics and applications of AI and Computer Vision. Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // Service URL\n        String imagePath = \"./demo.jpg\"; // Local image path\n        String outputImagePath = \"./out.jpg\"; // Output image path\n\n        // Encode the local image to Base64\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64-encoded file content or image URL\n\n        // Create an OkHttpClient instance\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // Call the API and process the response\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // Encode the local image to Base64\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64-encoded file content or image URL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // Call the API\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // Process the response\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }```markdown\n# An English Tutorial on Artificial Intelligence and Computer Vision\n\nThis tutorial document is intended for numerous developers and covers content related to artificial intelligence and computer vision.\n\n<details>\n<summary>C#</summary>\n\n```csharp\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\nstatic readonly string API_URL = \"http://localhost:8080/ocr\";\nstatic readonly string imagePath = \"./demo.jpg\";\nstatic readonly string outputImagePath = \"./out.jpg\";\n\nstatic async Task Main(string[] args)\n{\nvar httpClient = new HttpClient();\n\n// Encode the local image to Base64\nbyte[] imageBytes = File.ReadAllBytes(imagePath);\nstring image_data = Convert.ToBase64String(imageBytes);\n\nvar payload = new JObject{ { \"image\", image_data } }; // Base64 encoded file content or image URL\nvar content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n// Call the API\nHttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\nresponse.EnsureSuccessStatusCode();\n\n// Process the API response\nstring responseBody = await response.Content.ReadAsStringAsync();\nJObject jsonResponse = JObject.Parse(responseBody);\n\nstring base64Image = jsonResponse[\"result\"][\"image\"].ToString();\nbyte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\nFile.WriteAllBytes(outputImagePath, outputImageBytes);\nConsole.WriteLine($\"Output image saved at {outputImagePath}\");\nConsole.WriteLine(\"\\nDetected texts:\");\nConsole.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n}\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr';\nconst imagePath = './demo.jpg';\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64 encoded file content or image URL\n  })\n};\n\n// Encode the local image to Base64\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// Call the API\naxios.request(config)\n.then((response) => {\n    // Process the API response\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP ```php $image_data); // Base64 encoded file content or image URL // Call the API $ch = curl_init($API_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process the API response $result = json_decode($response, true)[\"result\"]; file_put_contents($output ``` \ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the [PaddleX Edge Deployment Guide](../../../pipeline_deploy/edge_deploy.en.md). You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration. ## 4. Custom Development If the default model weights provided by the Face Recognition Pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the pipeline in your scenario. ### 4.1 Model Fine-tuning Since the Face Recognition Pipeline consists of two modules (face detection and face recognition), the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If you find that many faces are not detected during the analysis, it may indicate deficiencies in the face detection model. In this case, you need to refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_detection.en.md#IV.-Custom-Development) section in the [Face Detection Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_detection.en.md) and use your private dataset to fine-tune the face detection model. If matching errors occur in detected faces, it suggests that the face feature model needs further improvement. You should refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_feature.en.md#IV.-Custom-Development) section in the [Face Feature Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_feature.en.md) to fine-tune the face feature model. ### 4.2 Model Application After completing fine-tuning training with your private dataset, you will obtain local model weight files. To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the pipeline configuration file: ```bash ...... Pipeline: device: \"gpu:0\" det_model: \"BlazeFace\" # Can be modified to the local path of the fine-tuned face detection model rec_model: \"MobileFaceNet\" # Can be modified to the local path of the fine-tuned face recognition model det_batch_size: 1 rec_batch_size: 1 device: gpu ...... ``` Subsequently, refer to the command-line method or Python script method in [2.2 Local Experience](#22-Local-Experience) to load the modified pipeline configuration file. Note: Currently, setting separate `batch_size` for face detection and face recognition models is not supported. ## 5. Multi-hardware Support PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the `--device` parameter allows seamless switching between different hardware. For example, when running the face recognition pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the `device` in the script to `npu`: ```python from paddlex import create_pipeline pipeline = create_pipeline( pipeline=\"face_recognition\", device=\"npu:0\" # gpu:0 --> npu:0 ) ``` If you want to use the face recognition pipeline on more types of hardware, please refer to the [PaddleX Multi-device Usage Guide](../../../other_devices_support/multi_devices_use_guide.en.md)."},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html","title":"General Image Recognition Pipeline Usage Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#1-introduction-to-the-general-image-recognition-pipeline","title":"1. Introduction to the General Image Recognition Pipeline","text":"

The General Image Recognition Pipeline aims to solve the problem of open-domain object localization and recognition. Currently, PaddleX's General Image Recognition Pipeline supports PP-ShiTuV2.

PP-ShiTuV2 is a practical general image recognition system mainly composed of three modules: mainbody detection module, image feature module, and vector retrieval module. The system integrates and improves various strategies in multiple aspects, including backbone network, loss function, data augmentation, learning rate scheduling, regularization, pre-trained model, and model pruning and quantization. It optimizes each module and ultimately achieves better performance in multiple application scenarios.

The General Image Recognition Pipeline includes the mainbody detection module and the image feature module, with several models to choose. You can select the model to use based on the benchmark data below. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Object Detection Module:

Model mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_det 41.5 62.0 33.7 537.0 27.54 An mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common objects simultaneously.

Note: The above accuracy metrics are based on the private mainbody detection dataset.

Image Feature Module:

Model Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: mainbody detection, feature extraction, and vector retrieval. These models are part of the feature extraction module, and different models can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are based on AliProducts Recall@1. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can use Python to experience locally.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General Image Recognition Pipeline locally, please ensure you have installed the PaddleX wheel package according to the PaddleX Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

The pipeline does not support command line experience at this time.

By default, the built-in General Image Recognition Pipeline configuration file is used. If you want to change it, you can run the following command to obtain:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config PP-ShiTuV2\n

After execution, the General Image Recognition Pipeline configuration file will be saved in the current directory. If you want to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ShiTuV2 --save_path ./my_path\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"
  • In the example of using this pipeline, a feature vector library needs to be built beforehand. You can download the officially provided drink recognition test dataset drink_dataset_v2.0 to build the feature vector library. If you want to use a private dataset, you can refer to Section 2.3 Data Organization for Building the Feature Library. After that, you can quickly build the feature vector library and predict using the General Image Recognition Pipeline with just a few lines of code.
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"PP-ShiTuV2\")\n\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\", index_dir=\"index_dir\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n\n````\n\nIn the above Python script, the following steps are executed:\n\n(1) Call the `create_pipeline` function to create a general image recognition pipeline object. The specific parameter descriptions are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>pipeline</code></td>\n<td>The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, <code>index_dir</code> needs to be specified in <code>predict()</code>.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>device</code></td>\n<td>The inference device for the pipeline model. Supports: \"gpu\", \"cpu\".</td>\n<td><code>str</code></td>\n<td><code>gpu</code></td>\n</tr>\n<tr>\n<td><code>use_hpip</code></td>\n<td>Whether to enable high-performance inference, which is only available when the pipeline supports it.</td>\n<td><code>bool</code></td>\n<td><code>False</code></td>\n</tr>\n</tbody>\n</table>\n\n(2) Call the `build_index` function of the general image recognition pipeline object to build the feature vector library. The specific parameters are described as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>data_root</code></td>\n<td>The root directory of the dataset. The data organization method refers to <a href=\"#2.3-Data-Organization-for-Building-the-Feature-Library\">Section 2.3 Data Organization for Building the Feature Library</a></td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The save path for the feature library. After successfully calling the <code>build_index</code> function, two files will be generated in this path: <code>\"id_map.pkl\"</code> saves the mapping relationship between image IDs and image feature labels; <code>\"vector.index\"</code> stores the feature vectors of each image.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n</tbody>\n</table>\n\n(3) Call the `predict` function of the general image recognition pipeline object for inference prediction: The `predict` function parameter is `input`, which is used to input the data to be predicted, supporting multiple input methods. Specific examples are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Python Var</td>\n<td>Supports directly passing in Python variables, such as <code>numpy.ndarray</code> representing image data.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the file path of the data to be predicted, such as the local path of an image file: <code>/root/data/img.jpg</code>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: <a href=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/yuanqisenlin.jpeg\">Example</a>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in a local directory that contains the data files to be predicted, such as the local path: <code>/root/data/</code>.</td>\n</tr>\n<tr>\n<td>dict</td>\n<td>Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: <code>{\"img\": \"/root/data1\"}</code>.</td>\n</tr>\n<tr>\n<td>list</td>\n<td>Supports passing in a list, where the elements of the list need to be the above types of data, such as <code>[numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]</code>, <code>[\"/root/data1\", \"/root/data2\"]</code>, <code>[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]</code>.</td>\n</tr>\n</tbody>\n</table>\n\nAdditionally, the `predict` method supports the `index_dir` parameter for setting the retrieval database:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, the default retrieval database specified through the <code>index_dir</code> parameter in <code>create_pipeline()</code> will be used.</td>\n</tr>\n</tbody>\n</table>\n\n(4) Obtain the prediction results by calling the `predict` method: The `predict` method is a `generator`, so prediction results need to be obtained by iteration. The `predict` method predicts data in batches.\n\n(5) Process the prediction results: The prediction result for each sample is of `dict` type and supports printing or saving to a file. The supported save types are related to the specific pipeline, such as:\n\n<table>\n<thead>\n<tr>\n<th>Method</th>\n<th>Description</th>\n<th>Method Parameters</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>print</td>\n<td>Print the results to the terminal</td>\n<td><code>- format_json</code>: bool type, whether to use json indentation formatting for the output content, default is True;<br><code>- indent</code>: int type, json formatting setting, only effective when format_json is True, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, only effective when format_json is True, default is False;</td>\n</tr>\n<tr>\n<td>save_to_json</td>\n<td>Save the results as a json-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;<br><code>- indent</code>: int type, json formatting setting, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, default is False;</td>\n</tr>\n<tr>\n<td>save_to_img</td>\n<td>Save the results as an image-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;</td>\n</tr>\n</tbody>\n</table>\n\nIf you have a configuration file, you can customize the configurations for the general image recognition pipeline by modifying the `pipeline` parameter value in the `create_pipeline` method to the path of the pipeline configuration file.\n\nFor example, if your configuration file is saved at `./my_path/PP-ShiTuV2.yaml`, you only need to execute:\n\n```python\nfrom paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/PP-ShiTuV2.yaml\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#223-add-or-remove-features-from-the-feature-library","title":"2.2.3 Add or Remove Features from the Feature Library","text":"

If you want to add more images to the feature library, you can call the append_index function; to remove image features, you can call the remove_index function.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\"PP-ShiTuV2\")\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.append_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.remove_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\n

The parameter descriptions for the above methods are as follows:

Parameter Description Type Default Value data_root The root directory of the dataset to be added. The data organization should be the same as when building the feature library, refer to Section 2.3 Data Organization for Building the Feature Library str None index_dir The storage directory for the feature library. In append_index and remove_index, it is also the path of the feature library to be modified (or deleted). str None index_type Supports HNSW32, IVF, Flat. Among them, HNSW32 has faster retrieval speed and higher accuracy but does not support the remove_index() operation; IVF has faster retrieval speed but relatively lower accuracy, and supports append_index() and remove_index() operations; Flat has lower retrieval speed but higher accuracy, and supports append_index() and remove_index() operations. str HNSW32 metric_type Supports: IP, Inner Product; L2, Euclidean Distance. str IP"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#23-data-organization-for-building-the-feature-library","title":"2.3 Data Organization for Building the Feature Library","text":"

The PaddleX general image recognition pipeline requires a pre-built feature library for feature retrieval. If you want to build a feature vector library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the image to be retrieved and the image label, separated by a space, for example: \u201c0/0.jpg label\u201d\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result property, which is an object type that stores operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • buildIndex

Build feature vector index.

POST /shitu-index-build

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning indexKey string The key corresponding to the index, used to identify the established index. Can be used as input for other operations. idMap object Mapping from vector ID to label.
  • addImagesToIndex

Add images (corresponding feature vectors) to the index.

POST /shitu-index-add

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • removeImagesFromIndex

Remove images (corresponding feature vectors) from the index.

POST /shitu-index-remove

  • The properties of the request body are as follows:
Name Type Meaning Required ids array IDs of the vectors to be removed from the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • infer

Perform image recognition.

POST /shitu-infer

  • The properties of the request body are as follows:
Name Type Meaning Required image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning detectedObjects array Information of the detected targets. image string Recognition result image. The image is in JPEG format, encoded with Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Meaning bbox array Target location. The elements in the array are the x-coordinate of the upper-left corner, the y-coordinate of the upper-left corner, the x-coordinate of the lower-right corner, and the y-coordinate of the lower-right corner, respectively. recResults array Recognition results. score number Detection score.

Each element in recResults is an object with the following properties:

Name Type Meaning label string Label. score number Recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\n\nbase_image_label_pairs = [\n    {\"image\": \"./demo0.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo1.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo2.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nimage_label_pairs_to_add = [\n    {\"image\": \"./demo3.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nids_to_remove = [1]\ninfer_image_path = \"./demo4.jpg\"\noutput_image_path = \"./out.jpg\"\n\nfor pair in base_image_label_pairs:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": base_image_label_pairs}\nresp_index_build = requests.post(f\"{API_BASE_URL}/shitu-index-build\", json=payload)\nif resp_index_build.status_code != 200:\n    print(f\"Request to shitu-index-build failed with status code {resp_index_build}.\")\n    pprint.pp(resp_index_build.json())\n    sys.exit(1)\nresult_index_build = resp_index_build.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_build['idMap'])}\")\n\nfor pair in image_label_pairs_to_add:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": image_label_pairs_to_add, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_add = requests.post(f\"{API_BASE_URL}/shitu-index-add\", json=payload)\nif resp_index_add.status_code != 200:\n    print(f\"Request to shitu-index-add failed with status code {resp_index_add}.\")\n    pprint.pp(resp_index_add.json())\n    sys.exit(1)\nresult_index_add = resp_index_add.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_add['idMap'])}\")\n\npayload = {\"ids\": ids_to_remove, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_remove = requests.post(f\"{API_BASE_URL}/shitu-index-remove\", json=payload)\nif resp_index_remove.status_code != 200:\n    print(f\"Request to shitu-index-remove failed with status code {resp_index_remove}.\")\n    pprint.pp(resp_index_remove.json())\n    sys.exit(1)\nresult_index_remove = resp_index_remove.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_remove['idMap'])}\")\n\nwith open(infer_image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_infer = requests.post(f\"{API_BASE_URL}/shitu-infer\", json=payload)\nif resp_infer.status_code != 200:\n    print(f\"Request to shitu-infer failed with status code {resp_infer}.\")\n    pprint.pp(resp_infer.json())\n    sys.exit(1)\nresult_infer = resp_infer.json()[\"result\"]\n\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result_infer[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\npprint.pp(result_infer[\"detectedObjects\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Image Recognition Pipeline do not meet your expectations in terms of precision or speed. You can further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-Tuning","text":"

Since the General Image Recognition Pipeline consists of two modules (the mainbody detection module and the image feature module), the suboptimal performance of the pipeline may stem from either module.

You can analyze images with poor recognition results. After analysising, if you find that many mainbody objects are not detected, it may indicate deficiencies in the mainbody detection model. You need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the mainbody detection model. If there are mismatches in the detected mainbody objects, it suggests that the image feature model requires further improvement. You should refer to the Custom Development section in the Image Feature Module Development Tutorial and fine-tune the image feature model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After you complete the fine-tuning training with your private dataset, you will obtain local model files.

To use the fine-tuned model, you only need to modify the pipeline configuration file by replacing with the paths to your fine-tuned model:

Pipeline:\n  device: \"gpu:0\"\n  det_model: \"./PP-ShiTuV2_det_infer/\"        # Can be modified to the local path of the fine-tuned mainbody detection model\n  rec_model: \"./PP-ShiTuV2_rec_infer/\"        # Can be modified to the local path of the fine-tuned image feature model\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n
Subsequently, refer to the command-line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply by modifying the --device parameter, seamless switching between different hardware can be achieved.

For example, when running the General Image Recognition Pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the device in the script to npu:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ShiTuV2\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n)\n

If you want to use the General Image Recognition Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html","title":"Image Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#1-introduction-to-image-anomaly-detection-pipeline","title":"1. Introduction to Image Anomaly Detection Pipeline","text":"

Image anomaly detection is an image processing technique that identifies unusual or non-conforming patterns within images through analysis. It is widely applied in industrial quality inspection, medical image analysis, and security monitoring. By leveraging machine learning and deep learning algorithms, image anomaly detection can automatically recognize potential defects, anomalies, or abnormal behaviors in images, enabling us to promptly identify issues and take corresponding actions. The image anomaly detection system is designed to automatically detect and mark anomalies in images, enhancing work efficiency and accuracy.

The image anomaly detection pipeline includes an unsupervised anomaly detection module, with the following model benchmarks:

Model NameModel Download Link Avg (%) Model Size (M) STFPMInference Model/Trained Model 96.2 21.5 M

Note: The above accuracy metrics are the average anomaly scores on the MVTec AD validation set. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the anomaly detection pipeline, allowing for quick experience of its effects. You can use the command line or Python to experience the image anomaly detection pipeline locally.

Before using the image anomaly detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config anomaly_detection\n

After execution, the image anomaly detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config anomaly_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./anomaly_detection.yaml, simply execute:

paddlex --pipeline ./anomaly_detection.yaml --input uad_grid.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'uad_grid.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference using the pipeline. Taking the image anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"anomaly_detection\")\n\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n

The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the pipeline object for inference prediction: The predict method takes x as its parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path to the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/anomaly_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/anomaly_detection.yaml\")\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs anomaly detection on images.

POST /image-anomaly-detection

  • Request body properties:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order), where 255 represents an anomaly point, and 0 represents a non-anomaly point. size array Image shape. The elements in the array are the height and width of the image in order. image string Anomaly detection result image. The image is in JPEG format and encoded in Base64.

Example of result:

{\n\"labelMap\": [\n0,\n0,\n255,\n0\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-anomaly-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-anomaly-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-anomaly-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-anomaly-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-anomaly-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-anomaly-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the image anomaly detection pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the image anomaly detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the image anomaly detection pipeline includes an unsupervised image anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Unsupervised Anomaly Detection Module Tutorial and use your private dataset to fine-tune the image anomaly detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding position in the pipeline configuration file:

......\nPipeline:\n  model: STFPM   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the image anomaly detection pipeline, the Python command is:

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline anomaly_detection --input uad_grid.png --device npu:0\n
If you want to use the image anomaly detection pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html","title":"General Image Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#1-introduction-to-the-general-image-classification-pipeline","title":"1. Introduction to the General Image Classification Pipeline","text":"

Image classification is a technique that assigns images to predefined categories. It is widely applied in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification.

The General Image Classification Pipeline includes an image classification module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Image Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Image Classification Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config image_classification\n

After execution, the image classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file take effect. For example, if the configuration file's save path is ./image_classification.yaml, simply execute:

paddlex --pipeline ./image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If you still specify parameters, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': [0.62736, 0.03752, 0.03256, 0.0323, 0.03194], 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the results. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string The image classification result image. The image is in JPEG format and encoded using Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image classification pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using data from your specific domain or application scenario to improve the recognition performance of the general image classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image classification pipeline includes an image classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Classification Module Development Tutorial and use your private dataset to fine-tune the image classification model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the image classification pipeline, the Python command is:

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Classification Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html","title":"General Image Multi-Label Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#1-introduction-to-the-general-image-multi-label-classification-pipeline","title":"1. Introduction to the General Image Multi-Label Classification Pipeline","text":"

Image multi-label classification is a technique that assigns multiple relevant categories to a single image simultaneously, widely used in image annotation, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, for example, an image containing both \"dog\" and \"outdoor\" labels. By leveraging deep learning models, image multi-label classification automatically extracts image features and performs accurate classification, providing users with more comprehensive information. This technology is of great significance in applications such as intelligent search engines and automatic content generation.

The General Image Multi-Label Classification Pipeline includes a module for image multi-label classification. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link mAP (%) Model Storage Size (M) CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 - PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 ResNet50_MLInference Model/Trained Model 83.50 108.9

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017. The GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the General Image Multi-Label Classification Pipeline locally using command line or Python.

Before using the General Image Multi-Label Classification Pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the effects of the image multi-label classification pipeline with a single command:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image multi-label classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default configuration file for the image multi-label classification pipeline is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config multi_label_image_classification\n

After execution, the configuration file for the image multi-label classification pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config multi_label_image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./multi_label_image_classification.yaml, simply execute:

paddlex --pipeline ./multi_label_image_classification.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n

Where --model, --device, and other parameters are not specified, the parameters in the configuration file will be used. If parameters are specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [21, 0, 30, 24], 'scores': [0.99257, 0.70596, 0.63001, 0.57852], 'label_names': ['bear', 'person', 'skis', 'backpack']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general image multi-label classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"multi_label_image_classification\")\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result visualization image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path of the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the multi-label classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the file path of the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key of the dictionary needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/multi_label_image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/multi_label_image_classification.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have strict standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed to 0. errorMsg string Error message. Fixed to \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /multilabel-image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the result. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string Image classification result image. The image is in JPEG format and encoded in Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/multilabel-image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/multilabel-image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/multilabel-image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/multilabel-image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/multilabel-image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/multilabel-image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/multilabel-image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a way to place computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image multi-label classification pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general image multi-label classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image multi-label classification pipeline includes an image multi-label classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Multi-Label Classification Module Development Tutorial to fine-tune the image multi-label classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0_ML   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the image multi-label classification pipeline, the Python command is:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/padd\n

At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the Python command to npu:0:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Multi-label Classification Pipeline on more diverse hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html","title":"General Instance Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#1-introduction-to-the-general-instance-segmentation-pipeline","title":"1. Introduction to the General Instance Segmentation Pipeline","text":"

Instance segmentation is a computer vision task that not only identifies the object categories in an image but also distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately label each car, person, or animal in an image, ensuring they are independently processed at the pixel level. For example, in a street scene image containing multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robotic vision, often relying on deep learning models (such as Mask R-CNN) to achieve efficient pixel classification and instance differentiation through Convolutional Neural Networks (CNNs), providing powerful support for understanding complex scenes.

The General Instance Segmentation Pipeline includes a Object Detection module. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of the effects. You can experience the effects of the General Instance Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Instance Segmentation Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline instance_segmentation --input  general_instance_segmentation_004.png --device gpu:0\n

Parameter Description:

--pipeline: The name of the pipeline, here it refers to the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default instance segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config instance_segmentation\n

After execution, the instance segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config instance_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./instance_segmentation.yaml, simply execute:

paddlex --pipeline ./instance_segmentation.yaml --input general_instance_segmentation_004.png --device gpu:0\n

Where --model, --device, and other parameters do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_instance_segmentation_004.png', 'boxes': [{'cls_id': 0, 'label': 'person', 'score': 0.8698326945304871, 'coordinate': [339, 0, 639, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8571141362190247, 'coordinate': [0, 0, 195, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8202633857727051, 'coordinate': [88, 113, 401, 574]}, {'cls_id': 0, 'label': 'person', 'score': 0.7108577489852905, 'coordinate': [522, 21, 767, 574]}, {'cls_id': 27, 'label': 'tie', 'score': 0.554280698299408, 'coordinate': [247, 311, 355, 574]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general instance segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"instance_segmentation\")\n\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualization image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/instance_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/instance_segmentation.yaml\")\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs instance segmentation on an image.

POST /instance-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description instances array Information about the locations and categories of instances. image string The result image of instance segmentation. The image is in JPEG format and encoded in Base64.

Each element in instances is an object with the following properties:

Name Type Description bbox array The location of the instance. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the instance category. score number The score of the instance. mask object The segmentation mask of the instance.

The properties of mask are as follows:

Name Type Description rleResult str The run-length encoding result of the mask. size array The shape of the mask. The elements in the array are the height and width of the mask, respectively.

An example of result is as follows:

{\n\"instances\": [\n{\n\"bbox\": [\n162.39381408691406,\n83.88176727294922,\n624.0797119140625,\n343.4986877441406\n],\n\"categoryId\": 33,\n\"score\": 0.8691174983978271,\n\"mask\": {\n\"rleResult\": \"xxxxxx\",\n\"size\": [\n259,\n462\n]\n}\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/instance-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nInstances:\")\nprint(result[\"instances\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/instance-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto instances = result[\"instances\"];\n        std::cout << \"\\nInstances:\" << std::endl;\n        for (const auto& inst : instances) {\n            std::cout << inst << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/instance-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode instances = result.get(\"instances\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nInstances: \" + instances.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/instance-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Instances []map[string]interface{} `json:\"instances\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nInstances:\")\n    for _, inst := range respData.Result.Instances {\n        fmt.Println(inst)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/instance-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nInstances:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"instances\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/instance-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nInstances:\");\n    console.log(result[\"instances\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/instance-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nInstances:\\n\";\nprint_r($result[\"instances\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#4-ccustom-development","title":"4. CCustom Development","text":"

If the default model weights provided by the general instance segmentation pipeline do not meet your requirements for accuracy or speed in your scenario, you can try to further fine-tune the existing model using data specific to your domain or application scenario to improve the recognition effect of the general instance segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general instance segmentation pipeline includes an instance segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Instance Segmentation Module Development Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: Mask-RT-DETR-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n

Then, refer to the command line method or Python script method in the local experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for instance segmentation pipeline inference, the Python command is:

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device npu:0\n

If you want to use the General Instance Segmentation Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html","title":"General Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#1-introduction-to-general-object-detection-pipeline","title":"1. Introduction to General Object Detection Pipeline","text":"

Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only requires recognizing what objects are present in an image, such as people, cars, and animals, but also accurately determining the specific position of each object within the image, typically represented by rectangular boxes. This technology is widely used in autonomous driving, surveillance systems, smart photo albums, and other fields, relying on deep learning models (e.g., YOLO, Faster R-CNN) that can efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.

ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Object Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Object Detection Pipeline online using the demo images provided by the official source, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Object Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command can quickly experience the effects of the object detection pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

Click to expand \ud83d\udc49
paddlex --get_pipeline_config object_detection\n

After execution, the object detection pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is ./object_detection.yaml, simply execute:

paddlex --pipeline ./object_detection.yaml --input general_object_detection_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_object_detection_002.png', 'boxes': [{'cls_id': 49, 'label': 'orange', 'score': 0.8188097476959229, 'coordinate': [661, 93, 870, 305]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7743489146232605, 'coordinate': [76, 274, 330, 520]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7270504236221313, 'coordinate': [285, 94, 469, 297]}, {'cls_id': 46, 'label': 'banana', 'score': 0.5570532083511353, 'coordinate': [310, 361, 685, 712]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5484835505485535, 'coordinate': [764, 285, 924, 440]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5160726308822632, 'coordinate': [853, 169, 987, 303]}, {'cls_id': 60, 'label': 'dining table', 'score': 0.5142655968666077, 'coordinate': [0, 0, 1072, 720]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5101479291915894, 'coordinate': [57, 23, 213, 176]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#222-integration-via-python-scripts","title":"2.2.2 Integration via Python Scripts","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking General Object Detection as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"object_detection\")\n\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method parameter x is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/object_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/object_detection.yaml\")\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Object Detection pipeline do not meet your requirements for precision or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the General Object Detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Object Detection pipeline includes an object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PicoDet-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the General Object Detection pipeline, the Python command is:

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline object_detection --input general_object_detection_002.png --device npu:0\n
If you want to use the General Object Detection Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#1-introduction-to-pedestrian-attribute-recognition-pipeline","title":"1. Introduction to Pedestrian Attribute Recognition Pipeline","text":"

Pedestrian attribute recognition is a key function in computer vision systems, used to locate and label specific characteristics of pedestrians in images or videos, such as gender, age, clothing color, and style. This task not only requires accurately detecting pedestrians but also identifying detailed attribute information for each pedestrian. The pedestrian attribute recognition pipeline is an end-to-end serial system for locating and recognizing pedestrian attributes, widely used in smart cities, security surveillance, and other fields, significantly enhancing the system's intelligence level and management efficiency.

The pedestrian attribute recognition pipeline includes a pedestrian detection module and a pedestrian attribute recognition module, with several models in each module. Which models to use specifically can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Pedestrian Detection Module:

ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Pedestrian detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Pedestrian Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories.

Note: The above accuracy metrics are mA on PaddleX's internally built dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can quickly demonstrate their effectiveness. You can experience the pedestrian attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the pedestrian attribute recognition pipeline locally, ensure you have completed the installation of the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

You can quickly experience the pedestrian attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the pedestrian attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default pedestrian attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config pedestrian_attribute_recognition\n

After execution, the pedestrian attribute recognition pipeline configuration file will be saved in the current path. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config pedestrian_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./pedestrian_attribute_recognition.yaml, simply execute:

paddlex --pipeline ./pedestrian_attribute_recognition.yaml --input pedestrian_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference of the pipeline. Taking the pedestrian attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"pedestrian_attribute_recognition\")\n\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized image of the result\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the pedestrian attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the pedestrian attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of type dict and supports printing or saving as a file. The supported save types are related to the specific pipeline, such as:

Method Description Method Parameters print Print the results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save the results as a json-formatted file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file name;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save the results as an image file

If you have obtained the configuration file, you can customize various configurations for the pedestrian attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved as ./my_path/pedestrian_attribute_recognition*.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/pedestrian_attribute_recognition.yaml\")\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pedestrian attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pedestrian attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get pedestrian attribute recognition results.

POST /pedestrian-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description pedestrians array Information about the pedestrian's location and attributes. image string The pedestrian attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in pedestrians is an object with the following properties:

Name Type Description bbox array The location of the pedestrian. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The pedestrian attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/pedestrian-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected pedestrians:\")\nprint(result[\"pedestrians\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the pedestrian attribute recognition pipeline includes both a pedestrian attribute recognition module and a pedestrian detection module, the unexpected performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the pedestrian detection model. In this case, you need to refer to the Secondary Development section in the Human Detection Module Development Tutorial and use your private dataset to fine-tune the pedestrian detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Secondary Development section in the Pedestrian Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the pedestrian attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning training with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-YOLOE-L_human\n  cls_model: PP-LCNet_x1_0_pedestrian_attribute  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports multiple mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference in the pedestrian attribute recognition pipeline, the command used is:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device npu:0\n
If you want to use the pedestrian attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html","title":"General Semantic Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#1-introduction-to-the-general-semantic-segmentation-pipeline","title":"1. Introduction to the General Semantic Segmentation Pipeline","text":"

Semantic segmentation is a computer vision technique that aims to assign each pixel in an image to a specific category, enabling a detailed understanding of the image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing regions of the same category to be fully labeled. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, the sky, and roads pixel by pixel, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (such as SegFormer, etc.) to extract features by CNN or Transformer, and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effects of the General Semantic Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Semantic Segmentation Pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Semantic Segmentation Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the semantic segmentation pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n

Parameter Explanation:

--pipeline: The name of the pipeline, here it is the semantic segmentation pipeline\n--input: The local path or URL of the input image to be processed\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs), or choose to use CPU (--device cpu)\n

When executing the above command, the default semantic segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config semantic_segmentation\n

After execution, the semantic segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./semantic_segmentation.yaml, simply execute:

paddlex --pipeline ./semantic_segmentation.yaml --input makassaridn-road_demo.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_object_detection_002.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general semantic segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"semantic_segmentation\")\n\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by calling it. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/semantic_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs semantic segmentation on an image.

POST /semantic-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order). size array Image shape. The elements in the array are the height and width of the image, respectively. image string The semantic segmentation result image. The image is in JPEG format and encoded using Base64.

An example of result is as follows:

{\n\"labelMap\": [\n0,\n0,\n1,\n2\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/semantic-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/semantic-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/semantic-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/semantic-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/semantic-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/semantic-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/semantic-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general semantic segmentation pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general semantic segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general semantic segmentation pipeline includes a semantic segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Semantic Segmentation Module Development Tutorial (GitHub can directly link to headings) and use your private dataset to fine-tune the semantic segmentation model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LiteSeg-T  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for semantic segmentation pipeline inference, the Python command is:

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device npu:0\n
If you want to use the General Semantic Segmentation Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html","title":"Small Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#1-introduction-to-small-object-detection-pipeline","title":"1. Introduction to Small Object Detection Pipeline","text":"

Small object detection is a specialized technique for identifying tiny objects within images, widely applied in fields such as surveillance, autonomous driving, and satellite image analysis. It can accurately locate and classify small-sized objects like pedestrians, traffic signs, or small animals within complex scenes. By leveraging deep learning algorithms and optimized Convolutional Neural Networks (CNNs), small object detection significantly enhances the recognition capabilities for small objects, ensuring no critical information is overlooked in practical applications. This technology plays a pivotal role in enhancing safety and automation levels.

The small object detection pipeline includes a small object detection module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, opt for a model with a smaller storage size.

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 458.521 11172.7 340.5 M

Note: The above accuracy metrics are based on the VisDrone-DET validation set mAP(0.5:0.95). All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the small object detection pipeline's effects through command line or Python locally.

Before using the small object detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the small object detection pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline small_object_detection --input small_object_detection.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the small object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, you can choose to use CPU (--device cpu).\n

When executing the above command, the default small object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config small_object_detection\n

After execution, the small object detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config small_object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file's save path is ./small_object_detection.yaml, simply execute:

paddlex --pipeline ./small_object_detection.yaml --input small_object_detection.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file.```markdown

After running, the result will be:

{'input_path': 'small_object_detection.jpg', 'boxes': [{'cls_id': 3, 'label': 'car', 'score': 0.9243856072425842, 'coordinate': [624, 638, 682, 741]}, {'cls_id': 3, 'label': 'car', 'score': 0.9206348061561584, 'coordinate': [242, 561, 356, 613]}, {'cls_id': 3, 'label': 'car', 'score': 0.9194547533988953, 'coordinate': [670, 367, 705, 400]}, {'cls_id': 3, 'label': 'car', 'score': 0.9162291288375854, 'coordinate': [459, 259, 523, 283]}, {'cls_id': 4, 'label': 'van', 'score': 0.9075379371643066, 'coordinate': [467, 213, 498, 242]}, {'cls_id': 4, 'label': 'van', 'score': 0.9066920876502991, 'coordinate': [547, 351, 577, 397]}, {'cls_id': 3, 'label': 'car', 'score': 0.9041045308113098, 'coordinate': [502, 632, 562, 736]}, {'cls_id': 3, 'label': 'car', 'score': 0.8934890627861023, 'coordinate': [613, 383, 647, 427]}, {'cls_id': 3, 'label': 'car', 'score': 0.8803309202194214, 'coordinate': [640, 280, 671, 309]}, {'cls_id': 3, 'label': 'car', 'score': 0.8727016448974609, 'coordinate': [1199, 256, 1259, 281]}, {'cls_id': 3, 'label': 'car', 'score': 0.8705748915672302, 'coordinate': [534, 410, 570, 461]}, {'cls_id': 3, 'label': 'car', 'score': 0.8654043078422546, 'coordinate': [669, 248, 702, 271]}, {'cls_id': 3, 'label': 'car', 'score': 0.8555219769477844, 'coordinate': [525, 243, 550, 270]}, {'cls_id': 3, 'label': 'car', 'score': 0.8522038459777832, 'coordinate': [526, 220, 553, 243]}, {'cls_id': 3, 'label': 'car', 'score': 0.8392605185508728, 'coordinate': [557, 141, 575, 158]}, {'cls_id': 3, 'label': 'car', 'score': 0.8353804349899292, 'coordinate': [537, 120, 553, 133]}, {'cls_id': 3, 'label': 'car', 'score': 0.8322211503982544, 'coordinate': [585, 132, 603, 147]}, {'cls_id': 3, 'label': 'car', 'score': 0.8298957943916321, 'coordinate': [701, 283, 736, 313]}, {'cls_id': 3, 'label': 'car', 'score': 0.8217393159866333, 'coordinate': [885, 347, 943, 377]}, {'cls_id': 3, 'label': 'car', 'score': 0.820313572883606, 'coordinate': [493, 150, 511, 168]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.8183429837226868, 'coordinate': [203, 701, 224, 743]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.815082848072052, 'coordinate': [185, 710, 201, 744]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7892289757728577, 'coordinate': [311, 371, 344, 407]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7812919020652771, 'coordinate': [345, 380, 388, 405]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7748346328735352, 'coordinate': [295, 500, 309, 532]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7688500285148621, 'coordinate': [851, 436, 863, 466]}, {'cls_id': 3, 'label': 'car', 'score': 0.7466475367546082, 'coordinate': [565, 114, 580, 128]}, {'cls_id': 3, 'label': 'car', 'score': 0.7156463265419006, 'coordinate': [483, 66, 495, 78]}, {'cls_id': 3, 'label': 'car', 'score': 0.704211950302124, 'coordinate': [607, 138, 642, 152]}, {'cls_id': 3, 'label': 'car', 'score': 0.7021926045417786, 'coordinate': [505, 72, 518, 83]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6897469162940979, 'coordinate': [802, 460, 815, 488]}, {'cls_id': 3, 'label': 'car', 'score': 0.671891450881958, 'coordinate': [574, 123, 593, 136]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.6712754368782043, 'coordinate': [445, 317, 472, 334]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6695684790611267, 'coordinate': [479, 309, 489, 332]}, {'cls_id': 3, 'label': 'car', 'score': 0.6273623704910278, 'coordinate': [654, 210, 677, 234]}, {'cls_id': 3, 'label': 'car', 'score': 0.6070230603218079, 'coordinate': [640, 166, 667, 185]}, {'cls_id': 3, 'label': 'car', 'score': 0.6064521670341492, 'coordinate': [461, 59, 476, 71]}, {'cls_id': 3, 'label': 'car', 'score': 0.5860581398010254, 'coordinate': [464, 87, 484, 100]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.5792551636695862, 'coordinate': [390, 390, 419, 408]}, {'cls_id': 3, 'label': 'car', 'score': 0.5559225678443909, 'coordinate': [481, 125, 496, 140]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5531904697418213, 'coordinate': [869, 306, 880, 331]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5468509793281555, 'coordinate': [895, 294, 904, 319]}, {'cls_id': 3, 'label': 'car', 'score': 0.5451828241348267, 'coordinate': [505, 94, 518, 108]}, {'cls_id': 3, 'label': 'car', 'score': 0.5398445725440979, 'coordinate': [657, 188, 681, 208]}, {'cls_id': 4, 'label': 'van', 'score': 0.5318890810012817, 'coordinate': [518, 88, 534, 102]}, {'cls_id': 3, 'label': 'car', 'score': 0.5296525359153748, 'coordinate': [527, 71, 540, 81]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.5168400406837463, 'coordinate': [528, 320, 563, 346]}, {'cls_id': 3, 'label': 'car', 'score': 0.5088561177253723, 'coordinate': [511, 84, 530, 95]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.502006471157074, 'coordinate': [841, 266, 850, 283]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can quickly enable inference on the production line. Taking the General Small Object Detection Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"small_object_detection\")\n\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/small_object_detection, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/small_object_detection.yaml\")\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment directly.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /small-object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/small-object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/small-object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/small-object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/small-object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/small-object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/small-object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/small-object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Small Object Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the small object detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Small Object Detection Pipeline includes a small object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Small Object Detection Module Tutorial and use your private dataset to fine-tune the small object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-YOLOE_plus_SOD-L  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the small object detection pipeline, the Python command would be:

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline multilabel_classification --input small_object_detection.jpg --device npu:0\n

If you want to use the General Small Object Detection Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#1-introduction-to-vehicle-attribute-recognition-pipeline","title":"1. Introduction to Vehicle Attribute Recognition Pipeline","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, and license plate number. This task not only requires accurately detecting vehicles but also identifying detailed attribute information for each vehicle. The vehicle attribute recognition pipeline is an end-to-end serial system for locating and recognizing vehicle attributes, widely used in traffic management, intelligent parking, security surveillance, autonomous driving, and other fields. It significantly enhances system efficiency and intelligence levels, driving the development and innovation of related industries.

The vehicle attribute recognition pipeline includes a vehicle detection module and a vehicle attribute recognition module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Vehicle Detection Module:

ModelModel Download Link mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicleInference Model/Trained Model 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicleInference Model/Trained Model 63.9 32.6 775.6 196.02

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Vehicle Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained models provided by PaddleX can quickly demonstrate results. You can experience the effects of the vehicle attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the vehicle attribute recognition pipeline locally, ensure you have installed the PaddleX wheel package according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#221-experience-via-command-line","title":"2.2.1 Experience via Command Line","text":"

You can quickly experience the vehicle attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the vehicle attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The index of the GPU to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs). You can also choose to use the CPU (--device cpu).\n

When executing the above Python script, the default vehicle attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config vehicle_attribute_recognition\n

After execution, the vehicle attribute recognition pipeline configuration file will be saved in the current directory. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config vehicle_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the saved path of the configuration file is ./vehicle_attribute_recognition.yaml, just execute:

paddlex --pipeline ./vehicle_attribute_recognition.yaml --input vehicle_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#222-integrating-via-python-script","title":"2.2.2 Integrating via Python Script","text":"

A few lines of code suffice for rapid inference on the production line, taking the vehicle attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"vehicle_attribute_recognition\")\n\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized result image\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the vehicle attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the vehicle attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

(4) Processing the Prediction Results: The prediction result for each sample is in dict format, which supports printing or saving to a file. The supported file types for saving depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save results as a json file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save results as an image file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;

If you have obtained the configuration file, you can customize the configurations for the vehicle attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved at ./my_path/vehicle_attribute_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/vehicle_attribute_recognition.yaml\")\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the vehicle attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the vehicle attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get vehicle attribute recognition results.

POST /vehicle-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description vehicles array Information about the vehicle's location and attributes. image string The vehicle attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in vehicles is an object with the following properties:

Name Type Description bbox array The location of the vehicle. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The vehicle attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/vehicle-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected vehicles:\")\nprint(result[\"vehicles\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the vehicle attribute recognition pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the vehicle attribute recognition pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the vehicle attribute recognition pipeline includes both a vehicle attribute recognition module and a vehicle detection module, the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the vehicle detection model. In this case, you need to refer to the Custom Development section in the Vehicle Detection Module Development Tutorial and use your private dataset to fine-tune the vehicle detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Custom Development section in the Vehicle Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the vehicle attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the path to the default model weights with the local path to the fine-tuned model weights:

......\nPipeline:\n  det_model: PP-YOLOE-L_vehicle\n  cls_model: PP-LCNet_x1_0_vehicle_attribute   # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line or Python script methods in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference with the vehicle attribute recognition pipeline, the command is:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device npu:0\n
If you want to use the vehicle attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html","title":"PP-ChatOCRv3-doc Pipeline utorial","text":""},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#1-introduction-to-pp-chatocrv3-doc-pipeline","title":"1. Introduction to PP-ChatOCRv3-doc Pipeline","text":"

PP-ChatOCRv3-doc is a unique intelligent analysis solution for documents and images developed by PaddlePaddle. It combines Large Language Models (LLM) and OCR technology to provide a one-stop solution for complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating with ERNIE Bot, it fuses massive data and knowledge to achieve high accuracy and wide applicability.

The PP-ChatOCRv3-doc pipeline includes modules for Table Structure Recognition, Layout Region Detection, Text Detection, Text Recognition, Seal Text Detection, Text Image Rectification, and Document Image Orientation Classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference speed. If you prioritize model storage size, choose a model with a smaller storage size. Some benchmarks for these models are as follows:

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effect of the Document Scene Information Extraction v3 pipeline online or locally using Python.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effect of the Document Scene Information Extraction v3 pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the PP-ChatOCRv3 pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

A few lines of code are all you need to complete the quick inference of the pipeline. Using the test file, taking the PP-ChatOCRv3-doc pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

After running, the output is as follows:

{'chat_res': {'\u200b\u4e59\u65b9\u200b': '\u200b\u80a1\u4efd\u200b\u6d4b\u8bd5\u200b\u6709\u9650\u516c\u53f8\u200b', '\u200b\u624b\u673a\u53f7\u200b': '19331729920'}, 'prompt': ''}\n

In the above Python script, the following steps are executed:

(1) Call the create_pipeline to instantiate a PP-ChatOCRv3-doc pipeline object, related parameters descriptions are as follows:

Parameter Type Default Description pipeline str None Pipeline name or pipeline configuration file path. If it's a pipeline name, it must be supported by PaddleX; llm_name str \"ernie-3.5\" Large Language Model name, we support ernie-4.0 and ernie-3.5, with more models on the way. llm_params dict {} API configuration; device(kwargs) str/None None Running device, support cpu, gpu, gpu:0, etc. None meaning automatic selection;

(2) Call the visual_predict of the PP-ChatOCRv3-doc pipeline object to visual predict, related parameters descriptions are as follows:

Parameter Type Default Description input Python Var - Support to pass Python variables directly, such as numpy.ndarray representing image data; input str - Support to pass the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg; input str - Support to pass the URL of the file to be predicted, such as: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf; input str - Support to pass the local directory, which should contain files to be predicted, such as: /root/data/; input dict - Support to pass a dictionary, where the key needs to correspond to the specific pipeline, such as: {\"img\": \"/root/data1\"}\uff1b input list - Support to pass a list, where the elements must be of the above types of data, such as: [numpy.ndarray, numpy.ndarray]\uff0c[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]\uff0c[\"/root/data1\", \"/root/data2\"]\uff0c[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]\uff1b use_doc_image_ori_cls_model bool True Whether or not to use the orientation classification model; use_doc_image_unwarp_model bool True Whether or not to use the unwarp model; use_seal_text_det_model bool True Whether or not to use the seal text detection model;

(3) Call the relevant functions of prediction object to save the prediction results. The related functions are as follows:

Function Parameter Description save_to_img save_path Save OCR prediction results, layout results, and table recognition results as image files, with the parameter save_path used to specify the save path; save_to_html save_path Save the table recognition results as an HTML file, with the parameter 'save_path' used to specify the save path; save_to_xlsx save_path Save the table recognition results as an Excel file, with the parameter 'save_path' used to specify the save path;

(4) Call the chat of PP-ChatOCRv3-doc pipeline object to query information with LLM, related parameters are described as follows:

Parameter Type Default Description key_list str - Keywords used to query. A string composed of multiple keywords with \",\" as separators, such as \"Party B, phone number\"; key_list list - Keywords used to query. A list composed of multiple keywords.

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through calls. The predict method predicts data in batches, so the prediction results are represented as a list of prediction results.

(4) Interact with the large model by calling the predict.chat method, which takes as input keywords (multiple keywords are supported) for information extraction. The prediction results are represented as a list of information extraction results.

(5) Process the prediction results: The prediction result for each sample is in the form of a dict, which supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves layout analysis, table recognition, etc. results as image files. save_path: str, the file path to save. save_to_html Saves table recognition results as HTML files. save_path: str, the file path to save. save_to_xlsx Saves table recognition results as Excel files. save_path: str, the file path to save.

When executing the above command, the default Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

paddlex --get_pipeline_config PP-ChatOCRv3-doc\n

After execution, the configuration file for the PP-ChatOCRv3-doc pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n
After obtaining the configuration file, you can customize the various configurations of the PP-ChatOCRv3-doc pipeline:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

In the above configuration, you can modify the models loaded by each module of the pipeline, as well as the large language model used. Please refer to the module documentation for the list of supported models for each module, and the list of supported large language models includes: ernie-4.0, ernie-3.5, ernie-3.5-8k, ernie-lite, ernie-tiny-8k, ernie-speed, ernie-speed-128k, ernie-char-8k.

After making modifications, simply update the pipeline parameter value in the create_pipeline method to the path of your pipeline configuration file to apply the configuration.

For example, if your configuration file is saved at ./my_path/PP-ChatOCRv3-doc.yaml, you would execute:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2 Local Experience.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • analyzeImages

Analyze images using computer vision models to obtain OCR, table recognition results, and extract key information from the images.

POST /chatocr-vision

  • Request body properties:
Name Type Description Required file string The URL of an accessible image file or PDF file, or the Base64 encoded content of the above file types. For PDF files with more than 10 pages, only the first 10 pages will be used. Yes fileType integer File type. 0 represents PDF files, 1 represents image files. If this property is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This feature is enabled by default. No useImgUnwrapping boolean Whether to enable text image correction. This feature is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This feature is enabled by default. No inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description visionResults array Analysis results obtained using the computer vision model. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file in sequence. visionInfo object Key information in the image, which can be used as input for other operations.

Each element in visionResults is an object with the following properties:

Name Type Description texts array Text locations, contents, and scores. tables array Table locations and contents. inputImage string Input image. The image is in JPEG format and encoded in Base64. ocrImage string OCR result image. The image is in JPEG format and encoded in Base64. layoutImage string Layout area detection result image. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text location. The elements in the array are the vertex coordinates of the polygon enclosing the text in sequence. text string Text content. score number Text recognition score.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table location. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box in sequence. html string Table recognition result in HTML format.
  • buildVectorStore

Builds a vector database.

POST /chatocr-vector

  • The request body properties are as follows:
Name Type Description Required visionInfo object Key information from the image. Provided by the analyzeImages operation. Yes minChars integer Minimum data length to enable the vector database. No llmRequestInterval number Interval time for calling the large language model API. No llmName string Name of the large language model. No llmParams object Parameters for the large language model API. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description vectorStore string Serialized result of the vector database, which can be used as input for other operations.
  • retrieveKnowledge

Perform knowledge retrieval.

POST /chatocr-retrieval

  • The request body properties are as follows:
Name Type Description Required keys array List of keywords. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. Yes llmName string Name of the large language model. No llmParams object API parameters for the large language model. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description retrievalResult string The result of knowledge retrieval, which can be used as input for other operations.
  • chat

Interact with large language models to extract key information.

POST /chatocr-chat

  • Request body properties:
Name Type Description Required keys array List of keywords. Yes visionInfo object Key information from images. Provided by the analyzeImages operation. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. No retrievalResult string Results of knowledge retrieval. Provided by the retrieveKnowledge operation. No taskDescription string Task prompt. No rules string Custom extraction rules, e.g., for output formatting. No fewShot string Example prompts. No llmName string Name of the large language model. No llmParams object API parameters for the large language model. No returnPrompts boolean Whether to return the prompts used. Enabled by default. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • On successful request processing, the result in the response body has the following properties:
Name Type Description chatResult object Extracted key information. prompts object Prompts used.

Properties of prompts:

Name Type Description ocr string OCR prompt. table string Table prompt. html string HTML prompt. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\nAPI_KEY = \"{Qianfan Platform API key}\"\nSECRET_KEY = \"{Qianfan Platform secret key}\"\nLLM_NAME = \"ernie-3.5\"\nLLM_PARAMS = {\n    \"apiType\": \"qianfan\",\n    \"apiKey\": API_KEY,\n    \"secretKey\": SECRET_KEY,\n}\n\nfile_path = \"./demo.jpg\"\nkeys = [\"\u200b\u7535\u8bdd\u200b\"]\n\nwith open(file_path, \"rb\") as file:\n    file_bytes = file.read()\n    file_data = base64.b64encode(file_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": file_data,\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\nresp_vision = requests.post(url=f\"{API_BASE_URL}/chatocr-vision\", json=payload)\nif resp_vision.status_code != 200:\n    print(\n        f\"Request to chatocr-vision failed with status code {resp_vision.status_code}.\"\n    )\n    pprint.pp(resp_vision.json())\n    sys.exit(1)\nresult_vision = resp_vision.json()[\"result\"]\n\nfor i, res in enumerate(result_vision[\"visionResults\"]):\n    print(\"Texts:\")\n    pprint.pp(res[\"texts\"])\n    print(\"Tables:\")\n    pprint.pp(res[\"tables\"])\n    ocr_img_path = f\"ocr_{i}.jpg\"\n    with open(ocr_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"ocrImage\"]))\n    layout_img_path = f\"layout_{i}.jpg\"\n    with open(layout_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"layoutImage\"]))\n    print(f\"Output images saved at {ocr_img_path} and {layout_img_path}\")\n\npayload = {\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"minChars\": 200,\n    \"llmRequestInterval\": 1000,\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_vector = requests.post(url=f\"{API_BASE_URL}/chatocr-vector\", json=payload)\nif resp_vector.status_code != 200:\n    print(\n        f\"Request to chatocr-vector failed with status code {resp_vector.status_code}.\"\n    )\n    pprint.pp(resp_vector.json())\n    sys.exit(1)\nresult_vector = resp_vector.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_retrieval = requests.post(url=f\"{API_BASE_URL}/chatocr-retrieval\", json=payload)\nif resp_retrieval.status_code != 200:\n    print(\n        f\"Request to chatocr-retrieval failed with status code {resp_retrieval.status_code}.\"\n    )\n    pprint.pp(resp_retrieval.json())\n    sys.exit(1)\nresult_retrieval = resp_retrieval.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"retrievalResult\": result_retrieval[\"retrievalResult\"],\n    \"taskDescription\": \"\",\n    \"rules\": \"\",\n    \"fewShot\": \"\",\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n    \"returnPrompts\": True,\n}\nresp_chat = requests.post(url=f\"{API_BASE_URL}/chatocr-chat\", json=payload)\nif resp_chat.status_code != 200:\n    print(\n        f\"Request to chatocr-chat failed with status code {resp_chat.status_code}.\"\n    )\n    pprint.pp(resp_chat.json())\n    sys.exit(1)\nresult_chat = resp_chat.json()[\"result\"]\nprint(\"\\nPrompts:\")\npprint.pp(result_chat[\"prompts\"])\nprint(\"Final result:\")\nprint(result_chat[\"chatResult\"])\n
Note: Please fill in your API key and secret key at `API_KEY` and `SECRET_KEY`.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the PP-ChatOCRv3-doc Pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can attempt to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the PP-ChatOCRv3-doc Pipeline comprises six modules, unsatisfactory performance may stem from any of these modules (note that the text image rectification module does not support customization at this time).

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., row/column misidentification, cell position errors) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.

  • Misplaced layout elements (e.g., incorrect positioning of tables or seals) may suggest issues with the layout detection module. Consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.

  • Frequent undetected text (i.e., text leakage) may indicate limitations in the text detection model. Refer to the Customization section in the Text Detection Module Development Tutorial and fine-tune the text detection model using your private dataset.

  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest that the text recognition model requires improvement. Follow the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.

  • Frequent recognition errors in detected seal text indicate that the seal text detection model needs further refinement. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.

  • Frequent misidentifications of document or certificate orientations with text regions suggest that the document image orientation classification model requires improvement. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the document image orientation classification model.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#42-model-deployment","title":"4.2 Model Deployment","text":"

After fine-tuning your models using your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the default model weights with those of your fine-tuned models:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_3cls  # Replace with the local path of your fine-tuned model\n  table_model: SLANet_plus  # Replace with the local path of your fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Replace with the local path of your fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Replace with the local path of your fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det  # Replace with the local path of your fine-tuned model\n  doc_image_ori_cls_model: null   # Replace with the local path of your fine-tuned model if applicable\n  doc_image_unwarp_model: null   # Replace with the local path of your fine-tuned model if applicable\n......\n

Subsequently, load the modified pipeline configuration file using the command-line interface or Python script as described in the local experience section.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Seamless switching between different hardware can be achieved by simply setting the --device parameter.

For example, to perform inference using the PP-ChatOCRv3-doc Pipeline on an NVIDIA GPU. At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the script to npu:

from paddlex import create_pipeline\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"},\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n

If you want to use the PP-ChatOCRv3-doc Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html","title":"General OCR Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#1-introduction-to-ocr-pipeline","title":"1. Introduction to OCR Pipeline","text":"

OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols.

The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, reaching state-of-the-art (SOTA) performance in open-source projects for general scenarios. Based on this project, developers from academia, industry, and research have rapidly deployed various OCR applications across fields such as general use, manufacturing, finance, transportation, and more.

The General OCR Pipeline comprises a text detection module and a text recognition module, each containing several models. The specific models to use can be selected based on the benchmark data provided below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model size, choose models with smaller storage requirements.

Text detection module:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices

Text recognition module:

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the OCR Pipeline, allowing you to quickly experience its effects. You can try the General OCR Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General OCR Pipeline online using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. You can download the deployment package from the cloud or use the local experience method in Section 2.2. If not satisfied, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General OCR Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"
  • Experience the OCR Pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter explanations:

--pipeline: The name of the pipeline, here it is OCR.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default OCR Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config OCR\n

After execution, the OCR Pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path --device gpu:0\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./OCR.yaml, simply execute:

paddlex --pipeline ./OCR.yaml --input general_ocr_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [[[5, 12], [88, 10], [88, 29], [5, 31]], [[208, 14], [249, 14], [249, 22], [208, 22]], [[695, 15], [824, 15], [824, 60], [695, 60]], [[158, 27], [355, 23], [356, 70], [159, 73]], [[421, 25], [659, 19], [660, 59], [422, 64]], [[337, 104], [460, 102], [460, 127], [337, 129]], [[486, 103], [650, 100], [650, 125], [486, 128]], [[675, 98], [835, 94], [835, 119], [675, 124]], [[64, 114], [192, 110], [192, 131], [64, 134]], [[210, 108], [318, 106], [318, 128], [210, 130]], [[82, 140], [214, 138], [214, 163], [82, 165]], [[226, 136], [328, 136], [328, 161], [226, 161]], [[404, 134], [432, 134], [432, 161], [404, 161]], [[509, 131], [570, 131], [570, 158], [509, 158]], [[730, 138], [771, 138], [771, 154], [730, 154]], [[806, 136], [817, 136], [817, 146], [806, 146]], [[342, 175], [470, 173], [470, 197], [342, 199]], [[486, 173], [616, 171], [616, 196], [486, 198]], [[677, 169], [813, 166], [813, 191], [677, 194]], [[65, 181], [170, 177], [171, 202], [66, 205]], [[96, 208], [171, 205], [172, 230], [97, 232]], [[336, 220], [476, 215], [476, 237], [336, 242]], [[507, 217], [554, 217], [554, 236], [507, 236]], [[87, 229], [204, 227], [204, 251], [87, 254]], [[344, 240], [483, 236], [483, 258], [344, 262]], [[66, 252], [174, 249], [174, 271], [66, 273]], [[75, 279], [264, 272], [265, 297], [76, 303]], [[459, 297], [581, 295], [581, 320], [459, 322]], [[101, 314], [210, 311], [210, 337], [101, 339]], [[68, 344], [165, 340], [166, 365], [69, 368]], [[345, 350], [662, 346], [662, 368], [345, 371]], [[100, 459], [832, 444], [832, 465], [100, 480]]], 'dt_scores': [0.8183103704439653, 0.7609575621092027, 0.8662357274035412, 0.8619508290334809, 0.8495855993183273, 0.8676840017933314, 0.8807986687956436, 0.822308525056085, 0.8686617037621976, 0.8279022169854463, 0.952332847006758, 0.8742692553015098, 0.8477013022907575, 0.8528771493227294, 0.7622965906848765, 0.8492388224448705, 0.8344203789965632, 0.8078477124353284, 0.6300434587457232, 0.8359967356998494, 0.7618617265751318, 0.9481573079350023, 0.8712182945408912, 0.837416955846334, 0.8292475059403851, 0.7860382856406026, 0.7350527486717117, 0.8701022267947695, 0.87172526903969, 0.8779847108088126, 0.7020437651809734, 0.6611684983372949], 'rec_text': ['www.997', '151', 'PASS', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', '\u200b\u8231\u4f4d\u200b CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200bSEATNO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200bDATE', 'MU 2379', '03DEC', 'W', '035', 'F', '1', '\u200b\u59cb\u53d1\u5730\u200bFROM', '\u200b\u767b\u673a\u53e3\u200b GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO.', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO.', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE1OMINUTESBEFOREDEPARTURETIME'], 'rec_score': [0.9617719054222107, 0.4199012815952301, 0.9652514457702637, 0.9978302121162415, 0.9853208661079407, 0.9445787072181702, 0.9714463949203491, 0.9841841459274292, 0.9564052224159241, 0.9959094524383545, 0.9386572241783142, 0.9825271368026733, 0.9356589317321777, 0.9985442161560059, 0.3965512812137604, 0.15236201882362366, 0.9976775050163269, 0.9547433257102966, 0.9974752068519592, 0.9646636843681335, 0.9907559156417847, 0.9895358681678772, 0.9374122023582458, 0.9909093379974365, 0.9796401262283325, 0.9899340271949768, 0.992210865020752, 0.9478569626808167, 0.9982215762138367, 0.9924325942993164, 0.9941263794898987, 0.96443772315979]}\n......\n

Among them, dt_polys is the detected text box coordinates, dt_polys is the detected text box coordinates, dt_scores is the confidence of the detected text box, rec_text is the detected text, rec_score is the detection Confidence in the text.

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"
  • Quickly perform inference on the production line with just a few lines of code, taking the general OCR production line as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the OCR production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the OCR production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/OCR.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/OCR.yaml\")\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the general OCR pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain OCR results from an image.

POST /ocr

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. image string OCR result image with detected text positions annotated. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score.

Example of result:

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"Beijing South Railway Station\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"Tianjin Railway Station\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general OCR pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general OCR pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general OCR pipeline consists of two modules (text detection and text recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many texts are undetected (i.e., text miss detection), it may indicate that the text detection model needs improvement. You should refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model. If many recognition errors occur in detected texts (i.e., the recognized text content does not match the actual text content), it suggests that the text recognition model requires further refinement. You should refer to the Customization section in the Text Recognition Module Development Tutorial and fine-tune the text recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be replaced with the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be replaced with the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n

Then, refer to the command line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for OCR pipeline inference, the Python command would be:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline OCR --input general_ocr_002.png --device npu:0\n

If you want to use the General OCR pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html","title":"Formula Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#1-introduction-to-the-formula-recognition-pipeline","title":"1. Introduction to the Formula Recognition Pipeline","text":"

Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. Leveraging computer vision and machine learning algorithms, formula recognition converts complex mathematical formula information into editable LaTeX format, facilitating further data processing and analysis for users.

The Formula Recognition Pipeline comprises a layout detection module and a formula recognition module.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

Layout Detection Module Models:

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.126 3827.25 470.2M

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout detection dataset, containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the formula recognition pipeline through command line or Python locally.

Before using the formula recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the formula recognition pipeline with a single command, using the test file, and replace --input with your local path for prediction:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n

Parameter Explanation:

--pipeline: The pipeline name, which is formula_recognition for this case.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, use CPU (--device cpu).\n

When executing the above command, the default formula recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config formula_recognition\n

After execution, the formula recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config formula_recognition --save_path ./my_path\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./formula_recognition.yaml, simply execute:

paddlex --pipeline ./formula_recognition.yaml --input general_formula_recognition.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After execution, the result is:

\ud83d\udc49Click to Expand
{'input_path': 'general_formula_recognition.png', 'layout_result': {'input_path': 'general_formula_recognition.png', 'boxes': [{'cls_id': 3, 'label': 'number', 'score': 0.7580855488777161, 'coordinate': [1028.3635, 205.46213, 1038.953, 222.99033]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.8882032632827759, 'coordinate': [272.75305, 204.50894, 433.7473, 226.17996]}, {'cls_id': 2, 'label': 'text', 'score': 0.9685840606689453, 'coordinate': [272.75928, 282.17773, 1041.9316, 374.44687]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559416770935059, 'coordinate': [272.39056, 385.54114, 1044.1521, 443.8598]}, {'cls_id': 2, 'label': 'text', 'score': 0.9610629081726074, 'coordinate': [272.40817, 467.2738, 1045.1033, 563.4855]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8916195034980774, 'coordinate': [503.45743, 594.6236, 1040.6804, 619.73895]}, {'cls_id': 2, 'label': 'text', 'score': 0.973675549030304, 'coordinate': [272.32007, 648.8599, 1040.8702, 775.15686]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9038916230201721, 'coordinate': [554.2307, 803.5825, 1040.4657, 855.3159]}, {'cls_id': 2, 'label': 'text', 'score': 0.9025381803512573, 'coordinate': [272.535, 875.1402, 573.1086, 898.3587]}, {'cls_id': 2, 'label': 'text', 'score': 0.8336610794067383, 'coordinate': [317.48013, 909.60864, 966.8498, 933.7868]}, {'cls_id': 2, 'label': 'text', 'score': 0.8779091238975525, 'coordinate': [19.704018, 653.322, 72.433235, 1215.1992]}, {'cls_id': 2, 'label': 'text', 'score': 0.8832409977912903, 'coordinate': [272.13028, 958.50806, 1039.7928, 1019.476]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9088466167449951, 'coordinate': [517.1226, 1042.3978, 1040.2208, 1095.7457]}, {'cls_id': 2, 'label': 'text', 'score': 0.9587949514389038, 'coordinate': [272.03336, 1112.9269, 1041.0201, 1206.8417]}, {'cls_id': 2, 'label': 'text', 'score': 0.8885666131973267, 'coordinate': [271.7495, 1231.8752, 710.44495, 1255.7981]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8907185196876526, 'coordinate': [581.2295, 1287.4525, 1039.8014, 1312.772]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559596180915833, 'coordinate': [273.1827, 1341.421, 1041.0299, 1401.7255]}, {'cls_id': 2, 'label': 'text', 'score': 0.875311553478241, 'coordinate': [272.8338, 1427.3711, 789.7108, 1451.1359]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9152213931083679, 'coordinate': [524.9582, 1474.8136, 1041.6333, 1530.7142]}, {'cls_id': 2, 'label': 'text', 'score': 0.9584835767745972, 'coordinate': [272.81665, 1549.524, 1042.9962, 1608.7157]}]}, 'ocr_result': {}, 'table_result': [], 'dt_polys': [array([[ 503.45743,  594.6236 ],\n       [1040.6804 ,  594.6236 ],\n       [1040.6804 ,  619.73895],\n       [ 503.45743,  619.73895]], dtype=float32), array([[ 554.2307,  803.5825],\n       [1040.4657,  803.5825],\n       [1040.4657,  855.3159],\n       [ 554.2307,  855.3159]], dtype=float32), array([[ 517.1226, 1042.3978],\n       [1040.2208, 1042.3978],\n       [1040.2208, 1095.7457],\n       [ 517.1226, 1095.7457]], dtype=float32), array([[ 581.2295, 1287.4525],\n       [1039.8014, 1287.4525],\n       [1039.8014, 1312.772 ],\n       [ 581.2295, 1312.772 ]], dtype=float32), array([[ 524.9582, 1474.8136],\n       [1041.6333, 1474.8136],\n       [1041.6333, 1530.7142],\n       [ 524.9582, 1530.7142]], dtype=float32)], 'rec_formula': ['F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)', 'p(\\mathbf{x})=c(\\mathbf{u})\\prod_{i}p(x_{i}).\\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\quad~~\\quad~~~~~~~~~~~~~~~(2)', 'H_{c}({\\bf x})=-\\int_{{\\bf{u}}}c({\\bf{u}})\\log c({\\bf{u}})d{\\bf{u}}.~~~~~~~~~~~~~~~~~~~~~(3)', 'I({\\bf x})=-H_{c}({\\bf x}).\\qquad\\qquad\\qquad\\qquad(4)', 'H({\\bf x})=\\sum_{i}H(x_{i})+H_{c}({\\bf x}).\\eqno\\qquad\\qquad\\qquad(5)']}\n

Where dt_polys represents the coordinates of the detected formula area, and rec_formula is the detected formula.

The visualization result is as follows:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path. Formula recognition visualization requires a separate environment configuration. Please refer to 2.3 Formula Recognition Pipeline Visualization to install the LaTeX rendering engine.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"
  • Quickly perform inference on the pipeline with just a few lines of code, taking the formula recognition pipeline as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the formula recognition pipeline object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the formula recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the formula recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/formula_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/formula_recognition.yaml\")\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#23-formula-recognition-pipeline-visualization","title":"2.3 Formula Recognition Pipeline Visualization","text":"

If you need to visualize the formula recognition pipeline, you need to run the following command to install the LaTeX rendering environment:

apt-get install sudo\nsudo apt-get update\nsudo apt-get install texlive\nsudo apt-get install texlive-latex-base\nsudo apt-get install texlive-latex-extra\n
After that, use the save_to_img method to save the visualization image. The specific command is as follows:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
Note: Since the formula recognition visualization process requires rendering each formula image, it may take a relatively long time. Please be patient.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the formula recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the formula recognition pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain formula recognition results from an image.

POST /formula-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the layout detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description formulas array Positions and contents of formulas. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in formulas is an object with the following properties:

Name Type Description poly array Formula position. Elements in the array are the vertex coordinates of the polygon enclosing the formula. latex string Formula content.

Example of result:

{\n\"formulas\": [\n{\n\"poly\": [\n[\n444.0,\n244.0\n],\n[\n705.4,\n244.5\n],\n[\n705.8,\n311.3\n],\n[\n444.1,\n311.0\n]\n],\n\"latex\": \"F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)\"\n}\n],\n\"layoutImage\": \"xxxxxx\",\n\"ocrImage\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/formula-recognition\"\nimage_path = \"./demo.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected formulas:\")\nprint(result[\"formulas\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/formula-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto formulas = result[\"formulas\"];\n        std::cout << \"\\nDetected formulas:\" << std::endl;\n        for (const auto& formula : formulas) {\n            std::cout << formula << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/formula-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode formulas = result.get(\"formulas\");\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected formulas: \" + formulas.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/formula-recognition\"\n    imagePath := \"./demo.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            LayoutImage      string   `json:\"layoutImage\"`\n            Formulas []map[string]interface{} `json:\"formulas\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected formulas:\")\n    for _, formula := range respData.Result.Formulas {\n        fmt.Println(formula)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/formula-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected formulas:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"formulas\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/formula-recognition'\nconst imagePath = './demo.jpg'\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected formulas:\");\n    console.log(result[\"formulas\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/formula-recognition\"\n$image_path = \"./demo.jpg\";\n$layout_image_path = \"./layout.jpg\"\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected formulas:\\n\";\nprint_r($result[\"formulas\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the formula recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the formula recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the formula recognition pipeline consists of two modules (layout detection and formula recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many formula are undetected (i.e., formula miss detection), it may indicate that the layout detection model needs improvement. You should refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model. If many recognition errors occur in detected formula (i.e., the recognized formula content does not match the actual formula content), it suggests that the formula recognition model requires further refinement. You should refer to the Customization section in the Formula Recognition Module Development Tutorial and fine-tune the formula recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_17cls # Can be replaced with the local path of the fine-tuned layout detection model\n  formula_rec_model: LaTeX_OCR_rec # Can be replaced with the local path of the fine-tuned formula recognition model\n  formula_rec_batch_size: 5\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in 2. Quick Start to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for formula pipeline inference, the Python command would be:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device npu:0\n

If you want to use the formula recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html","title":"General Layout Parsing Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#1-introduction-to-the-general-layout-parsing-pipeline","title":"1. Introduction to the General Layout Parsing Pipeline","text":"

Layout parsing is a technology that extracts structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has extensive applications in document management, information extraction, and data digitization. By combining Optical Character Recognition (OCR), image processing, and machine learning algorithms, layout parsing can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. The process typically involves three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data to improve data processing efficiency and accuracy.

The General Layout Parsing Pipeline includes modules for table structure recognition, layout region analysis, text detection, text recognition, formula recognition, seal text detection, text image rectification, and document image orientation classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effect of the General Image Classification pipeline online, or locally using command line or Python.

Before using the General Layout Parsing pipeline locally, please ensure you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

One command is all you need to quickly experience the effect of the Layout Parsing pipeline. Use the test file and replace --input with your local path to make predictions.

paddlex --pipeline layout_parsing --input demo_paper.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the Layout Parsing pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default Layout Parsing pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config layout_parsing\n

After execution, the layout parsing pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config layout_parsing --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it take effect. For example, if the configuration file is saved as ./layout_parsing.yaml, simply execute:

paddlex --pipeline ./layout_parsing.yaml --input layout_parsing.jpg\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

\ud83d\udc49Click to expand
{'input_path': PosixPath('/root/.paddlex/temp/tmp5jmloefs.png'), 'parsing_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmpshsq8_w0.png'), 'layout_bbox': [51.46833, 74.22329, 542.4082, 232.77504], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [213, 221, 238],\n        [217, 223, 240],\n        [233, 234, 241]],\n\n       [[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpcd2q9uyu.png'), 'layout_bbox': [47.68295, 243.08054, 546.28253, 295.71045], 'figure_title': 'Overview of RT-DETR, We feed th', 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpr_iqa8b3.png'), 'layout_bbox': [58.416977, 304.1531, 275.9134, 400.07513], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmphpblxl3p.png'), 'layout_bbox': [100.62961, 405.97458, 234.79774, 414.77414], 'figure_title': 'Figure 5. The fusion block in CCFF.', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmplgnczrsf.png'), 'layout_bbox': [47.81724, 421.9041, 288.01566, 550.538], 'text': 'D, Ds, not only significantly reduces latency (35% faster),\\nRut\\nnproves accuracy (0.4% AP higher), CCFF is opti\\nased on the cross-scale fusion module, which\\nnsisting of convolutional lavers intc\\npath.\\nThe role of the fusion block is t\\n into a new feature, and its\\nFigure 5. The f\\nblock contains tw\\n1 x1\\nchannels, /V RepBlock\\n. anc\\n: two-path outputs are fused by element-wise add. We\\ntormulate the calculation ot the hvbrid encoder as:', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpsq0ey9md.png'), 'layout_bbox': [94.60716, 558.703, 288.04193, 600.19434], 'formula': '\\\\begin{array}{l}{{\\\\Theta=K=\\\\mathrm{p.s.sp{\\\\pm}}\\\\mathrm{i.s.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}}),{\\\\qquad\\\\mathrm{{a.s.}}\\\\mathrm{s.}}}\\\\\\\\ {{\\\\tau_{\\\\mathrm{{s.s.s.s.s.}}(\\\\mathrm{l.s.},\\\\mathrm{l.s.},\\\\mathrm{s.s.}}\\\\mathrm{s.}\\\\mathrm{s.}}\\\\end{array}),}}\\\\\\\\ {{\\\\bar{\\\\mathrm{e-c.c.s.s.}(\\\\mathrm{s.},\\\\mathrm{s.s.},\\\\ s_{s}}\\\\mathrm{s.s.},\\\\tau),}}\\\\end{array}', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpv30qy0v4.png'), 'layout_bbox': [47.975555, 607.12024, 288.5776, 629.1252], 'text': 'tened feature to the same shape as Ss.\\nwhere Re shape represents restoring the shape of the flat-', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp0jejzwwv.png'), 'layout_bbox': [48.383354, 637.581, 245.96404, 648.20496], 'paragraph_title': '4.3. Uncertainty-minimal Query Selection', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpushex416.png'), 'layout_bbox': [47.80134, 656.002, 288.50192, 713.24994], 'text': 'To reduce the difficulty of optimizing object queries in\\nDETR, several subsequent works [42, 44, 45] propose query\\nselection schemes, which have in common that they use the\\nconfidence score to select the top K\u2019 features from the en-\\ncoder to initialize object queries (or just position queries).', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpki7e_6wc.png'), 'layout_bbox': [306.6371, 302.1026, 546.3772, 419.76724], 'text': 'The confidence score represents the likelihood that the fea\\nture includes foreground objects. Nevertheless, the \\nare required to simultaneously model the category\\nojects, both of which determine the quality of the\\npertor\\ncore of the fes\\nBased on the analysis, the current query\\n considerable level of uncertainty in the\\nresulting in sub-optimal initialization for\\nand hindering the performance of the detector.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmppbxrfehp.png'), 'layout_bbox': [306.0642, 422.7347, 546.9216, 539.45734], 'text': 'To address this problem, we propose the uncertainty mini\\nmal query selection scheme, which explicitly const\\noptim\\n the epistemic uncertainty to model the\\nfeatures, thereby providing \\nhigh-quality\\nr the decoder. Specifically,\\n the discrepancy between i\\nalization P\\nand classificat\\n.(2\\ntunction for the gradie', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp1mgiyd21.png'), 'layout_bbox': [331.52808, 549.32635, 546.5229, 586.15546], 'formula': '\\\\begin{array}{c c c}{{}}&{{}}&{{\\\\begin{array}{c}{{i\\\\langle X\\\\rangle=({\\\\bar{Y}}({\\\\bar{X}})+{\\\\bar{Z}}({\\\\bar{X}})\\\\mid X\\\\in{\\\\bar{\\\\pi}}^{\\\\prime}}}&{{}}\\\\\\\\ {{}}&{{}}&{{}}\\\\end{array}}}&{{\\\\emptyset}}\\\\\\\\ {{}}&{{}}&{{C(\\\\bar{X},{\\\\bar{X}})=C..\\\\scriptstyle(\\\\bar{0},{\\\\bar{Y}})+{\\\\mathcal{L}}_{{\\\\mathrm{s}}}({\\\\bar{X}}),\\\\ 6)}}&{{}}\\\\end{array}', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp8t73dpym.png'), 'layout_bbox': [306.44016, 592.8762, 546.84314, 630.60126], 'text': 'where  and y denote the prediction and ground truth,\\n= (c, b), c and b represent the category and bounding\\nbox respectively, X represent the encoder feature.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpftnxeyjm.png'), 'layout_bbox': [306.15652, 632.3142, 546.2463, 713.19073], 'text': 'Effectiveness analysis. To analyze the effectiveness of the\\nuncertainty-minimal query selection, we visualize the clas-\\nsificatior\\nscores and IoU scores of the selected fe\\nCOCO\\na 12017, Figure 6. We draw the scatterplo\\nt with\\ndots\\nrepresent the selected features from the model trained\\nwith uncertainty-minimal query selection and vanilla query', 'layout': 'right'}]}\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking the general layout parsing pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"layout_parsing\")\n\noutput = pipeline.predict(\"demo_paper.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result as an image file\n    res.save_to_xlsx(\"./output/\")  # Save the result as an Excel file\n    res.save_to_html(\"./output/\")  # Save the result as an HTML file\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, e.g., [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving as files, with the supported file types depending on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves the result as an image file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name. save_to_html Saves the result as an HTML file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

| save_to_xlsx | Saves the result as an Excel file. | - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

Within this tutorial on Artificial Intelligence and Computer Vision, we will explore the capabilities of saving and exporting results from various processes, including OCR (Optical Character Recognition), layout analysis, and table structure recognition. Specifically, the save_to_img function enables saving visualization results, save_to_html converts tables directly into HTML files, and save_to_xlsx exports tables as Excel files.

Upon obtaining the configuration file, you can customize various settings for the layout parsing pipeline by simply modifying the pipeline parameter within the create_pipeline method to point to your configuration file path.

For instance, if your configuration file is saved at ./my_path/layout_parsing.yaml, you can execute the following code:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/layout_parsing.yaml\")\noutput = pipeline.predict(\"layout_parsing.jpg\")\nfor res in output:\n    res.print()  # Prints the structured output of the layout parsing prediction\n    res.save_to_img(\"./output/\")  # Saves the img format results from each submodule of the pipeline\n    res.save_to_xlsx(\"./output/\")  # Saves the xlsx format results from the table recognition module\n    res.save_to_html(\"./output/\")  # Saves the html results from the table recognition module\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements in terms of inference speed and accuracy, you can proceed with development integration or deployment.

To directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX offers three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In production environments, many applications require stringent performance metrics, especially response speed, to ensure efficient operation and smooth user experience. PaddleX provides a high-performance inference plugin that deeply optimizes model inference and pre/post-processing for significant end-to-end speedups. For detailed instructions on high-performance inference, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service Deployment: Service deployment is a common form in production environments, where reasoning functions are encapsulated as services accessible via network requests. PaddleX enables cost-effective service deployment of pipelines. For detailed instructions on service deployment, refer to the PaddleX Service Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body attributes are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result attribute, of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body attributes are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs layout parsing.

POST /layout-parsing

  • Request body attributes:
Name Type Description Required file string The URL of an image file or PDF file accessible by the service, or the Base64 encoded result of the content of the above-mentioned file types. For PDF files with more than 10 pages, only the content of the first 10 pages will be used. Yes fileType integer File type. 0 indicates a PDF file, 1 indicates an image file. If this attribute is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This function is enabled by default. No useImgUnwrapping boolean Whether to enable text image rectification. This function is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This function is enabled by default. No inferenceParams object Inference parameters. No

Attributes of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following attributes:
Name Type Description layoutParsingResults array Layout parsing results. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file.

Each element in layoutParsingResults is an object with the following attributes:

Name Type Description layoutElements array Layout element information.

Each element in layoutElements is an object with the following attributes:

Name Type Description bbox array Position of the layout element. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. label string Label of the layout element. text string Text contained in the layout element. layoutType string Arrangement of the layout element. image string Image of the layout element, in JPEG format, encoded using Base64. Multi-language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/layout-parsing\" # \u200b\u670d\u52a1\u200bURL\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": image_data, # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u6587\u4ef6\u200bURL\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(\"\\nDetected layout elements:\")\nfor res in result[\"layoutParsingResults\"]:\n    for ele in res[\"layoutElements\"]:\n        print(\"===============================\")\n        print(\"bbox:\", ele[\"bbox\"])\n        print(\"label:\", ele[\"label\"])\n        print(\"text:\", repr(ele[\"text\"]))\n

\ud83d\udcf1 Edge Deployment: Edge deployment refers to placing computational and data processing capabilities directly on user devices, enabling them to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general layout parsing pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general layout parsing pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general layout parsing pipeline consists of 7 modules, unsatisfactory performance may stem from any of these modules.

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., wrong row/column recognition, incorrect cell positions) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.
  • Misplaced layout elements (e.g., incorrect positioning of tables, seals) may suggest issues with the layout detection module. You should consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.
  • Frequent undetected texts (i.e., text missing detection) indicate potential weaknesses in the text detection model. Follow the Customization section in the Text Detection Module Development Tutorial to fine-tune the text detection model using your private dataset.
  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest further improvements to the text recognition model. Refer to the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.
  • Frequent recognition errors in detected seal texts indicate the need for improvements to the seal text detection model. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.
  • High recognition errors in detected formulas (i.e., recognized formula content does not match the actual formula) suggest further enhancements to the formula recognition model. Follow the Customization section in the Formula Recognition Module Development Tutorial to fine-tune the formula recognition model.
  • Frequent misclassifications of document or certificate orientations with text areas indicate the need for improvements to the document image orientation classification model. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the model.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet_plus  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned model\n  formula_rec_model: LaTeX_OCR_rec  # Can be modified to the local path of the fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det   # Can be modified to the local path of the fine-tuned model\n  doc_image_unwarp_model: UVDoc  # Can be modified to the local path of the fine-tuned model\n  doc_image_ori_cls_model: PP-LCNet_x1_0_doc_ori  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script methods in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the layout parsing pipeline, the Python command is:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, simply modify --device to npu in the Python command:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device npu:0\n
If you want to use the general layout parsing pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html","title":"Seal Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#1-introduction-to-the-seal-recognition-pipeline","title":"1. Introduction to the Seal Recognition Pipeline","text":"

Seal recognition is a technology that automatically extracts and recognizes seal content from documents or images. The recognition of seal is part of document processing and has various applications in many scenarios, such as contract comparison, inventory access approval, and invoice reimbursement approval.

The Seal Recognition pipeline includes a layout area analysis module, a seal detection module, and a text recognition module.

If you prioritize model accuracy, please choose a model with higher accuracy. If you prioritize inference speed, please choose a model with faster inference. If you prioritize model storage size, please choose a model with a smaller storage footprint.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

Model NameModel Download Link Average Recognition Accuracy (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy indicators is a self-built Chinese dataset from PaddleOCR, covering various scenarios such as street scenes, web images, documents, and handwriting. The text recognition subset includes 11,000 images. The GPU inference time for all models above is based on an NVIDIA Tesla T4 machine with a precision type of FP32. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads, and the precision type is also FP32.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre trained model production line provided by PaddleX can quickly experience the effect. You can experience the effect of the seal recognition production line online, or use the command line or Python locally to experience the effect of the seal recognition production line.

Before using the seal recognition production line locally, please ensure that you have completed the wheel package installation of PaddleX according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#21-command-line-experience","title":"2.1 Command line experience","text":"

One command can quickly experience the effect of seal recognition production line, use test file, and replace --input with the local path for prediction

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

Parameter description:

--Pipeline: Production line name, here is the seal recognition production line\n--Input: The local path or URL of the input image to be processed\n--The GPU serial number used by the device (e.g. GPU: 0 indicates the use of the 0th GPU, GPU: 1,2 indicates the use of the 1st and 2nd GPUs), or the CPU (-- device CPU) can be selected for use\n

When executing the above Python script, the default seal recognition production line configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config seal_recognition\n

After execution, the seal recognition production line configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config seal_recognition --save_path ./my_path --save_path output\n

After obtaining the production line configuration file, you can replace '-- pipeline' with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is / seal_recognition.yaml\uff0c Just need to execute:

paddlex --pipeline ./seal_recognition.yaml --input seal_text_det.png --save_path output\n

Among them, parameters such as --model and --device do not need to be specified and will use the parameters in the configuration file. If the parameters are still specified, the specified parameters will prevail.

After running, the result obtained is:

\ud83d\udc49 Click to expand
{'input_path': 'seal_text_det.png', 'layout_result': {'input_path': 'seal_text_det.png', 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9813116192817688, 'coordinate': [0, 5.2238655, 639.59766, 637.6985]}]}, 'ocr_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmp19fn93y5.png'), 'dt_polys': [array([[468, 469],\n       [472, 469],\n       [477, 471],\n       [507, 501],\n       [509, 505],\n       [509, 509],\n       [508, 513],\n       [506, 514],\n       [456, 553],\n       [454, 555],\n       [391, 581],\n       [388, 581],\n       [309, 590],\n       [306, 590],\n       [234, 577],\n       [232, 577],\n       [172, 548],\n       [170, 546],\n       [121, 504],\n       [118, 501],\n       [118, 496],\n       [119, 492],\n       [121, 490],\n       [152, 463],\n       [156, 461],\n       [160, 461],\n       [164, 463],\n       [202, 495],\n       [252, 518],\n       [311, 530],\n       [371, 522],\n       [425, 501],\n       [464, 471]]), array([[442, 439],\n       [445, 442],\n       [447, 447],\n       [449, 490],\n       [448, 494],\n       [446, 497],\n       [440, 499],\n       [197, 500],\n       [193, 499],\n       [190, 496],\n       [188, 491],\n       [188, 448],\n       [189, 444],\n       [192, 441],\n       [197, 439],\n       [438, 438]]), array([[465, 341],\n       [470, 344],\n       [472, 346],\n       [476, 356],\n       [476, 419],\n       [475, 424],\n       [472, 428],\n       [467, 431],\n       [462, 433],\n       [175, 434],\n       [170, 433],\n       [166, 430],\n       [163, 426],\n       [161, 420],\n       [161, 354],\n       [162, 349],\n       [165, 345],\n       [170, 342],\n       [175, 340],\n       [460, 340]]), array([[326,  34],\n       [481,  85],\n       [485,  88],\n       [488,  90],\n       [584, 220],\n       [586, 225],\n       [587, 229],\n       [589, 378],\n       [588, 383],\n       [585, 388],\n       [581, 391],\n       [576, 393],\n       [570, 392],\n       [507, 373],\n       [502, 371],\n       [498, 367],\n       [496, 359],\n       [494, 255],\n       [423, 162],\n       [322, 129],\n       [246, 151],\n       [205, 169],\n       [144, 252],\n       [139, 360],\n       [137, 365],\n       [134, 369],\n       [128, 373],\n       [ 66, 391],\n       [ 61, 392],\n       [ 56, 390],\n       [ 51, 387],\n       [ 48, 382],\n       [ 47, 377],\n       [ 49, 230],\n       [ 50, 225],\n       [ 52, 221],\n       [149,  89],\n       [153,  86],\n       [157,  84],\n       [318,  34],\n       [322,  33]])], 'dt_scores': [0.9943362380813267, 0.9994290391836306, 0.9945320407374245, 0.9908104427126033], 'rec_text': ['5263647368706', '\u200b\u5417\u200b\u7e41\u7269\u200b', '\u200b\u53d1\u7968\u200b\u4e13\u7528\u7ae0\u200b', '\u200b\u5929\u6d25\u200b\u541b\u548c\u7f18\u200b\u5546\u8d38\u200b\u6709\u9650\u516c\u53f8\u200b'], 'rec_score': [0.9921098351478577, 0.997374951839447, 0.9999369382858276, 0.9901710152626038]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code can complete the fast inference of the production line. Taking the seal recognition production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"seal_recognition\")\n\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\") # Save the results in img\n

The result obtained is the same as the command line method.

In the above Python script, the following steps were executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images).

If you have a configuration file, you can customize the configurations of the seal recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved in / my_path/seal_recognition.yaml \uff0c Then only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/seal_recognition.yaml\")\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#3-development-integrationdeployment","title":"3. Development integration/deployment","text":"

If the production line can meet your requirements for inference speed and accuracy, you can directly develop integration/deployment.

If you need to directly apply the production line to your Python project, you can refer to the example code in [2.2.2 Python scripting] (# 222 python scripting integration).

In addition, PaddleX also offers three other deployment methods, detailed as follows:

\ud83d\ude80 ** High performance deployment: In actual production environments, many applications have strict standards for the performance indicators of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deep performance optimization of model inference and pre-processing, achieving significant acceleration of end-to-end processes. For a detailed high-performance deployment process, please refer to the [PaddleX High Performance Deployment Guide] (../../../pipelin_deploy/high_performance_deploy. md).

\u2601\ufe0f ** Service deployment * *: Service deployment is a common form of deployment in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users to achieve service-oriented deployment of production lines at low cost. For detailed service-oriented deployment processes, please refer to the PaddleX Service Deployment Guide (../../../ipeline_deploy/service_deploy. md).

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Obtain seal recognition results from an image.

POST /seal-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/seal-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/seal-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/seal-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/seal-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/seal-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/seal-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/seal-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#4-secondary-development","title":"4. Secondary development","text":"

If the default model weights provided by the seal recognition production line are not satisfactory in terms of accuracy or speed in your scenario, you can try using your own specific domain or application scenario data to further fine tune the existing model to improve the recognition performance of the seal recognition production line in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#41-model-fine-tuning","title":"4.1 Model fine-tuning","text":"

Due to the fact that the seal recognition production line consists of three modules, the performance of the model production line may not be as expected due to any of these modules.

You can analyze images with poor recognition performance and refer to the following rules for analysis and model fine-tuning:

  • If the seal area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If there is a significant amount of text that has not been detected (i.e. text miss detection phenomenon), it may be due to the shortcomings of the text detection model. You need to refer to the Secondary Development section in the Seal Text Detection Module Development Tutorial to fine tune the text detection model using your private dataset.
  • If seal texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.

  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After completing fine-tuning training using a private dataset, you can obtain a local model weight file.

If you need to use the fine tuned model weights, simply modify the production line configuration file and replace the local path of the fine tuned model weights with the corresponding position in the production line configuration file

......\n Pipeline:\n  layout_model: RT-DETR-H_layout_3cls #can be modified to the local path of the fine tuned model\n  text_det_model: PP-OCRv4_server_seal_det  #can be modified to the local path of the fine tuned model\n  text_rec_model: PP-OCRv4_server_rec #can be modified to the local path of the fine tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#5-multiple-hardware-support","title":"5. Multiple hardware support","text":"

PaddleX supports various mainstream hardware devices such as Nvidia GPU, Kunlun Core XPU, Ascend NPU, and Cambrian MLU, and can seamlessly switch between different hardware devices by simply modifying the --device parameter.

For example, if you use Nvidia GPU for inference on a seal recognition production line, the Python command you use is:

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

At this point, if you want to switch the hardware to Ascend NPU, simply modify the --device in the Python command to NPU:

paddlex --pipeline seal_recognition --input seal_text_det.png --device npu:0 --save_path output\n

If you want to use the seal recognition production line on a wider range of hardware, please refer to the PaddleX Multi Hardware Usage Guide\u3002

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html","title":"General Table Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#1-introduction-to-the-general-table-recognition-pipeline","title":"1. Introduction to the General Table Recognition Pipeline","text":"

Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis for users.

The General Table Recognition Pipeline comprises modules for table structure recognition, layout analysis, text detection, and text recognition.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

\ud83d\udc49Model List Details

Table Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are measured on PaddleX's internal self-built English table recognition dataset. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout analysis dataset containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

Model NameModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.2 M PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 100.1M"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Image Classification pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Table Recognition pipeline by using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Table Recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the effects of the table recognition pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the table recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the 1st and 2nd GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default table recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config table_recognition\n

After execution, the table recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config table_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./table_recognition.yaml, simply execute:

paddlex --pipeline ./table_recognition.yaml --input table_recognition.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file. If they are still specified, the specified parameters will take precedence.

After running, the result is:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference with the pipeline. Taking the General Table Recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"table_recognition\")\n\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the results in img format\n    res.save_to_xlsx(\"./output/\")  # Save the results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
The results are the same as those obtained through the command line.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_html Save the results as an html format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_xlsx Save the results as a spreadsheet format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images, table structure recognition result images), save_to_html can directly save the table as an html file (including text and table formatting), and save_to_xlsx can save the table as an Excel format file (including text and formatting).

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/table_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/table_recognition.yaml\")\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save results in img format\n    res.save_to_xlsx(\"./output/\")  # Save results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Locate and recognize tables in images.

POST /table-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description tables array Positions and contents of tables. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table position. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. html string Table recognition result in HTML format. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/table-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected tables:\")\nprint(result[\"tables\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/table-recognition\", headers, body, \"application/json\");\n\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedlayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto tables = result[\"tables\"];\n        std::cout << \"\\nDetected tables:\" << std::endl;\n        for (const auto& table : tables) {\n            std::cout << table << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/table-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode tables = result.get(\"tables\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected tables: \" + tables.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/table-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Tables []map[string]interface{} `json:\"tables\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected tables:\")\n    for _, table := range respData.Result.Tables {\n        fmt.Println(table)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/table-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected tables:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"tables\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/table-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected tables:\");\n    console.log(result[\"tables\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/table-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected tables:\\n\";\nprint_r($result[\"tables\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general table recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general table recognition pipeline consists of four modules, unsatisfactory performance may stem from any of these modules.

Analyze images with poor recognition results and follow the rules below for analysis and model fine-tuning:

  • If the detected table structure is incorrect (e.g., row and column recognition errors, incorrect cell positions), the table structure recognition module may be insufficient. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and use your private dataset to fine-tune the table structure recognition model.
  • If the table area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If many texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.
  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_mobile_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_mobile_rec  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script method in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for table recognition pipeline inference, the Python command is:

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
At this time, if you want to switch the hardware to Ascend NPU, simply modify --device in the Python command to npu:

paddlex --pipeline table_recognition --input table_recognition.jpg --device npu:0\n
If you want to use the general table recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#1-introduction-to-the-general-time-series-anomaly-detection-pipeline","title":"1. Introduction to the General Time Series Anomaly Detection Pipeline","text":"

Time series anomaly detection is a technique for identifying abnormal patterns or behaviors in time series data. It is widely applied in fields such as network security, equipment monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly deviate from expected behaviors, such as sudden spikes in network traffic or unusual transaction activities. Time series anomaly detection enable automatic identification of anomalies in data. This technology provides real-time alerts for enterprises and organizations, helping them promptly address potential risks and issues. It plays a crucial role in ensuring system stability and security.

The General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module. If you prioritize model accuracy, choose a model with higher precision. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage footprint.

Model NameModel Download Link Precision Recall F1-Score Model Storage Size (M) AutoEncoder_adInference Model/Trained Model 99.36 84.36 91.25 52K DLinear_adInference Model/Trained Model 98.98 93.96 96.41 112K Nonstationary_adInference Model/Trained Model 98.55 88.95 93.51 1.8M PatchTST_adInference Model/Trained Model 98.78 90.70 94.57 320K TimesNet_adInference Model/Trained Model 98.37 94.80 96.56 1.3M

Note: The above precision metrics are measured on the PSM dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Anomaly Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Anomaly Detection Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online experience of time series tasks are only model solutions for a specific scenario and are not universal. They are not applicable to other scenarios. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Anomaly Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the effects of the time series anomaly detection pipeline:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_ad --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_ad.yaml --input ts_ad.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'ts_ad.csv', 'anomaly':            label\ntimestamp\n220226         0\n220227         0\n220228         0\n220229         0\n220230         0\n...          ...\n220317         1\n220318         1\n220319         1\n220320         1\n220321         0\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general time series anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_ad\")\n\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the result in CSV format\n

The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_csv Saves results as a csv file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_xlsx Saves results as table file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_ad.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_ad.yaml\")\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs time-series anomaly detection.

POST /time-series-anomaly-detection

  • Attributes of the request body:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string Time-series anomaly detection results in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-anomaly-detection\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-anomaly-detection\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-anomaly-detection'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Anomaly Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Modules Development Tutorial to fine-tune the time series anomaly detection model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear_ad  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the time series anomaly detection pipeline, the Python command is:

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_ad --input ts_ad.csv --device npu:0\n
If you want to use the General Time-Series Anomaly Detection Pipeline on more diverse hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html","title":"Time Series Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#1-introduction-to-general-time-series-classification-pipeline","title":"1. Introduction to General Time Series Classification Pipeline","text":"

Time series classification is a technique that categorizes time-series data into predefined classes, widely applied in fields such as behavior recognition and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, for example, classifying a speech signal as \"greeting\" or \"request,\" or categorizing stock price movements as \"rising\" or \"falling.\" Time series classification typically employs machine learning and deep learning models, effectively capturing temporal dependencies and variation patterns to provide accurate classification labels for data. This technology plays a pivotal role in applications such as intelligent monitoring and market forecasting.

The General Time Series Classification Pipeline includes a Time Series Classification module.

Model NameModel Download Link Acc(%) Model Size (M) TimesNet_clsInference Model/Trained Model 87.5 792K

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Time Series Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Classification Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in model for online experience of time series tasks is only a model solution for a specific scenario and is not a general solution applicable to other scenarios. Therefore, the experience method does not support using arbitrary files to experience the effect of the official model solution. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the effects of the time series classification pipeline quickly with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series classification pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default time series classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_yaml ts_cls\n

After execution, the time series classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config ts_cls --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_cls.yaml --input ts_cls.csv --device gpu:0\n

In this command, parameters such as --model and --device are not required to be specified, as they will use the parameters defined in the configuration file. If these parameters are specified, the specified values will take precedence.

After execution, the result is:

{'input_path': 'ts_cls.csv', 'classification':         classid     score\nsample\n0             0  0.617688}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete rapid inference for production lines. Taking the General Time Series Classification Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_cls\")\n\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n

The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference. Available only if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_cls.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_cls.yaml\")\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Classify time-series data.

POST /time-series-classification

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description label string Class label. score number Class score.

An example of result is as follows:

{\n\"label\": \"running\",\n\"score\": 0.97\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-classification\"\ncsv_path = \"./test.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(f\"label: {result['label']}, score: {result['score']}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n        std::cout << \"label: \" << result[\"label\"] << \", score: \" << result[\"score\"] << std::endl;\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-classification\";\n        String csvPath = \"./test.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                System.out.println(\"label: \" + result.get(\"label\").asText() + \", score: \" + result.get(\"score\").asText());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-classification\"\n    csvPath := \"./test.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Label string `json:\"label\"`\n            Score string `json:\"score\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    fmt.Printf(\"label: %s, score: %s\\n\", respData.Result.Label, respData.Result.Score)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-classification\";\n    static readonly string csvPath = \"./test.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csveBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csveBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string label = jsonResponse[\"result\"][\"label\"].ToString();\n        string score = jsonResponse[\"result\"][\"score\"].ToString();\n        Console.WriteLine($\"label: {label}, score: {score}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-classification'\nconst csvPath = \"./test.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    console.log(`label: ${result[\"label\"]}, score: ${result[\"score\"]}`);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-classification\";\n$csv_path = \"./test.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\necho \"label: \" . $result[\"label\"] . \", score: \" . $result[\"score\"];\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures. Choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Classification Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Classification Pipeline includes a time series classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Classification Module Tutorial to fine-tune the time series classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: TimesNet_cls  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for time series classification pipeline inference, the Python command is:

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command as follows:\n\n```bash\npaddlex --pipeline ts_cls --input ts_cls.csv --device npu:0\n

If you intend to use the General Time Series Classification Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html","title":"Time Series Forecasting Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#1-introduction-to-the-general-time-series-forecasting-pipeline","title":"1. Introduction to the General Time Series Forecasting Pipeline","text":"

Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing the patterns of change in time series data. It is widely applied in fields such as financial markets, weather forecasting, and sales prediction. Time series forecasting often employs statistical methods or deep learning models (e.g., LSTM, ARIMA), capable of handling temporal dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in various industries, including energy management, supply chain optimization, and market analysis.

The General Time Series Forecasting Pipeline includes a time series forecasting module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link MSE MAE Model Storage Size (M) DLinearInference Model/Trained Model 0.382 0.394 72K NLinearInference Model/Trained Model 0.386 0.392 40K NonstationaryInference Model/Trained Model 0.600 0.515 55.5 M PatchTSTInference Model/Trained Model 0.385 0.397 2.0M RLinearInference Model/Trained Model 0.384 0.392 40K TiDEInference Model/Trained Model 0.405 0.412 31.7M TimesNetInference Model/Trained Model 0.417 0.431 4.9M

Note: The above accuracy metrics are measured on ETTH1. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Forecasting Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Time Series Forecasting Pipeline online using the demo provided by the official team, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online time series tasks are scenario-specific and not universal. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model with your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Forecasting Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the time series forecasting pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series forecasting pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_fc --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_fc.yaml, simply execute:

paddlex --pipeline ./ts_fc.yaml --input ts_fc.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'ts_fc.csv', 'forecast':                            OT\ndate\n2018-06-26 20:00:00  9.586131\n2018-06-26 21:00:00  9.379762\n2018-06-26 22:00:00  9.252275\n2018-06-26 23:00:00  9.249993\n2018-06-27 00:00:00  9.164998\n...                       ...\n2018-06-30 15:00:00  8.830340\n2018-06-30 16:00:00  9.291553\n2018-06-30 17:00:00  9.097666\n2018-06-30 18:00:00  8.905430\n2018-06-30 19:00:00  8.993793\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the production line. Taking the general time series prediction production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_fc\")\n\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the results in CSV format\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the production line supports high-performance inference. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_fc.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_fc.yaml\")\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Performs time-series forecasting.

POST /time-series-forecasting

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string The time-series forecasting result in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-forecasting\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-forecasting\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-forecasting\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-forecasting\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-forecasting\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-forecasting'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-forecasting\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Forecasting Pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Forecasting Pipeline includes a time series forecasting module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Forecasting Module Development Tutorial and use your private dataset to fine-tune the time series forecasting model.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 0\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the time series forecasting pipeline, the Python command would be:

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_fc --input ts_fc.csv --device npu:0\n
If you want to use the General Time Series Forecasting Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/practical_tutorials/deployment_tutorial.html","title":"PaddleX 3.0 Pipeline Deployment Tutorial","text":"

Before using this tutorial, you need to install PaddleX. For installation instructions, please refer to the PaddleX Installation guide.

The three deployment methods of PaddleX are detailed below:

  • High-Performance Inference: In actual production environments, many applications have stringent performance standards for deployment strategies, especially in terms of response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.
  • Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment in pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  • Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

This tutorial will introduce the three deployment methods of PaddleX through three practical application examples.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#1-high-performance-inference-example","title":"1 High-Performance Inference Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#11-obtain-serial-number-and-activation","title":"1.1 Obtain Serial Number and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Community page, select \"Get Now\" in the \"Consultation and Acquisition of Serial Numbers for Open Source Pipeline Deployment\" section, as shown in the figure below:

Select the pipeline you need to deploy and click \"Get\". Afterward, you can find the obtained serial number in the \"Serial Number Management for Open Source Pipeline Deployment SDK\" section below:

After using the serial number to complete activation, you can use the high-performance inference plugin. PaddleX provides both offline and online activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and activate online, allowing the program to complete activation automatically.
  • Offline Activation: Follow the instructions on the serial number management interface (click \"Offline Activation\" in \"Operations\") to obtain the device fingerprint of the machine and bind the serial number with the device fingerprint to obtain a certificate for activation. To use this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI. Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#12-install-high-performance-inference-plugin","title":"1.2 Install High-Performance Inference Plugin","text":"

Find the corresponding installation command in the table below based on processor architecture, operating system, device type, Python version, and other information, and execute it in the deployment environment:

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU (CUDA 11.8 + cuDNN 8.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • When the device type is GPU, please use the installation command corresponding to the CUDA and cuDNN versions that match your environment; otherwise, the high-performance inference plugin will not function properly.
  • For Linux systems, use Bash to execute the installation command.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

Before enabling high-performance plugins, ensure that the LD_LIBRARY_PATH in the current environment does not specify the shared library directory of TensorRT, as the plugins already integrate TensorRT to avoid conflicts caused by different TensorRT versions that may prevent the plugins from functioning properly.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate online, specify --update_license when using the serial number for the first time, taking the General OCR pipeline as an example:

paddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to activate online\npaddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --update_license \\\n    --serial_number {serial_number}\n

For the PaddleX Python API, the method to enable the high-performance inference plugin is similar. Again, taking the General OCR pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"OCR\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": xxx}\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \")\n

The inference results obtained with the high-performance inference plugin are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent initializations to improve speed.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#14-inference-steps","title":"1.4 Inference Steps","text":"

This inference process is based on PaddleX CLI, online activation of serial numbers, Python 3.10.0, and using a CPU device with the high-performance inference plugin. For other usage methods (such as different Python versions, device types, or PaddleX Python API), refer to the PaddleX High-Performance Inference Guide to replace the corresponding commands.

# Install the high-performance inference plugin\ncurl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310\n# Ensure that the `LD_LIBRARY_PATH` in the current environment does not specify the shared library directory of TensorRT. You can use the following command to remove it or manually remove it.\nexport LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\\n' | grep -v TensorRT | tr '\\n' ':' | sed 's/:*$//')\n# Perform inference\npaddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

Output:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#15-changing-pipelines-or-models","title":"1.5 Changing Pipelines or Models","text":"
  • Changing Pipelines:

If you want to use a different pipeline with the high-performance inference plugin, simply replace the value passed to --pipeline. Here is an example using the General Object Detection pipeline:

paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n
  • Changing Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to use other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./OCR.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to use another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./object_detection.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The operations for other pipelines are similar to those for the above two pipelines. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#2-service-deployment-example","title":"2 Service Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#21-installing-the-service-deployment-plugin","title":"2.1 Installing the Service Deployment Plugin","text":"

Execute the following command to install the service deployment plugin:

paddlex --install serving\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#22-starting-the-service","title":"2.2 Starting the Service","text":"

Start the service through the PaddleX CLI with the command format:

paddlex --serve --pipeline {Pipeline name or pipeline configuration file path} [{Other command-line options}]\n

Taking the General OCR pipeline as an example:

paddlex --serve --pipeline OCR\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or a local pipeline configuration file path. PaddleX constructs the pipeline based on this and deploys it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General OCR Pipeline Tutorial.

The command-line options related to service deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Default is cpu (if GPU is not available) or gpu (if GPU is available). --host Hostname or IP address bound to the server. Default is 0.0.0.0. --port Port number listened to by the server. Default is 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Please note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Performs online activation if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/practical_tutorials/deployment_tutorial.html#23-calling-the-service","title":"2.3 Calling the Service","text":"

Here, only the Python calling example is shown. For API references and service calling examples in other languages, please refer to the \"Calling the Service\" section in the \"Development Integration/Deployment\" part of each pipeline usage tutorial in the PaddleX Serving Deployment Guide.

import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image in Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64-encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#24-deployment-steps","title":"2.4 Deployment Steps","text":"
# Install the service deployment plugin\npaddlex --install serving\n# Start the service\npaddlex --serve --pipeline OCR\n# Call the service | The code in fast_test.py is a Python calling example from the previous section\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

Running Results:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#25-change-pipelines-or-models","title":"2.5 Change Pipelines or Models","text":"
  • Change Pipelines:

If you want to deploy another pipeline for service, simply replace the value passed to --pipeline. The following example uses the General Object Detection pipeline:

paddlex --serve --pipeline object_detection\n
  • Change Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to switch to other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the OCR pipeline configuration file and save it as ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./OCR.yaml\n# 4. Call the service\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to switch to another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the object detection pipeline configuration file and save it as ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./object_detection.yaml\n# 4. Call the service | fast_test.py needs to be replaced with the Python calling example from the General Object Detection Pipeline Tutorial\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The operations for other pipelines are similar to the above two. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#3-edge-deployment-example","title":"3 Edge Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#31-environment-preparation","title":"3.1 Environment Preparation","text":"
  1. Install the CMake compilation tool locally and download the required version of the NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK website.

    Environment Requirements - CMake >= 3.10 (the minimum version is not verified, but 3.20 and above are recommended) - Android NDK >= r17c (the minimum version is not verified, but r20b and above are recommended)

    Testing Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Find Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install the ADB tool on your computer for debugging. The ADB installation methods are as follows:

    3.1. Install ADB on Mac

     brew cask install android-platform-tools\n

    3.2. Install ADB on Linux

     # Installation method for Debian-based Linux distributions\n sudo apt update\n sudo apt install -y wget adb\n\n # Installation method for Red Hat-based Linux distributions\n sudo yum install adb\n

    3.3. Install ADB on Windows

    To install on Windows, go to Google's Android platform to download the ADB software package for installation: Link

    Open the terminal, connect the phone to the computer, and enter in the terminal

     adb devices\n

    If there is a device output, it indicates successful installation.

     List of devices attached\n 744be294    device\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#32-material-preparation","title":"3.2 Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified extraction directory, switch to the specified extraction directory, and execute the extraction command.

    # 1. Switch to the specified extraction directory\ncd PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo\n\n# 2. Execute the extraction command\nunzip ocr.zip\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#33-deployment-steps","title":"3.3 Deployment Steps","text":"
  1. Switch the working directory to PaddleX-Lite-Deploy/libs, run the download.sh script to download the required Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX-Lite-Deploy/ocr/assets, run the download.sh script to download the model files optimized by the paddle_lite_opt tool.

  3. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the build.sh script to complete the compilation of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the run.sh script to complete the inference on the edge side.

Notes: - Before running the build.sh script, you need to change the path specified by NDK_ROOT to the actual installed NDK path. - You can execute the deployment steps using Git Bash on a Windows system. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to windows. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to darwin. - Maintain an ADB connection when running the run.sh script. - The download.sh and run.sh scripts support passing parameters to specify models. If not specified, the PP-OCRv4_mobile model is used by default. Currently, two models are supported: - PP-OCRv3_mobile - PP-OCRv4_mobile

Here are examples of actual operations:

# 1. Download the required Paddle Lite prediction library\ncd PaddleX-Lite-Deploy/libs\nsh download.sh\n\n# 2. Download the model files optimized by the paddle_lite_opt tool\ncd ../ocr/assets\nsh download.sh PP-OCRv4_mobile\n\n# 3. Complete the compilation of the executable file\ncd ../android/shell/ppocr_demo\nsh build.sh\n\n# 4. Inference\nsh run.sh PP-OCRv4_mobile\n

Detection Results:

Recognition Results:

The detection visualized image saved in ./test_img_result.jpg\n0       Pure Nutrition Hair Conditioner  0.993706\n1       Product Information/Parameters   0.991224\n2       (45 yuan/kg, minimum order 100 kg)    0.938893\n3       Each bottle 22 yuan, minimum order 1000 bottles)  0.988353\n4       [Brand]: OEM/ODM Manufacturing   0.97557\n5       [Product Name]: Pure Nutrition Hair Conditioner  0.986914\n6       OEM/ODM  0.929891\n7       [Product Number]: YM-X-3011 0.964156\n8       [Net Content]: 220ml      0.976404\n9       [Suitable for]: All skin types  0.987942\n10      [Main Ingredients]: Cetyl Stearyl Alcohol, Oat \u03b2-Glucan,  0.968315\n11      Cocoamide Propyl Betaine, Panthenol    0.941537\n12      (Finished Product Packaging)    0.974796\n13      [Main Function]: Can tighten the hair\u200b\u9cde\u7247\u200b, achieving  0.988799\n14      immediate and lasting improvement in hair gloss, providing sufficient nourishment to dry hair  0.989547\n15      [Main Function Continued]: Nourishment    0.998413\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Paper and Literature Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Document information extraction is a part of document processing with widespread applications in numerous scenarios, such as academic research, library management, scientific and technological intelligence analysis, and literature review writing. Through document information extraction technology, we can automatically extract key information from academic papers, including titles, authors, abstracts, keywords, publication years, journal names, citation information, and more, and store this information in a structured format for easy subsequent retrieval, analysis, and application. This not only enhances the work efficiency of researchers but also provides strong support for the in-depth development of academic research.

Firstly, it is necessary to select the corresponding PaddleX pipeline based on the task scenario. This section takes information extraction from academic papers as an example to introduce how to conduct secondary development for tasks related to the Document Scene Information Extraction v3 pipeline, which corresponds to the Document Scene Information Extraction v3 in PaddleX. If you are unsure about the correspondence between tasks and pipelines, you can refer to the capability introductions of related pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpfnss9sq9_layout.jpg.\nThe result has been saved in output/tmpfnss9sq9_ocr.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\n\n{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u56fe\u8868\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of layout area detection, OCR, table recognition, as well as the table results in HTML and XLSX formats, are saved.

Among them, the visualization of the layout area detection results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. Due to the current limitation of the official model, which only distinguishes among figures, tables, and seals, it is currently unable to accurately locate and extract other information such as headers and table titles. The results for these in {'chat_res': {'header': 'unknown', 'table caption': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of academic papers. Utilizing a dataset of academic paper documents, with the extraction of header and chart title information as examples, the layout analysis model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract header and table title information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Paper Document File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 4 end-to-end layout detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1x 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3cls 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17cls 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3cls 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17cls 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3cls 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17cls 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Academic paper literature Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/paperlayout.tar -P ./dataset\ntar -xf ./dataset/paperlayout.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/paperlayout/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 4734,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/train_4612.jpg\",\n      \"check_dataset\\/demo_img\\/train_4844.jpg\",\n      \"check_dataset\\/demo_img\\/train_0084.jpg\",\n      \"check_dataset\\/demo_img\\/train_0448.jpg\",\n      \"check_dataset\\/demo_img\\/train_4703.jpg\",\n      \"check_dataset\\/demo_img\\/train_3572.jpg\",\n      \"check_dataset\\/demo_img\\/train_4516.jpg\",\n      \"check_dataset\\/demo_img\\/train_2836.jpg\",\n      \"check_dataset\\/demo_img\\/train_1353.jpg\",\n      \"check_dataset\\/demo_img\\/train_0225.jpg\"\n    ],\n    \"val_samples\": 928,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/val_0982.jpg\",\n      \"check_dataset\\/demo_img\\/val_0607.jpg\",\n      \"check_dataset\\/demo_img\\/val_0623.jpg\",\n      \"check_dataset\\/demo_img\\/val_0890.jpg\",\n      \"check_dataset\\/demo_img\\/val_0036.jpg\",\n      \"check_dataset\\/demo_img\\/val_0654.jpg\",\n      \"check_dataset\\/demo_img\\/val_0895.jpg\",\n      \"check_dataset\\/demo_img\\/val_0059.jpg\",\n      \"check_dataset\\/demo_img\\/val_0142.jpg\",\n      \"check_dataset\\/demo_img\\/val_0088.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/paperlayout\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 4734;
  • attributes.val_samples: The number of validation set samples in this dataset is 928;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/paperlayout\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate four experiments based on the RT-DETR-H_layout_3cls model, with learning rates of: 0.001\uff0c0.0005\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 50 and 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate mAP@@0.50:0.95 1 0.00001 88.90 2 0.0001 92.41 3 0.0005 92.27 4 0.001 90.66

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [2, 4, 5] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate mAP@@0.50:0.95 2 30 92.41 4 50 92.63 5 100 92.88

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#54-model-inference","title":"5.4 Model Inference","text":"

You can test the fine-tuned single model using test file

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\"\n

By following the above steps, prediction results can be generated under the ./output directory. The layout prediction result for test.jpg is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the academic paper literature test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.layout_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: ./output/best_model/inference\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'header': '\u200b\u7b2c\u200b43\u200b\u5377\u200b\\n \u200b\u822a\u7a7a\u200b\u53d1\u52a8\u673a\u200b\\n 44', 'table caption': '\u200b\u8868\u200b1\u200b\u6a21\u62df\u200b\u6765\u6d41\u200bMa=5\u200b\u98de\u884c\u200b\u7684\u200b\u7a7a\u6c14\u200b\u52a0\u70ed\u5668\u200b\u5de5\u4f5c\u200b\u53c2\u6570\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the layout is as follows, with the correctly added ability to locate the areas of headers and table titles:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Seal Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Seal information extraction is a part of document processing and has applications in many scenarios, such as contract comparison, inventory review, and invoice reimbursement review. Using artificial intelligence technology for automatic seal recognition can effectively save labor costs and improve efficiency for enterprises.

Firstly, it is necessary to select the corresponding PaddleX production line based on the task scenario. This section is about the seal information extraction task, and it is not difficult to find that the seal information extraction task is closely related to the document scenario information extraction task. Document scene information extraction, which extracts text information from documents or images, is a classic problem in the field of computer vision. Corresponding to PaddleX's document scene information extraction v3 production line. If you are unable to determine the correspondence between tasks and production lines, you can learn about the capabilities of the relevant production lines in PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpx5tmgsem_curve_0.jpg.\nThe result has been saved in output/tmpx5tmgsem_layout.jpg.\nThe result has been saved in output/tmpx5tmgsem_ocr.jpg.\nThe retrieved vectorstore is not for PaddleX and will return vectorstore directly\n\n{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of seal_recognition and OCR (if table exits, table recognition, as well as the table results in HTML and XLSX formats), are saved.

Among them, the visualization of the seal_recognition results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. The official model of the document scene information extraction production line has been found to have the following issues in the current demand scenario: in the visualization of OCR recognition, there is a deviation in the text bending detection box of the seal, resulting in incorrect seal text recognition; The information on the seal was not correctly extracted. The results for these in {'chat_res': {'seal': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of Seal Text Recognitions. Utilizing a dataset of Seal Text Recognition, with the extraction of seal information as examples, the seal text detection model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract seal information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Seal File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 2 end-to-end seal text detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description - - - - - - PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml

Note: The evaluation set for the above accuracy metrics is our self-built seal text detection dataset, containing 500 images of circle seal types. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Seal Text Detection Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/practical_seal.tar -P ./dataset\ntar -xf ./dataset/practical_seal.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/practical_seal/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 793,\n    \"train_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4055390_00006_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3712248_00008_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4227328_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3745965_00007_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3980931_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC5896212_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3838814_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4677212_00002_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4058803_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4925966_00001_seal_0_crop.png\"\n    ],\n    \"val_samples\": 277,\n    \"val_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/15.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/16.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/17.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/18.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/19.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/20.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/21.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/22.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/23.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/24.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/practical_seal\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 739;
  • attributes.val_samples: The number of validation set samples in this dataset is 277;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all boxes's width and height in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4 \\\n    -o Train.learning_rate=0.0001\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/practical_seal\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate 3 experiments based on the PP-OCRv4_server_seal_det model, with learning rates of: 0.001\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate Hmean(%) 1 0.001 97.35 2 0.0001 93.32 3 0.00001 87.63

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [1, 4] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate Hmean(%) 1 30 97.35 4 100 98.13

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.seal_text_det_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: ./output/best_accuracy/inference\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u5e7f\u5173\u5e02\u200b\u56fd\u58eb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the seal is as follows, with the correctly added ability to extract the seal text information:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"seal\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html","title":"PaddleX 3.0 General Image Classification Pipeline \u2014 Garbage Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For garbage classification, it falls under the general image classification task, corresponding to PaddleX's universal image classification pipeline. If you're unsure about the task-pipeline correspondence, you can check the capabilities of relevant pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a General Image Classification pipeline for a quick trial.

Quick Trial Output Example:

After trying the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is not satisfactory, you can test alternative models and decide if further fine-tuning is needed. Since this tutorial aims to classify specific garbage types, the default weights (trained on the ImageNet-1k dataset) are insufficient. You need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 80 end-to-end image classification models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model List Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-HGNetV2_B6 86.30 10.46 240.18 288 CLIP_vit_base_patch16_224 85.39 12.03 234.85 331 PP-HGNetV2_B4 83.57 2.45 38.10 76 SwinTransformer_base_patch4_window7_224 83.37 12.35 - 342 PP-HGNet_small 81.51 4.24 108.21 94 PP-HGNetV2_B0 77.77 0.68 6.41 23 ResNet50 76.50 3.12 50.90 98 PP-LCNet_x1_0 71.32 1.01 3.39 7 MobileNetV3_small_x1_0 68.24 1.09 3.65 12

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial will use the PP-LCNet_x1_0 model as an example to complete the full model development process. You can select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within your pipeline and ultimately use them in real-world scenarios.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Garbage Classification Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/trash40.tar -P ./dataset\ntar -xf ./dataset/trash40.tar -C ./dataset/\n
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/trash40/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": ../../dataset/trash40/label.txt\",\n    \"num_classes\": 40,\n    \"train_samples\": 1605,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/img_14950.jpg\",\n      \"check_dataset/demo_img/img_12045.jpg\",\n    ],\n    \"val_samples\": 3558,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/img_198.jpg\",\n      \"check_dataset/demo_img/img_19627.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/trash40/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 40, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 1605;
  • attributes.val_samples: The number of validation set samples in this dataset is 3558;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/trash40 \\\n    -o Train.num_classes=40\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/trash40\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 20, and set the batch size to 64 due to the small size of the training dataset.
  2. Initiate three experiments based on the PP-LCNet_x1_0 model, with learning rates of: 0.01, 0.001, 0.1.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.01. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 2 20 0.001 64 4 GPUs 30.64% Experiment 3 20 0.1 64 4 GPUs 71.53%

Changing Epochs Experiment Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 1 (Increased Epochs) 50 0.01 64 4 GPUs 77.32% Experiment 1 (Increased Epochs) 80 0.01 64 4 GPUs 77.60% Experiment 1 (Increased Epochs) 100 0.01 64 4 GPUs 77.80%

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine, with FP32 precision. CPU inference speed is based on an Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing. Use the test file to perform predictions:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for garbage_demo.png is shown below:

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Image Classification Pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/image_classification.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/image_classification.yaml\")\noutput = pipeline.predict(\"./dataset/trash40/images/test/0/img_154.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Image Classification Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html","title":"PaddleX 3.0 General Instance Segmentation Pipeline \u2014 Tutorial for Remote Sensing Image Instance Segmentation","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of remote sensing image segmentation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For remote sensing image segmentation, this falls under the category of instance segmentation, corresponding to PaddleX's Universal Instance Segmentation Pipeline. If unsure about the task-pipeline correspondence, refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline instance_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Instance Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the included model needs further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for testing until satisfied. If the final results are unsatisfactory, fine-tuning the model is necessary. This tutorial aims to produce a model that segments geospatial objects, and the default weights (trained on the COCO dataset) cannot meet this requirement. Data collection and annotation are required for training and fine-tuning.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides 15 end-to-end instance segmentation models. Refer to the Model List for details. Benchmarks for some models are as follows:

Model List mAP(%) GPU Inference Time(ms) Model Size(M) Mask-RT-DETR-H 48.8 61.40 486 Mask-RT-DETR-X 47.5 45.70 257 Mask-RT-DETR-L 45.7 37.40 123 Mask-RT-DETR-S 40.9 32.40 57

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA V100 machine with FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the Mask-RT-DETR-H model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally apply them in real-world scenarios.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Remote Sensing Image Instance Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/intseg_remote_sense_coco.tar -P ./dataset\ntar -xf ./dataset/intseg_remote_sense_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

When verifying the dataset, you only need one command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print Check dataset passed !, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 2989,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/524.jpg\",\n      \"check_dataset/demo_img/024.jpg\",\n    ],\n    \"val_samples\": 932,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/326.jpg\",\n      \"check_dataset/demo_img/596.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/intseg_remote_sense_coco/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 10, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 2989.
  • attributes.val_samples: The number of validation samples in this dataset is 932.
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples.
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples.

Additionally, the dataset verification also analyzes the sample number distribution of all categories in the dataset and generates a distribution histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations of some parameters in the configuration file:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If re-splitting the dataset, the percentage of the training set needs to be set, which is an integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If re-splitting the dataset, the percentage of the validation set needs to be set, which is an integer between 0-100, and the sum with train_percent must be 100;

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in the original path. The above parameters also support setting through appending command line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco \\\n    -o Train.num_classes=10\n

PaddleX model training supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. The following are example explanations of some parameters in the configuration file:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which logs whether the training task completed successfully, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, which records changes in model metrics, loss variations, etc. during the training process;
  • config.yaml: Training configuration file, which records the hyperparameter configurations for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer states, EMA (Exponential Moving Average), static graph network parameters, and static graph network structures;
"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight files on the validation set to verify the model's accuracy. To perform model evaluation using PaddleX, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

Similar to model training, model evaluation supports setting configurations by modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 80 and the batch size at 2.
  2. Launch three experiments based on the Mask-RT-DETR-H model with learning rates of: 0.0005, 0.005, 0.0001
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results for different epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 80 0.0005 2 4 GPUs 0.695 Experiment 2 80 0.0001 2 4 GPUs 0.825 Experiment 3 80 0.00005 2 4 GPUs 0.706

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 80 0.0001 2 4 GPUs 0.825 Reduced Epochs in Experiment 2 30 0.0001 2 4 GPUs 0.287 Reduced Epochs in Experiment 2 50 0.0001 2 4 GPUs 0.545 Increased Epochs in Experiment 2 100 0.0001 2 4 GPUs 0.813

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above, which is normal.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for remotesensing_demo.png is as follows:

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general instance segmentation pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/instance_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/instance_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the result visualization image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Instance Segmentation Pipline User Guide\u3002

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial on Pedestrian Fall Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of pedestrian fall detection.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the appropriate PaddleX pipeline based on your task scenario. For pedestrian fall detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\n

  • AIStudio Community Experience: Navigate to Baidu AIStudio Community, click \"Create Pipeline,\" and create a General Object Detection pipeline for a quick trial.

Quick trial output example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. Since the default weights (trained on the COCO dataset) are unlikely to meet the requirements for detecting pedestrian falls, you'll need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Here's a benchmark of some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the PP-YOLOE_plus-S model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally deploy

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Pedestrian Fall Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/fall_det.tar -P ./dataset\ntar -xf ./dataset/fall_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/fall_det\n

After executing the above command, PaddleX will verify the dataset and count its basic information. Upon successful execution, the log will print out Check dataset passed ! information, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized example images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 1224,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/fall_1168.jpg\",\n      \"check_dataset/demo_img/fall_1113.jpg\"\n    ],\n    \"val_samples\": 216,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/fall_349.jpg\",\n      \"check_dataset/demo_img/fall_394.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/fall_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 1224.
  • attributes.val_samples: The number of validation samples in this dataset is 216.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False.
      • src_dataset_type: If dataset format conversion is performed, the source dataset format must be specified. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False.
      • train_percent: If dataset splitting is performed, the percentage of the training set must be set. The value should be an integer between 0 and 100, and the sum with val_percent must be 100.
      • val_percent: If dataset splitting is performed, the percentage of the validation set must be set. The value should be an integer between 0 and 100, and the sum with train_percent must be 100.

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support setting through appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/fall_det \\\n    -o Train.num_classes=1\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command-line parameters.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/fall_det\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line parameters.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve model accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The learning rate setting affects the speed and stability of model convergence. Therefore, when optimizing model performance, carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the control variable method when debugging parameters:

  1. First, fix the number of training epochs to 10 and the batch size to 8.
  2. Start three experiments based on the PP-YOLOE_plus-S model with learning rates of: 0.00002, 0.0001, 0.0005.
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results of different epochs. It is found that the best accuracy is basically achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 10 0.00002 8 4 GPUs 0.880 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 3 10 0.0005 8 4 GPUs 0.888

Changing Epochs Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 2 (Increased Epochs) 50 0.0001 8 4 GPUs 0.944 Experiment 2 (Increased Epochs) 100 0.0001 8 4 GPUs 0.947

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\"\n

The prediction results will be generated under ./output, and the prediction result for fall.png is shown below:

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial for Fashion Element Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of fashion element detection in clothing.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For fashion element detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\n

  • AIStudio Community Experience: Visit Baidu AIStudio Community, click \"Create Pipeline,\" and select the General Object Detection pipeline for a quick trial.

Quick Trial Output Example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. For this tutorial, aiming to detect fashion elements in clothing, the default weights (trained on the COCO dataset) are insufficient. Data collection and annotation, followed by training and fine-tuning, are necessary.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Below are benchmarks for some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models with faster inference speed are placed higher in the table, while models with higher accuracy are lower. This tutorial takes the PicoDet-L model as an example to complete a full model development process. You can judge and select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within the pipeline and ultimately use them in practical scenarios.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Fashion Element Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_mini_fashion_pedia_coco.tar -P ./dataset\ntar -xf ./dataset/det_mini_fashion_pedia_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful command execution, \"Check dataset passed !\" will be printed in the log, and relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 15,\n    \"train_samples\": 4000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/297ea597f7dfa6d710b2e8176cb3b913.jpg\",\n      \"check_dataset/demo_img/2d8b75ce472dbebd41ca8527f0a292f3.jpg\"\n    ],\n    \"val_samples\": 800,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/40e13ebcfa281567c92fc9842510abea.jpg\",\n      \"check_dataset/demo_img/87808e379034ac2344f5132d3dccc6e6.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_mini_fashion_pedia_coco\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the dataset format meets the requirements as check_pass is True. The explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 15, which is the number of classes to be passed for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 4000.
  • attributes.val_samples: The number of validation samples in this dataset is 800.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only datasets that pass the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion. The default is False.
      • src_dataset_type: If dataset format conversion is enabled, you need to set the source dataset format. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting. The default is False.
      • train_percent: If dataset splitting is enabled, you need to set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100.
      • val_percent: If dataset splitting is enabled, you need to set the percentage of the validation set. The value should be an integer between 0 and 100, and the sum with train_percent should be 100.

Data conversion and data splitting can be enabled simultaneously. The original annotation files for data splitting will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the training set and validation set ratio: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco \\\n    -o Train.num_classes=15\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 50: -o Train.epochs_iters=50. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

Similar to model training, model evaluation supports modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a built-in default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By reasonably tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 50 and the batch size at 16.
  2. Initiate three experiments based on the PicoDet-L model with learning rates of: 0.02, 0.04, 0.08.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.04. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 80 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 50 0.02 16 4 GPUs 0.428 Experiment 2 50 0.04 16 4 GPUs 0.471 Experiment 3 50 0.08 16 4 GPUs 0.440

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 50 0.04 16 4 GPUs 0.471 Reduced Epochs in Exp. 2 30 0.04 16 4 GPUs 0.425 Increased Epochs in Exp. 2 80 0.04 16 4 GPUs 0.491 Further Increased Epochs 100 0.04 16 4 GPUs 0.459

Note: This tutorial is designed for a 4-GPU setup. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above figures, which is normal.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#6-pipeline-testing","title":"6. Pipeline Testing","text":"

Replace the model in the pipeline with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for FashionPedia_demo.png is as follows:

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in your production line, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n

For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 License Plate Recognition Tutorial","text":"

PaddleX provides a rich set of pipelines, each consisting of one or more models that work together to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a license plate recognition task as an example.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For license plate recognition, this task falls under text detection, corresponding to PaddleX's Universal OCR pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List supported by PaddleX to understand the capabilities of relevant pipelines.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.), and whether the models included in the pipeline need further fine-tuning. If the speed or accuracy of the models does not meet expectations, select replaceable models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tune the models.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides two end-to-end text detection models. For details, refer to the Model List. The benchmarks of the models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The above accuracy metrics are for the Detection Hmean and Recognition Avg Accuracy on PaddleOCR's self-built Chinese dataset validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while from bottom to top, they have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Depending on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"License Plate Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For information on data format, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ccpd_text_det.tar -P ./dataset\ntar -xf ./dataset/ccpd_text_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#42-dataset-validation","title":"4.2 Dataset Validation","text":"

To validate the dataset, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

After executing the above command, PaddleX will validate the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The validation result file is saved in ./output/check_dataset_result.json, and the specific content of the validation result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 5769,\n    \"train_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/0274305555556-90_266-204&460_520&548-516&548_209&547_204&464_520&460-0_0_3_25_24_24_24_26-63-89.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0126171875-90_267-294&424_498&486-498&486_296&485_294&425_496&424-0_0_3_24_33_32_30_31-157-29.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0371516927083-89_254-178&423_517&534-517&534_204&525_178&431_496&423-1_0_3_24_33_31_29_31-117-667.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/03349609375-90_268-211&469_526&576-526&567_214&576_211&473_520&469-0_0_3_27_31_32_29_32-174-48.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0388454861111-90_269-138&409_496&518-496&518_138&517_139&410_491&409-0_0_3_24_27_26_26_30-174-148.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0198741319444-89_112-208&517_449&600-423&593_208&600_233&517_449&518-0_0_3_24_28_26_26_26-87-268.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3027782118055555555-91_92-186&493_532&574-529&574_199&565_186&497_532&493-0_0_3_27_26_30_33_32-73-336.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/034375-90_258-168&449_528&546-528&542_186&546_168&449_525&449-0_0_3_26_30_30_26_33-94-221.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0286501736111-89_92-290&486_577&587-576&577_290&587_292&491_577&486-0_0_3_17_25_28_30_33-134-122.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/02001953125-92_103-212&486_458&569-458&569_224&555_212&486_446&494-0_0_3_24_24_25_24_24-88-24.jpg\"\n    ],\n    \"val_samples\": 1001,\n    \"val_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/3056141493055555554-88_93-205&455_603&597-603&575_207&597_205&468_595&455-0_0_3_24_32_27_31_33-90-213.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0680295138889-88_94-120&474_581&623-577&605_126&623_120&483_581&474-0_0_5_24_31_24_24_24-116-518.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0482421875-87_265-154&388_496&530-490&495_154&530_156&411_496&388-0_0_5_25_33_33_33_33-84-104.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0347504340278-105_106-235&443_474&589-474&589_240&518_235&443_473&503-0_0_3_25_30_33_27_30-162-4.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0205338541667-93_262-182&428_410&519-410&519_187&499_182&428_402&442-0_0_3_24_26_29_32_24-83-63.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0380913628472-97_250-234&403_529&534-529&534_250&480_234&403_528&446-0_0_3_25_25_24_25_25-185-85.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/020598958333333334-93_267-256&471_482&563-478&563_256&546_262&471_482&484-0_0_3_26_24_25_32_24-102-115.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3030323350694444445-86_131-170&495_484&593-434&569_170&593_226&511_484&495-11_0_5_30_30_31_33_24-118-59.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3016158854166666667-86_97-243&471_462&546-462&527_245&546_243&479_453&471-0_0_3_24_30_27_24_29-98-40.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0340831163194-89_264-177&412_488&523-477&506_177&523_185&420_488&412-0_0_3_24_30_29_31_31-109-46.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/ccpd_text_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 5769;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 1001;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to perform dataset format conversion, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, ensuring the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, ensuring the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

PaddleX supports modifying training hyperparameters, single-machine single/multi-GPU training, etc., by modifying the configuration file or appending command line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, related file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires only one command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly according to the actual situation to achieve the best training effect.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs to 10, the batch size to 8, the number of GPUs to 4, and the total batch size to 32.
  2. Start four experiments based on the PP-OCRv4_server_det model with learning rates of: 0.00005, 0.0001, 0.0005, 0.001.
  3. You can find that Experiment 4 with a learning rate of 0.001 has the highest accuracy, and by observing the validation set score, the accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 20 will further improve the model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Detection Hmean (%) 1 0.00005 99.06 2 0.0001 99.55 3 0.0005 99.60 4 0.001 99.70

Next, based on a learning rate of 0.001, we can increase the number of training epochs. Comparing Experiments [4, 5] below, it can be seen that increasing the number of training epochs further improves the model accuracy. Experiment ID Number of Training Epochs Detection Hmean (%) 4 10 99.70 5 20 99.80

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the models in the production line with the fine-tuned models for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir output/best_accuracy/inference None \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

This will generate prediction results under ./output, where the prediction result for case1.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 Handwritten Chinese Recognition Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that collectively solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also support fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of handwritten Chinese recognition.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For handwritten Chinese recognition, this task falls under the Text Recognition category, corresponding to PaddleX's Universal OCR Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the pipeline's models need further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tuning the model is necessary.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides four end-to-end OCR models. For details, refer to the Model List. Benchmarks for some models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The evaluation set is a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts. The text recognition set contains 11,000 images, and the detection set contains 500 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Based on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Handwritten Chinese Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/handwrite_chinese_text_rec.tar -P ./dataset\ntar -xf ./dataset/handwrite_chinese_text_rec.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 23965,\n    \"train_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/64957.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/138926.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/86760.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/83191.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/79882.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/58639.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1187-P16_1.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/8199.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1225-P19_9.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/183335.png\"\n    ],\n    \"val_samples\": 17259,\n    \"val_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/11.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/12.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/13.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/14.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/15.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/16.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/17.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/18.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/19.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/20.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/handwrite_chinese_text_rec\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 23965;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 17259;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of the samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of the samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to convert the dataset format, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, and needs to ensure that the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, and needs to ensure that the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command-line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters carefully and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs at 20, the batch size at 8, select 4 GPUs, and the total batch size is 32.
  2. Initiate four experiments based on the PP-OCRv4_server_rec model with learning rates of: 0.001, 0.005, 0.0002, 0.0001.
  3. It can be observed that Experiment 3, with a learning rate of 0.0002, yields the highest accuracy, and the validation set score indicates that accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 30, 50, and 80 will further improve model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Recognition Acc (%) 1 0.001 43.28 2 0.005 32.63 3 0.0002 49.64 4 0.0001 46.32

Next, based on a learning rate of 0.0002, we can increase the number of training epochs. Comparing Experiments [4, 5, 6, 7] below, it can be seen that increasing the number of training epochs further improves model accuracy. Experiment ID Number of Training Epochs Recognition Acc (%) 4 20 49.64 5 30 52.03 6 50 54.15 7 80 54.35

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir None output/best_accuracy/inference \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

The prediction results will be generated under ./output, and the prediction result for case.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html","title":"PaddleX 3.0 General Semantic Segmentation Pipeline \u2014 Lane Line Segmentation Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a lane line segmentation task.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For lane line segmentation, this falls under the category of semantic segmentation tasks, corresponding to PaddleX's Universal Semantic Segmentation Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline semantic_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Semantic Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 18 end-to-end semantic segmentation models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48 82.15 87.97 2180.76 270 PP-LiteSeg-T 77.04 5.98 140.02 31

Note: The above accuracy metrics are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-LiteSeg-T model as an example to complete the full model development process. You can choose a suitable model for training based on your actual usage scenario, evaluate the appropriate model weights within the pipeline, and finally use them in practical scenarios.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Lane Line Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/semantic-segmentation-makassaridn-road-dataset.tar -P ./dataset\ntar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 300,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/20220311151733_0060_040.jpg\",\n      \"check_dataset/demo_img/20220311153115_0023_039.jpg\"\n    ],\n    \"val_samples\": 74,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/20220311152033_0060_007.jpg\",\n      \"check_dataset/demo_img/20220311144930_0060_026.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/semantic-segmentation-makassaridn-road-dataset\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 300;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 74;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 5000 and the batch size at 2.
  2. Initiate three experiments based on the PP-LiteSeg-T model, with learning rates of: 0.006, 0.008, and 0.01.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.008. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 80000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 5000 0.006 2 4 GPUs 0.623 Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 3 5000 0.01 2 4 GPUs 0.619

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 2 with fewer epochs 10000 0.008 2 4 GPUs 0.773 Experiment 2 with more epochs 40000 0.008 2 4 GPUs 0.855 Experiment 2 with more epochs 80000 0.008 2 4 GPUs 0.863

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\"\n

The prediction results will be generated under ./output, where the prediction result for makassaridn-road_demo.png is shown below:

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general semantic segmentation pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/semantic_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Semantic Segmentation Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html","title":"PaddleX 3.0 Time Series Anomaly Detection Pipeline \u2014 Equipment Anomaly Detection Application Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration of pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Local Installation Tutorial. This tutorial introduces the usage of the pipeline tool with an example of detecting anomalies in equipment nodes.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. This task aims to identify and mark abnormal behaviors or states in equipment nodes, helping enterprises and organizations promptly detect and resolve issues in application server nodes, thereby improving system reliability and availability. Recognizing this as a time series anomaly detection task, we will use PaddleX's Time Series Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"PatchTST_ad\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Visit the Official Time Series Anomaly Detection Application to experience the capabilities of time series anomaly detection tasks. Note: Due to the tight correlation between time series data and scenarios, the online experience of official models for time series tasks is tailored to a specific scenario and is not a general solution. Therefore, the experience mode does not support using arbitrary files to evaluate the official model's performance. However, after training a model with your own scenario data, you can select your trained model and use data from the corresponding scenario for online experience.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series anomaly detection models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name Precision Recall F1-Score Model Size (M) Description DLinear_ad 0.9898 0.9396 0.9641 72.8K A simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_ad 0.9855 0.8895 0.9351 1.5MB A transformer-based model optimized for anomaly detection in non-stationary time series AutoEncoder_ad 0.9936 0.8436 0.9125 32K A classic autoencoder-based model that is efficient and easy to use for time series anomaly detection PatchTST_ad 0.9878 0.9070 0.9457 164K A high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_ad 0.9837 0.9480 0.9656 732K A highly adaptive and high-precision time series anomaly detection model through multi-period analysis

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire process of time series anomaly detection, we will use the publicly available MSL (Mars Science Laboratory) dataset for model training and validation. The PSM (Planetary Science Mission) dataset, sourced from NASA, comprises 55 dimensions and includes telemetry anomaly data reported by the spacecraft's monitoring system for unexpected event anomalies (ISA). With its practical application background, it better reflects real-world anomaly scenarios and is commonly used to test and validate the performance of time series anomaly detection models. This tutorial will perform anomaly detection based on this dataset.

We have converted the dataset into a standard data format, and you can obtain a sample dataset using the following command. For an introduction to the data format, please refer to the Time Series Anomaly Detection Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/msl.tar -P ./dataset\ntar -xf ./dataset/msl.tar -C ./dataset/\n

Data Considerations * Time series anomaly detection is an unsupervised learning task, thus labeled training data is not required. The collected training samples should ideally consist solely of normal data, i.e., devoid of anomalies, with the label column in the training set set to 0 or, alternatively, the label column can be omitted entirely. For the validation set, to assess accuracy, labeling is necessary. Points that are anomalous at a particular timestamp should have their labels set to 1, while normal points should have labels of 0. * Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods. * Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/msl\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 58317,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"0\",\n        \"1\",\n        \"2\",\n        \"...\"\n      ],\n      [\n        \"...\"\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/msl\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, refer to Section 4.1.3 in the Time Series Anomaly Detection Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/msl \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=timestamp \\\n-o Train.feature_cols=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 \\\n-o Train.freq=1 \\\n-o Train.label_col=label \\\n-o Train.seq_len=96\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations for parameters in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset verification (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict).
  • device: Training device, options include cpu and gpu. You can check the models supported on different devices in the PaddleX Model List (CPU/GPU) document at the same level directory.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs.
  • learning_rate: Training learning rate.
  • batch_size: Training batch size for a single GPU.
  • time_col: Time column, set the column name of the time series dataset's time column based on your data.
  • feature_cols: Feature variables indicating variables related to whether the device is abnormal.
  • freq: Frequency of the time series dataset.
  • input_len: The length of the time series input to the model. The time series will be sliced according to this length, and the model will predict whether there is an anomaly in this segment of the time series for that length. The recommended input length should be considered in the context of the actual scenario. In this tutorial, the input length is 96, which means we hope to predict whether there are anomalies at 96 time points.
  • label: Represents the number indicating whether a time point in the time series is abnormal. Anomalous points are labeled as 1, and normal points are labeled as 0. In this tutorial, the anomaly monitoring dataset uses label for this purpose.

For more introductions to hyperparameters, please refer to PaddleX Time Series Task Model Configuration File Parameter Instructions. The above parameters can be set by appending command-line arguments. For example, to specify the mode as model training: -o Global.mode=train; to specify the first GPU for training: -o Global.device=gpu:0; to set the number of training epochs to 10: -o Train.epochs_iters=10.

More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/msl\n
Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including F1, recall, and precision.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series anomaly detection:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5, batch size to 16, and input length to 96.
  2. Initiate three experiments based on the PatchTST_ad model with learning rates of: 0.0001, 0.0005, 0.001.
  3. It can be found that Experiment 3 has the highest accuracy, with a learning rate of 0.001. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 20.
  4. It can be found that the accuracy of Experiment 4 is the same as that of Experiment 3, indicating that there is no need to further increase the number of training epochs.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 1 5 0.0001 16 96 1 GPU 79.5 Experiment 2 5 0.0005 16 96 1 GPU 80.1 Experiment 3 5 0.001 16 96 1 GPU 80.9

Increasing Training Epochs Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 3 5 0.0005 16 96 1 GPU 80.9 Experiment 4 20 0.0005 16 96 1 GPU 80.9"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, using the test file for prediction:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/test.csv\"\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#7-integrationdeployment","title":"7. Integration/Deployment","text":"

If the general-purpose time series anomaly detection pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series anomaly detection pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series Anomaly Detection Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series anomaly detection pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_classification.html","title":"PaddleX 3.0 Time Series Classification Pipeline \u2014 Heartbeat Monitoring Time Series Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also allow fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the pipeline tool with an example of heartbeat time series data classification.

"},{"location":"en/practical_tutorials/ts_classification.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For this task, the goal is to train a time series classification model based on heartbeat monitoring data to classify heartbeat time series conditions. Recognizing this as a time series classification task, we select PaddleX's Time Series Classification Pipeline. If unsure about the task-pipeline correspondence, consult the PaddleX Pipeline List (CPU/GPU) for pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_classification.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Access the Official Time Series Classification Application to experience time series classification capabilities.

Note: Due to the tight coupling between time series data and scenarios, the online experience of official models is tailored to a specific scenario and not a universal solution. It does not support arbitrary files for model effect evaluation. However, after training a model with your scenario data, you can select your trained model and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_classification.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides a time series classification model. Refer to the Model List for details. The model benchmark is as follows:

Model Name Acc (%) Model Size (M) Description TimesNet_cls 87.5 792K TimesNet is an adaptive and high-precision time series classification model through multi-cycle analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/practical_tutorials/ts_classification.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ts_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series classification process, we will use the public Heartbeat Dataset for model training and validation. The Heartbeat Dataset is part of the UEA Time Series Classification Archive, addressing the practical task of heartbeat monitoring for medical diagnosis. The dataset comprises multiple time series groups, with each data point consisting of a label variable, group ID, and 61 feature variables. This dataset is commonly used to test and validate the performance of time series classification prediction models.

We have converted the dataset into a standard format, which can be obtained using the following commands. For data format details, refer to the Time Series Classification Module Development Tutorial.

Dataset Acquisition Command:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n

Data Considerations * Based on collected real data, clarify the classification objectives of the time series data and define corresponding classification labels. For example, in stock price classification, labels might be \"Rise\" or \"Fall.\" For a time series that is \"Rising\" over a period, it can be considered a sample (group), where each time point in this period shares a common group_id. * Uniform Time Series Length: Ensure that the length of the time series for each group is consistent. Missing Value Handling: To guarantee the quality and integrity of the data, missing values can be imputed based on expert experience or statistical methods. * Non-Duplication: Ensure that the data is collected row by row in chronological order, with no duplication of the same time point.

"},{"location":"en/practical_tutorials/ts_classification.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [ ...\n    ],\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [ ...\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_classification.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, please refer to Section 4.1.3 in the Time Series Classification Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_classification.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_classification.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/ts_classify_examples \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=time \\\n-o Train.target_cols=dim_0,dim_1,dim_2 \\\n-o Train.freq=1 \\\n-o Train.group_id=group_id \\\n-o Train.static_cov_cols=label\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time-series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supports dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict);
  • device: Training device, options include cpu, gpu. Check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Set the column names of the target variables of the time series dataset based on your data. Can be multiple, separated by commas. Generally, the more relevant the target variables are to the prediction target, the higher the model accuracy. In this tutorial, the heartbeat monitoring dataset has 61 feature variables for the time column, such as dim_0, dim_1, etc.;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • group_id: A group ID represents a time series sample, and time series sequences with the same ID form a sample. Set the column name of the specified group ID based on your data, e.g., group_id.
  • static_cov_cols: Represents the category ID column of the time series. The same sample has the same label. Set the column name of the category based on your data, e.g., label. For more hyperparameter introductions, please refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_classification.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Evaluate.weight_path=./output/best_model/model.pdparams\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including Acc Top1.

"},{"location":"en/practical_tutorials/ts_classification.html#53-model-optimization","title":"5.3 Model Optimization","text":"

By adjusting the number of training epochs appropriately, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

Using the method of controlled variables, we can start with a fixed, relatively small number of epochs in the initial stage and adjust the learning rate multiple times to find an optimal learning rate. After that, we can increase the number of training epochs to further improve the results. Below, we introduce the parameter tuning method for time series classification in detail:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5 and the batch size to 16.
  2. Launch three experiments based on the TimesNet_cls model with learning rates of 0.00001, 0.0001, and 0.001, respectively.
  3. It can be found that Experiment 3 has the highest accuracy. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 30. Note: Due to the built-in early stopping mechanism for time series tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. If you need to change the patience epochs for early stopping, you can manually modify the value of the patience hyperparameter in the configuration file.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 1 5 0.00001 16 1 GPU 72.20% Experiment 2 5 0.0001 16 1 GPU 72.20% Experiment 3 5 0.001 16 1 GPU 73.20%

Results of Increasing Training Epochs:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 3 5 0.001 16 1 GPU 73.20% Experiment 4 30 0.001 16 1 GPU 75.10%"},{"location":"en/practical_tutorials/ts_classification.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Set the model directory to the trained model for testing, using the test file to perform predictions:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_classification/test.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is TimesNet_cls.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/inference\"
  • Specify the path to the input data: -o Predict.input=\"...\"

Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

"},{"location":"en/practical_tutorials/ts_classification.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general time series classification pipeline meets your requirements for inference speed and accuracy, you can directly proceed with development integration/deployment.

  1. If you need to directly apply the general time series classification pipeline in your Python project, you can refer to the following sample code:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_classification\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n

For more parameters, please refer to the Time Series Classification Pipeline Usage Tutorial

  1. Additionally, PaddleX's time series classification pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_forecast.html","title":"PaddleX 3.0 Time Series Forecasting Pipeline \u2014 Long-term Electricity Consumption Forecasting Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the time series forecasting pipeline tool with an example of long-term electricity consumption forecasting.

"},{"location":"en/practical_tutorials/ts_forecast.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. The goal of this task is to predict future electricity consumption based on historical data. Recognizing this as a time series forecasting task, we will use PaddleX's time series forecasting pipeline. If you're unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_forecast.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its pipelines: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:

    from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n

  • AIStudio Community Experience: Visit the Official Time Series Forecasting Application to experience time series forecasting capabilities. Note: Due to the tight correlation between time series data and scenarios, the official online experience models for time series tasks are tailored to specific scenarios and are not universal. Therefore, the online experience does not support using arbitrary files to test the official model solutions. However, after training your own model with scenario-specific data, you can select your trained model solution and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_forecast.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series forecasting models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name MSE MAE Model Size (M) Description DLinear 0.382 0.394 76k A simple, efficient, and easy-to-use time series forecasting model Nonstationary 0.600 0.515 60.3M Based on transformer architecture, optimized for long-term forecasting of non-stationary time series PatchTST 0.385 0.397 2.2M A high-accuracy long-term forecasting model that balances local patterns and global dependencies TiDE 0.405 0.412 34.9M A high-accuracy model suitable for handling multivariate, long-term time series forecasting problems TimesNet 0.417 0.431 5.2M Through multi-period analysis, TimesNet is an adaptable and high-accuracy time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset with an input sequence length of 96 and a prediction sequence length of 96 for all models except TiDE, which is 720.

Based on your actual usage scenario, select an appropriate model for training. After training, evaluate the model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ts_forecast.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series forecasting process, we will use the Electricity dataset for model training and validation. This dataset collects electricity consumption at a certain node from 2012 to 2014, with data collected every hour. Each data point consists of the current timestamp and corresponding electricity consumption. This dataset is commonly used to test and validate the performance of time series forecasting models.

In this tutorial, we will use this dataset to predict the electricity consumption for the next 96 hours. We have already converted this dataset into a standard data format, and you can obtain a sample dataset by running the following command. For an introduction to the data format, you can refer to the Time Series Prediction Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/electricity.tar -P ./dataset\ntar -xf ./dataset/electricity.tar -C ./dataset/\n

Data Considerations

  • When annotating data for time series forecasting tasks, based on the collected real data, all data is arranged in chronological order. During training, the data is automatically divided into multiple time segments, where the historical time series data and the future sequences respectively represent the input data for training the model and its corresponding prediction targets, forming a set of training samples.
  • Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods.
  • Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.
"},{"location":"en/practical_tutorials/ts_forecast.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/electricity\n

After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22880,\n    \"train_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2012-01-01 00:00:00\",\n        2162.0\n      ],\n      [\n        \"2012-01-01 01:00:00\",\n        2835.0\n      ],\n      [\n        \"2012-01-01 02:00:00\",\n        2764.0\n      ],\n      [\n        \"2012-01-01 03:00:00\",\n        2735.0\n      ],\n      [\n        \"2012-01-01 04:00:00\",\n        2721.0\n      ],\n      [\n        \"2012-01-01 05:00:00\",\n        2742.0\n      ],\n      [\n        \"2012-01-01 06:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 07:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 08:00:00\",\n        2680.0\n      ],\n      [\n        \"2012-01-01 09:00:00\",\n        2581.0\n      ]\n    ],\n    \"val_samples\": 3424,\n    \"val_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2014-08-11 08:00:00\",\n        3528.0\n      ],\n      [\n        \"2014-08-11 09:00:00\",\n        3800.0\n      ],\n      [\n        \"2014-08-11 10:00:00\",\n        3889.0\n      ],\n      [\n        \"2014-08-11 11:00:00\",\n        4340.0\n      ],\n      [\n        \"2014-08-11 12:00:00\",\n        4321.0\n      ],\n      [\n        \"2014-08-11 13:00:00\",\n        4293.0\n      ],\n      [\n        \"2014-08-11 14:00:00\",\n        4393.0\n      ],\n      [\n        \"2014-08-11 15:00:00\",\n        4384.0\n      ],\n      [\n        \"2014-08-11 16:00:00\",\n        4495.0\n      ],\n      [\n        \"2014-08-11 17:00:00\",\n        4374.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/electricity\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 22880.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 3424.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_forecast.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings. Refer to Section 4.1.3 in the Time Series Prediction Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_forecast.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/electricity \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=date \\\n-o Train.target_cols=OT \\\n-o Train.freq=1h \\\n-o Train.input_len=96 \\\n-o Train.predict_len=96\n

PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single instance testing (predict);
  • device: Training device, options include cpu, gpu, xpu, npu, mlu; check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Target variable columns, set the column name(s) of the time series dataset's target variable(s) based on your data. Multiple columns can be separated by commas;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • input_len: The length of historical time series input to the model; the input length should be considered comprehensively with the prediction length. Generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy.
  • predict_len: The length of the future sequence that the model is expected to predict; the prediction length should be considered comprehensively with the actual scenario. Generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy.
  • patience: The parameter for the early stopping mechanism, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; the larger the patience value, the longer the training time. For more hyperparameter introductions, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_forecast.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/electricity \\\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including mse and mae.

"},{"location":"en/practical_tutorials/ts_forecast.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series forecast:

It is recommended to follow the method of controlled variables when debugging parameters: 1. Initial Setup: Set the training epochs to 5, batch size to 16, and input length to 96.

  1. Experiments with DLinear Model and Launch three experiments with learning rates: 0.0001, 0.001, 0.01.

  2. Learning Rate Exploration: Experiment 2 yields the highest accuracy. Therefore, fix the learning rate at 0.001 and increase the training epochs to 30. Note: Due to the built-in early stopping mechanism for temporal tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. To adjust the patience epochs, modify the patience hyperparameter in the advanced configuration.

  3. Increasing Training Epochs and Input Length.

After increasing the training epochs, Experiment 4 achieves the highest accuracy. Next, increase the input length to 144 (using 144 hours of historical data to predict the next 96 hours), resulting in Experiment 5 with an accuracy of 0.188.

Learning Rate Exploration Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 1 5 0.0001 16 96 96 1 GPU 0.314 Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 3 5 0.01 16 96 96 1 GPU 0.320

Increasing Training Epochs Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 4 30 0.001 16 96 96 1 GPU 0.301

Increasing Input Length Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 4 30 0.001 16 96 96 1 GPU 0.301 Experiment 5 30 0.001 16 144 96 1 GPU 0.188"},{"location":"en/practical_tutorials/ts_forecast.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model and test using this power test data for prediction:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/test.csv\n
This will generate prediction results under ./output, with the predictions for test.csv saved in result.csv.

Similar to model training and evaluation, follow these steps: * Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml) * Specify the mode as model evaluation: -o Global.mode=evaluate * Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Configuration.

"},{"location":"en/practical_tutorials/ts_forecast.html#7integrationdeployment","title":"7.Integration/Deployment","text":"

If the general-purpose time series forecast pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series forecast pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_forecast\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series forecast Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series forecast pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PPaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/support_list/model_list_dcu.html","title":"PaddleX Model List (Hygon DCU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. The specific models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/model_list_dcu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Storage Size (M) Model Download Link ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_dcu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Storage Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model

Note: The above accuracy metrics are mIoU on the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html","title":"PaddleX Model List (Cambricon MLU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_mlu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_mlu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_mlu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_mlu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_mlu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_mlu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html","title":"PaddleX Model List (Huawei Ascend NPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_npu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link CLIP_vit_base_patch16_224 85.36 306.5 M Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 1.04 G Inference Model/Trained Model ConvNeXt_base_224 83.84 313.9 M Inference Model/Trained Model ConvNeXt_base_384 84.90 313.9 M Inference Model/Trained Model ConvNeXt_large_224 84.26 700.7 M Inference Model/Trained Model ConvNeXt_large_384 85.27 700.7 M Inference Model/Trained Model ConvNeXt_small 83.13 178.0 M Inference Model/Trained Model ConvNeXt_tiny 82.03 101.4 M Inference Model/Trained Model MobileNetV1_x0_5 63.5 4.8 M Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.8 M Inference Model/Trained Model MobileNetV1_x0_75 68.8 9.3 M Inference Model/Trained Model MobileNetV1_x1_0 71.0 15.2 M Inference Model/Trained Model MobileNetV2_x0_5 65.0 7.1 M Inference Model/Trained Model MobileNetV2_x0_25 53.2 5.5 M Inference Model/Trained Model MobileNetV2_x1_0 72.2 12.6 M Inference Model/Trained Model MobileNetV2_x1_5 74.1 25.0 M Inference Model/Trained Model MobileNetV2_x2_0 75.2 41.2 M Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model MobileNetV4_conv_large 83.4 125.2 M Inference Model/Trained Model MobileNetV4_conv_medium 79.9 37.6 M Inference Model/Trained Model MobileNetV4_conv_small 74.6 14.7 M Inference Model/Trained Model PP-HGNet_base 85.0 249.4 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-HGNet_tiny 79.83 52.4 M Inference Model/Trained Model PP-HGNetV2-B0 77.77 21.4 M Inference Model/Trained Model PP-HGNetV2-B1 79.18 22.6 M Inference Model/Trained Model PP-HGNetV2-B2 81.74 39.9 M Inference Model/Trained Model PP-HGNetV2-B3 82.98 57.9 M Inference Model/Trained Model PP-HGNetV2-B4 83.57 70.4 M Inference Model/Trained Model PP-HGNetV2-B5 84.75 140.8 M Inference Model/Trained Model PP-HGNetV2-B6 86.30 268.4 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model PP-LCNetV2_base 77.05 23.7 M Inference Model/Trained Model PP-LCNetV2_large 78.51 37.3 M Inference Model/Trained Model PP-LCNetV2_small 73.97 14.6 M Inference Model/Trained Model ResNet18_vd 72.3 41.5 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34_vd 76.0 77.3 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50_vd 79.1 90.8 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101_vd 80.2 158.4 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152_vd 80.6 214.3 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model ResNet200_vd 80.9 266.0 M Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 310.5 M Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 311.4 M Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 694.8 M Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 696.1 M Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 175.6 M Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_npu.html#_1","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link CLIP_vit_base_patch16_448_ML 89.15 325.6 M Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 39.6 M PP-HGNetV2-B4_ML 87.96 88.5 M Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 286.5 M Inference Model/Trained Model Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"en/support_list/model_list_npu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 245.4 M Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 246.2 M Inference Model/Trained Model CenterNet-DLA-34 37.6 75.4 M Inference Model/Trained Model CenterNet-ResNet50 38.9 319.7 M Inference Model/Trained Model DETR-R50 42.3 159.3 M Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 137.5 M Inference Model/Trained Model FasterRCNN-ResNet50 36.7 120.2 M Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet101 39.0 188.1 M Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 216.3 M Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 360.6 M Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 159.8 M Inference Model/Trained Model FCOS-ResNet50 39.6 124.2 M Inference Model/Trained Model PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-M 37.5 16.8 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PicoDet-XS 26.2 5.7M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model RT-DETR-H 56.3 435.8 M Inference Model/Trained Model RT-DETR-L 53.0 113.7 M Inference Model/Trained Model RT-DETR-R18 46.5 70.7 M Inference Model/Trained Model RT-DETR-R50 53.1 149.1 M Inference Model/Trained Model RT-DETR-X 54.8 232.9 M Inference Model/Trained Model YOLOv3-DarkNet53 39.1 219.7 M Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 83.8 M Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 163.0 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set mAP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_2","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE_plus_SOD-S 25.1 77.3 M Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 325.0 M Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 340.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_3","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_human 48.0 196.1 M Inference Model/Trained Model PP-YOLOE-S_human 42.5 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model Deeplabv3-R50 79.90 138.3 M Inference Model/Trained Model Deeplabv3-R101 80.85 205.9 M Inference Model/Trained Model OCRNet_HRNet-W48 82.15 249.8 M Inference Model/Trained Model PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for Cityscapes dataset mIoU.

"},{"location":"en/support_list/model_list_npu.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP Model Size (M) Model Download Link Mask-RT-DETR-H 50.6 449.9 M Inference Model/Trained Model Mask-RT-DETR-L 45.7 113.6 M Inference Model/Trained Model Mask-RT-DETR-M 42.7 66.6 M Inference Model/Trained Model Mask-RT-DETR-S 41.0 51.8 M Inference Model/Trained Model Mask-RT-DETR-X 47.5 237.5 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 254.8 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 254.7 M Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50 32.8 127.8 M Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 225.4 M Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 225.1 M Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 370.0 M Inference Model/Trained Model PP-YOLOE_seg-S 32.5 31.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set Mask AP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_4","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_rec_CLIP_vit_base 88.69 306.6 M Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 1.05 G Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"en/support_list/model_list_npu.html#_5","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_det 41.5 27.6 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_6","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_vehicle 63.9 196.1 M Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_7","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link STFPM 96.2 21.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"en/support_list/model_list_npu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_npu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_SVTRv2_rec 68.81 73.9 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_RepSVTR_rec 65.07 22.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/model_list_npu.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) Model Size (M) Model Download Link SLANet 76.31 6.9 M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PubtabNet English table recognition dataset.

"},{"location":"en/support_list/model_list_npu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 22.6 M Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 470.1 M Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 470.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_npu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name MSE MAE Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Inference Model/Trained Model PatchTST 0.385 0.397 2.0M Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model TiDE 0.405 0.412 31.7M Inference Model/Trained Model TimesNet 0.417 0.431 4.9M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall F1-Score Model Size (M) Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52K Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112K Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8M Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320K Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/model_list_npu.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name Acc (%) Model Size (M) Model Download Link TimesNet_cls 87.5 792K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary: Training, Evaluation datasets.

"},{"location":"en/support_list/model_list_xpu.html","title":"PaddleX Model List (Kunlun XPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_xpu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_xpu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_xpu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_xpu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_xpu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_xpu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_xpu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html","title":"PaddleX Model List\uff08CPU/GPU\uff09","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module includes various models. You can choose which models to use based on the benchmark data below. If you prioritize model accuracy, select models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/models_list.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_224 85.36 13.1957 285.493 306.5 M CLIP_vit_base_patch16_224.yaml Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 51.1284 1131.28 1.04 G CLIP_vit_large_patch14_224.yaml Inference Model/Trained Model ConvNeXt_base_224 83.84 12.8473 1513.87 313.9 M ConvNeXt_base_224.yaml Inference Model/Trained Model ConvNeXt_base_384 84.90 31.7607 3967.05 313.9 M ConvNeXt_base_384.yaml Inference Model/Trained Model ConvNeXt_large_224 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_224.yaml Inference Model/Trained Model ConvNeXt_large_384 85.27 66.4058 6598.92 700.7 M ConvNeXt_large_384.yaml Inference Model/Trained Model ConvNeXt_small 83.13 9.74075 1127.6 178.0 M ConvNeXt_small.yaml Inference Model/Trained Model ConvNeXt_tiny 82.03 5.48923 672.559 101.4 M ConvNeXt_tiny.yaml Inference Model/Trained Model FasterNet-L 83.5 23.4415 - 357.1 M FasterNet-L.yaml Inference Model/Trained Model FasterNet-M 83.0 21.8936 - 204.6 M FasterNet-M.yaml Inference Model/Trained Model FasterNet-S 81.3 13.0409 - 119.3 M FasterNet-S.yaml Inference Model/Trained Model FasterNet-T0 71.9 12.2432 - 15.1 M FasterNet-T0.yaml Inference Model/Trained Model FasterNet-T1 75.9 11.3562 - 29.2 M FasterNet-T1.yaml Inference Model/Trained Model FasterNet-T2 79.1 10.703 - 57.4 M FasterNet-T2.yaml Inference Model/Trained Model MobileNetV1_x0_5 63.5 1.86754 7.48297 4.8 M MobileNetV1_x0_5.yaml Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_25.yaml Inference Model/Trained Model MobileNetV1_x0_75 68.8 2.57903 10.6343 9.3 M MobileNetV1_x0_75.yaml Inference Model/Trained Model MobileNetV1_x1_0 71.0 2.78781 13.98 15.2 M MobileNetV1_x1_0.yaml Inference Model/Trained Model MobileNetV2_x0_5 65.0 4.94234 11.1629 7.1 M MobileNetV2_x0_5.yaml Inference Model/Trained Model MobileNetV2_x0_25 53.2 4.50856 9.40991 5.5 M MobileNetV2_x0_25.yaml Inference Model/Trained Model MobileNetV2_x1_0 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_0.yaml Inference Model/Trained Model MobileNetV2_x1_5 74.1 6.28385 22.5129 25.0 M MobileNetV2_x1_5.yaml Inference Model/Trained Model MobileNetV2_x2_0 75.2 6.12888 30.8612 41.2 M MobileNetV2_x2_0.yaml Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 6.31302 14.5588 9.6 M MobileNetV3_large_x0_5.yaml Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_35.yaml Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x0_75.yaml Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_0.yaml Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 8.73358 22.1296 26.5 M MobileNetV3_large_x1_25.yaml Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_5.yaml Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_35.yaml Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x0_75.yaml Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_0.yaml Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 6.9589 14.3995 13.0 M MobileNetV3_small_x1_25.yaml Inference Model/Trained Model MobileNetV4_conv_large 83.4 12.5485 51.6453 125.2 M MobileNetV4_conv_large.yaml Inference Model/Trained Model MobileNetV4_conv_medium 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_medium.yaml Inference Model/Trained Model MobileNetV4_conv_small 74.6 5.24172 11.0893 14.7 M MobileNetV4_conv_small.yaml Inference Model/Trained Model MobileNetV4_hybrid_large 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_large.yaml Inference Model/Trained Model MobileNetV4_hybrid_medium 80.5 19.7543 62.2624 42.9 M MobileNetV4_hybrid_medium.yaml Inference Model/Trained Model PP-HGNet_base 85.0 14.2969 327.114 249.4 M PP-HGNet_base.yaml Inference Model/Trained Model PP-HGNet_small 81.51 5.50661 119.041 86.5 M PP-HGNet_small.yaml Inference Model/Trained Model PP-HGNet_tiny 79.83 5.22006 69.396 52.4 M PP-HGNet_tiny.yaml Inference Model/Trained Model PP-HGNetV2-B0 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B0.yaml Inference Model/Trained Model PP-HGNetV2-B1 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B1.yaml Inference Model/Trained Model PP-HGNetV2-B2 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B2.yaml Inference Model/Trained Model PP-HGNetV2-B3 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B3.yaml Inference Model/Trained Model PP-HGNetV2-B4 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B4.yaml Inference Model/Trained Model PP-HGNetV2-B5 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B5.yaml Inference Model/Trained Model PP-HGNetV2-B6 86.30 21.226 255.279 268.4 M PP-HGNetV2-B6.yaml Inference Model/Trained Model PP-LCNet_x0_5 63.14 3.67722 6.66857 6.7 M PP-LCNet_x0_5.yaml Inference Model/Trained Model PP-LCNet_x0_25 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_25.yaml Inference Model/Trained Model PP-LCNet_x0_35 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_35.yaml Inference Model/Trained Model PP-LCNet_x0_75 68.18 3.91032 8.06953 8.4 M PP-LCNet_x0_75.yaml Inference Model/Trained Model PP-LCNet_x1_0 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_0.yaml Inference Model/Trained Model PP-LCNet_x1_5 73.71 3.97666 12.3457 16.0 M PP-LCNet_x1_5.yaml Inference Model/Trained Model PP-LCNet_x2_0 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_0.yaml Inference Model/Trained Model PP-LCNet_x2_5 76.60 4.06028 21.5063 32.1 M PP-LCNet_x2_5.yaml Inference Model/Trained Model PP-LCNetV2_base 77.05 5.23428 19.6005 23.7 M PP-LCNetV2_base.yaml Inference Model/Trained Model PP-LCNetV2_large 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_large.yaml Inference Model/Trained Model PP-LCNetV2_small 73.97 3.89762 13.0273 14.6 M PP-LCNetV2_small.yaml Inference Model/Trained Model ResNet18_vd 72.3 3.53048 31.3014 41.5 M ResNet18_vd.yaml Inference Model/Trained Model ResNet18 71.0 2.4868 27.4601 41.5 M ResNet18.yaml Inference Model/Trained Model ResNet34_vd 76.0 5.60675 56.0653 77.3 M ResNet34_vd.yaml Inference Model/Trained Model ResNet34 74.6 4.16902 51.925 77.3 M ResNet34.yaml Inference Model/Trained Model ResNet50_vd 79.1 10.1885 68.446 90.8 M ResNet50_vd.yaml Inference Model/Trained Model ResNet50 76.5 9.62383 64.8135 90.8 M ResNet50.yaml Inference Model/Trained Model ResNet101_vd 80.2 20.0563 124.85 158.4 M ResNet101_vd.yaml Inference Model/Trained Model ResNet101 77.6 19.2297 121.006 158.7 M ResNet101.yaml Inference Model/Trained Model ResNet152_vd 80.6 29.6439 181.678 214.3 M ResNet152_vd.yaml Inference Model/Trained Model ResNet152 78.3 30.0461 177.707 214.2 M ResNet152.yaml Inference Model/Trained Model ResNet200_vd 80.9 39.1628 235.185 266.0 M ResNet200_vd.yaml Inference Model/Trained Model StarNet-S1 73.6 9.895 23.0465 11.2 M StarNet-S1.yaml Inference Model/Trained Model StarNet-S2 74.8 7.91279 21.9571 14.3 M StarNet-S2.yaml Inference Model/Trained Model StarNet-S3 77.0 10.7531 30.7656 22.2 M StarNet-S3.yaml Inference Model/Trained Model StarNet-S4 79.0 15.2868 43.2497 28.9 M StarNet-S4.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 16.9848 383.83 310.5 M SwinTransformer_base_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 37.2855 1178.63 311.4 M SwinTransformer_base_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 74.1768 2105.22 696.1 M SwinTransformer_large_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 16.3982 285.56 175.6 M SwinTransformer_small_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 8.54846 156.306 100.1 M SwinTransformer_tiny_patch4_window7_224.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on the ImageNet-1k validation set.

"},{"location":"en/support_list/models_list.html#image-multi-label-classification-module","title":"Image Multi-Label Classification Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_448_ML 89.15 - - 325.6 M CLIP_vit_base_patch16_448_ML.yaml Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 - - 39.6 M PP-HGNetV2-B0_ML.yaml Inference Model/Trained Model PP-HGNetV2-B4_ML 87.96 - - 88.5 M PP-HGNetV2-B4_ML.yaml Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 - - 286.5 M PP-HGNetV2-B6_ML.yaml Inference Model/Trained Model PP-LCNet_x1_0_ML 77.96 - - 29.4 M PP-LCNet_x1_0_ML.yaml Inference Model/Trained Model ResNet50_ML 83.50 - - 108.9 M ResNet50_ML.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/support_list/models_list.html#pedestrian-attribute-module","title":"Pedestrian Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_pedestrian_attribute 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#vehicle-attribute-module","title":"Vehicle Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_vehicle_attribute 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on the VeRi dataset.

"},{"location":"en/support_list/models_list.html#image-feature-module","title":"Image Feature Module","text":"Model Name recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2_rec.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_base.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G PP-ShiTuV2_rec_CLIP_vit_large.yaml Inference Model/Trained Model

Note: The above accuracy metrics are recall@1 on AliProducts.

"},{"location":"en/support_list/models_list.html#document-orientation-classification-module","title":"Document Orientation Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_doc_ori 99.26 3.84845 9.23735 7.1 M PP-LCNet_x1_0_doc_ori.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#face-feature-module","title":"Face Feature Module","text":"Model Name Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link MobileFaceNet 128 96.28/96.71/99.58 4.1 MobileFaceNet.yaml Inference Model/Trained Model ResNet50_face 512 98.12/98.56/99.77 87.2 ResNet50_face.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively.

"},{"location":"en/support_list/models_list.html#main-body-detection-module","title":"Main Body Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_det 41.5 33.7426 537.003 27.6 M PP-ShiTuV2_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PaddleClas main body detection dataset.

"},{"location":"en/support_list/models_list.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 - - 245.4 M Cascade-FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 - - 246.2 M Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model CenterNet-DLA-34 37.6 - - 75.4 M CenterNet-DLA-34.yaml Inference Model/Trained Model CenterNet-ResNet50 38.9 - - 319.7 M CenterNet-ResNet50.yaml Inference Model/Trained Model DETR-R50 42.3 59.2132 5334.52 159.3 M DETR-R50.yaml Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 - - 137.5 M FasterRCNN-ResNet34-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 - - 148.1 M FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50 36.7 - - 120.2 M FasterRCNN-ResNet50.yaml Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 - - 216.3 M FasterRCNN-ResNet101-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet101 39.0 - - 188.1 M FasterRCNN-ResNet101.yaml Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 - - 360.6 M FasterRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 - - 159.8 M FasterRCNN-Swin-Tiny-FPN.yaml Inference Model/Trained Model FCOS-ResNet50 39.6 103.367 3424.91 124.2 M FCOS-ResNet50.yaml Inference Model/Trained Model PicoDet-L 42.6 16.6715 169.904 20.9 M PicoDet-L.yaml Inference Model/Trained Model PicoDet-M 37.5 16.2311 71.7257 16.8 M PicoDet-M.yaml Inference Model/Trained Model PicoDet-S 29.1 14.097 37.6563 4.4 M PicoDet-S.yaml Inference Model/Trained Model PicoDet-XS 26.2 13.8102 48.3139 5.7M PicoDet-XS.yaml Inference Model/Trained Model PP-YOLOE_plus-L 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus-L.yaml Inference Model/Trained Model PP-YOLOE_plus-M 49.8 19.843 449.261 83.2 M PP-YOLOE_plus-M.yaml Inference Model/Trained Model PP-YOLOE_plus-S 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-S.yaml Inference Model/Trained Model PP-YOLOE_plus-X 54.7 57.8995 1439.93 349.4 M PP-YOLOE_plus-X.yaml Inference Model/Trained Model RT-DETR-H 56.3 114.814 3933.39 435.8 M RT-DETR-H.yaml Inference Model/Trained Model RT-DETR-L 53.0 34.5252 1454.27 113.7 M RT-DETR-L.yaml Inference Model/Trained Model RT-DETR-R18 46.5 19.89 784.824 70.7 M RT-DETR-R18.yaml Inference Model/Trained Model RT-DETR-R50 53.1 41.9327 1625.95 149.1 M RT-DETR-R50.yaml Inference Model/Trained Model RT-DETR-X 54.8 61.8042 2246.64 232.9 M RT-DETR-X.yaml Inference Model/Trained Model YOLOv3-DarkNet53 39.1 40.1055 883.041 219.7 M YOLOv3-DarkNet53.yaml Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 18.6692 267.214 83.8 M YOLOv3-MobileNetV3.yaml Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 31.6276 856.047 163.0 M YOLOv3-ResNet50_vd_DCN.yaml Inference Model/Trained Model YOLOX-L 50.1 185.691 1250.58 192.5 M YOLOX-L.yaml Inference Model/Trained Model YOLOX-M 46.9 123.324 688.071 90.0 M YOLOX-M.yaml Inference Model/Trained Model YOLOX-N 26.1 79.1665 155.59 3.4 M YOLOX-N.yaml Inference Model/Trained Model YOLOX-S 40.4 184.828 474.446 32.0 M YOLOX-S.yaml Inference Model/Trained Model YOLOX-T 32.9 102.748 212.52 18.1 M YOLOX-T.yaml Inference Model/Trained Model YOLOX-X 51.8 227.361 2067.84 351.5 M YOLOX-X.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/models_list.html#small-object-detection-module","title":"Small Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE_plus_SOD-S 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-S.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-L.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 458.521 11172.7 340.5 M PP-YOLOE_plus_SOD-largesize-L.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the VisDrone-DET validation set.

"},{"location":"en/support_list/models_list.html#pedestrian-detection-module","title":"Pedestrian Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_human 48.0 32.7754 777.691 196.1 M PP-YOLOE-L_human.yaml Inference Model/Trained Model PP-YOLOE-S_human 42.5 15.0118 179.317 28.8 M PP-YOLOE-S_human.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman validation set.

"},{"location":"en/support_list/models_list.html#vehicle-detection-module","title":"Vehicle Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_vehicle 63.9 32.5619 775.633 196.1 M PP-YOLOE-L_vehicle.yaml Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 15.3787 178.441 28.8 M PP-YOLOE-S_vehicle.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set.

"},{"location":"en/support_list/models_list.html#face-detection-module","title":"Face Detection Module","text":"Model AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link BlazeFace 77.7/73.4/49.5 0.447 BlazeFace.yaml Inference Model/Trained Model BlazeFace-FPN-SSH 83.2/80.5/60.5 0.606 BlazeFace-FPN-SSH.yaml Inference Model/Trained Model PicoDet_LCNet_x2_5_face 93.7/90.7/68.1 28.9 PicoDet_LCNet_x2_5_face.yaml Inference Model/Trained Model PP-YOLOE_plus-S_face 93.9/91.8/79.8 26.5 PP-YOLOE_plus-S_face Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640.

"},{"location":"en/support_list/models_list.html#abnormality-detection-module","title":"Abnormality Detection Module","text":"Model Name Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link STFPM 96.2 - - 21.5 M STFPM.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the MVTec AD dataset using the average anomaly score.

"},{"location":"en/support_list/models_list.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Deeplabv3_Plus-R50 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R50.yaml Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 100.026 2460.71 162.5 M Deeplabv3_Plus-R101.yaml Inference Model/Trained Model Deeplabv3-R50 79.90 82.2631 1735.83 138.3 M Deeplabv3-R50.yaml Inference Model/Trained Model Deeplabv3-R101 80.85 121.492 2685.51 205.9 M Deeplabv3-R101.yaml Inference Model/Trained Model OCRNet_HRNet-W18 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W18.yaml Inference Model/Trained Model OCRNet_HRNet-W48 82.15 78.9976 2226.95 249.8 M OCRNet_HRNet-W48.yaml Inference Model/Trained Model PP-LiteSeg-T 73.10 7.6827 138.683 28.5 M PP-LiteSeg-T.yaml Inference Model/Trained Model PP-LiteSeg-B 75.25 10.9935 194.727 47.0 M PP-LiteSeg-B.yaml Inference Model/Trained Model SegFormer-B0 (slice) 76.73 11.1946 268.929 13.2 M SegFormer-B0.yaml Inference Model/Trained Model SegFormer-B1 (slice) 78.35 17.9998 403.393 48.5 M SegFormer-B1.yaml Inference Model/Trained Model SegFormer-B2 (slice) 81.60 48.0371 1248.52 96.9 M SegFormer-B2.yaml Inference Model/Trained Model SegFormer-B3 (slice) 82.47 64.341 1666.35 167.3 M SegFormer-B3.yaml Inference Model/Trained Model SegFormer-B4 (slice) 82.38 82.4336 1995.42 226.7 M SegFormer-B4.yaml Inference Model/Trained Model SegFormer-B5 (slice) 82.58 97.3717 2420.19 229.7 M SegFormer-B5.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the Cityscapes dataset using mIoU.

Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SeaFormer_base(slice) 40.92 24.4073 397.574 30.8 M SeaFormer_base.yaml Inference Model/Trained Model SeaFormer_large (slice) 43.66 27.8123 550.464 49.8 M SeaFormer_large.yaml Inference Model/Trained Model SeaFormer_small (slice) 38.73 19.2295 358.343 14.3 M SeaFormer_small.yaml Inference Model/Trained Model SeaFormer_tiny (slice) 34.58 13.9496 330.132 6.1 M SeaFormer_tiny.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the ADE20k dataset. \"slice\" indicates that the input image has been cropped.

"},{"location":"en/support_list/models_list.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Mask-RT-DETR-H 50.6 132.693 4896.17 449.9 M Mask-RT-DETR-H.yaml Inference Model/Trained Model Mask-RT-DETR-L 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-L.yaml Inference Model/Trained Model Mask-RT-DETR-M 42.7 36.8329 - 66.6 M Mask-RT-DETR-M.yaml Inference Model/Trained Model Mask-RT-DETR-S 41.0 33.5007 - 51.8 M Mask-RT-DETR-S.yaml Inference Model/Trained Model Mask-RT-DETR-X 47.5 75.755 3358.04 237.5 M Mask-RT-DETR-X.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 - - 254.8 M Cascade-MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 - - 254.7 M Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 - - 157.5 M MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 - - 157.5 M MaskRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50 32.8 - - 127.8 M MaskRCNN-ResNet50.yaml Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 - - 225.4 M MaskRCNN-ResNet101-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 - - 225.1 M MaskRCNN-ResNet101-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 - - 370.0 M MaskRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model PP-YOLOE_seg-S 32.5 - - 31.5 M PP-YOLOE_seg-S.yaml Inference Model/Trained Model

|SOLOv2| 35.5|-|-|179.1 M|SOLOv2.yaml

Note: The above accuracy metrics are evaluated on the COCO2017 validation set using Mask AP(0.5:0.95).

"},{"location":"en/support_list/models_list.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_det 77.79 10.6923 120.177 4.2 M PP-OCRv4_mobile_det.yaml Inference Model/Trained Model PP-OCRv4_server_det 82.69 83.3501 2434.01 100.1M PP-OCRv4_server_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection.

"},{"location":"en/support_list/models_list.html#seal-text-detection-module","title":"Seal Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7 M PP-OCRv4_mobile_seal_det.yaml Inference Model/Trained Model PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built seal dataset by PaddleX, containing 500 seal images.

"},{"location":"en/support_list/models_list.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_rec 78.20 7.95018 46.7868 10.6 M PP-OCRv4_mobile_rec.yaml Inference Model/Trained Model PP-OCRv4_server_rec 79.20 7.19439 140.179 71.2 M PP-OCRv4_server_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_SVTRv2_rec 68.81 8.36801 165.706 73.9 M ch_SVTRv2_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_RepSVTR_rec 65.07 10.5047 51.5647 22.1 M ch_RepSVTR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/models_list.html#formula-recognition-module","title":"Formula Recognition Module","text":"Model Name BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link LaTeX_OCR_rec 0.8821 0.0823 40.01 - - 89.7 M LaTeX_OCR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/support_list/models_list.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SLANet 59.52 522.536 1845.37 6.9 M SLANet.yaml Inference Model/Trained Model SLANet_plus 63.69 522.536 1845.37 6.9 M SLANet_plus.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#image-rectification-module","title":"Image Rectification Module","text":"Model Name MS-SSIM (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link UVDoc 54.40 - - 30.3 M UVDoc.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on a self-built image rectification dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#layout-detection-module","title":"Layout Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PicoDet_layout_1x 86.8 13.036 91.2634 7.4 M PicoDet_layout_1x.yaml Inference Model/Trained Model PicoDet-S_layout_3cls 87.1 13.521 45.7633 4.8 M PicoDet-S_layout_3cls.yaml Inference Model/Trained Model PicoDet-S_layout_17cls 70.3 13.5632 46.2059 4.8 M PicoDet-S_layout_17cls.yaml Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 15.7425 159.771 22.6 M PicoDet-L_layout_3cls.yaml Inference Model/Trained Model PicoDet-L_layout_17cls 79.9 17.1901 160.262 22.6 M PicoDet-L_layout_17cls.yaml Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 114.644 3832.62 470.1 M RT-DETR-H_layout_3cls.yaml Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 115.126 3827.25 470.2 M RT-DETR-H_layout_17cls.yaml Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is the PaddleX self-built Layout Detection Dataset, containing 10,000 images.

"},{"location":"en/support_list/models_list.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size YAML File Model Download Link DLinear 0.382 0.394 72 K DLinear.yaml Inference Model/Trained Model NLinear 0.386 0.392 40 K NLinear.yaml Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Nonstationary.yaml Inference Model/Trained Model PatchTST 0.385 0.397 2.0 M PatchTST.yaml Inference Model/Trained Model RLinear 0.384 0.392 40 K RLinear.yaml Inference Model/Trained Model TiDE 0.405 0.412 31.7 M TiDE.yaml Inference Model/Trained Model TimesNet 0.417 0.431 4.9 M TimesNet.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall f1_score Model Size YAML File Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52 K AutoEncoder_ad.yaml Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112 K DLinear_ad.yaml Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8 M Nonstationary_ad.yaml Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320 K PatchTST_ad.yaml Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3 M TimesNet_ad.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/models_list.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name acc (%) Model Size YAML File Model Download Link TimesNet_cls 87.5 792 K TimesNet_cls.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset.

>Note: All GPU inference times for the above models are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/support_list/pipelines_list.html","title":"PaddleX Pipelines (CPU/GPU)","text":""},{"location":"en/support_list/pipelines_list.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
Document Scene Information Extraction v3 Table Structure Recognition Online Experience Document Image Scene Information Extraction v3 (PP-ChatOCRv3-doc) is a PaddlePaddle-specific intelligent document and image analysis solution that integrates LLM and OCR technologies to solve common complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating the Wenxin large model, it combines vast data and knowledge, providing high accuracy and wide applicability. The open-source version supports local experience and deployment, and fine-tuning training for each module.
  • Construction of knowledge graphs
  • Detection of information related to specific events in online news and social media
  • Extraction and analysis of key information in academic literature (especially in scenarios requiring recognition of seals, distorted images, and more complex tables)
Layout Area Detection Text Detection Text Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
Multi-label Image Classification Multi-label Image Classification None Image multi-label classification is a technology that assigns an image to multiple related categories simultaneously. It is widely used in image tagging, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, such as both \"dog\" and \"outdoor\" labels in a single picture. By using deep learning models, image multi-label classification can automatically extract image features and perform accurate classification to provide more comprehensive information for users. This technology is significant in applications like intelligent search engines and automatic content generation.
  • Medical image diagnosis
  • Complex scene recognition
  • Multi-target monitoring
  • Product attribute recognition
  • Ecological environment monitoring
  • Security monitoring
  • Disaster warning
Small Object Detection Small Object Detection None Small object detection is a technology specifically for identifying small objects in images. It is widely used in surveillance, autonomous driving, and satellite image analysis. It can accurately find and classify small-sized objects like pedestrians, traffic signs, or small animals in complex scenes. By using deep learning algorithms and optimized convolutional neural networks, small object detection can effectively enhance the recognition ability of small objects, ensuring that important information is not missed in practical applications. This technology plays an important role in improving safety and automation levels.
  • Pedestrian detection in autonomous vehicles
  • Identification of small buildings in satellite images
  • Detection of small traffic signs in intelligent transportation systems
  • Identification of small intruding objects in security surveillance
  • Detection of small defects in industrial inspection
  • Monitoring of small animals in drone images
Image Anomaly Detection Image Anomaly Detection None Image anomaly detection is a technology that identifies images that deviate from or do not conform to normal patterns by analyzing their content. It is widely used in industrial quality inspection, medical image analysis, and security surveillance. By using machine learning and deep learning algorithms, image anomaly detection can automatically identify potential defects, anomalies, or abnormal behavior in images, helping us detect problems and take appropriate measures promptly. Image anomaly detection systems are designed to automatically detect and label abnormal situations in images to improve work efficiency and accuracy.
  • Industrial quality control
  • Medical image analysis
  • Anomaly detection in surveillance videos
  • Identification of violations in traffic monitoring
  • Obstacle detection in autonomous driving
  • Agricultural pest and disease monitoring
  • Pollutant identification in environmental monitoring
Layout Parsing Table Structure Recognition None Layout analysis is a technology for extracting structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has wide applications in document management, information extraction, and data digitization. By combining optical character recognition (OCR), image processing, and machine learning algorithms, layout analysis can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. This process typically includes three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data that enhances data processing efficiency and accuracy.
  • Financial and legal document analysis
  • Digitization of historical documents and archives
  • Automated form filling
  • Page structure analysis
Layout Area Detection Text Detection Text Recognition Formula Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification Formula Recognition Layout Area Detection None Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. By using computer vision and machine learning algorithms, formula recognition can convert complex mathematical formula information into an editable LaTeX format, facilitating further data processing and analysis by users.
  • Document digitization and retrieval
  • Formula search engine
  • Formula editor
  • Automated typesetting
Formula Recognition Seal Text Recognition Layout Area Detection None Seal text recognition is a technology that automatically extracts and recognizes seal content from documents or images. Recognizing seal text is part of document processing and has applications in many scenarios, such as contract comparison, inventory audit, and invoice reimbursement audit.
  • Contract and agreement validation
  • Check processing
  • Loan approval
  • Legal document management
Seal Text Detection Text Recognition"},{"location":"en/support_list/pipelines_list.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience Link Pipeline Introduction Applicable Scenarios Semi-supervised Learning for Large Models - Image Classification Semi-supervised Learning for Large Models - Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The general image classification pipeline is designed to solve image classification tasks for given images.
  • Commodity image classification
  • Artwork style classification
  • Crop disease and pest identification
  • Animal species recognition
  • Classification of land, water bodies, and buildings in satellite remote sensing images
Semi-supervised Learning for Large Models - Object Detection Semi-supervised Learning for Large Models - Object Detection Online Experience The semi-supervised learning for large models - object detection pipeline is a unique offering from PaddlePaddle. It utilizes a joint training approach with large and small models, leveraging a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below demonstrates the performance of this pipeline on the COCO dataset with 10% labeled data. After training with this pipeline, on COCO 10% labeled data + 90% unlabeled data, the large model (RT-DETR-H) achieves an 8.4% higher accuracy (47.7% -> 56.1%), setting a new state-of-the-art (SOTA) for this dataset. The small model (PicoDet-S) also achieves over 10% higher accuracy (18.3% -> 28.8%) compared to direct training.
  • Pedestrian, vehicle, and traffic sign detection in autonomous driving
  • Enemy facility and equipment detection in military reconnaissance
  • Seabed organism detection in deep-sea exploration
Semi-supervised Learning for Large Models - OCR Text Detection Online Experience The semi-supervised learning for large models - OCR pipeline is a unique OCR training pipeline from PaddlePaddle. It consists of a text detection model and a text recognition model working in series. The input image is first processed by the text detection model to obtain and rectify all text line bounding boxes, which are then fed into the text recognition model to generate OCR text results. In the text recognition part, a joint training approach with large and small models is adopted, utilizing a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below shows the effects of this pipeline in two OCR application scenarios, demonstrating significant improvements for both large and small models in different contexts.
  • Digitizing paper documents
  • Reading and verifying personal information on IDs, passports, and driver's licenses
  • Recognizing product information in retail
Large Model Semi-supervised Learning - Text Recognition General Scene Information Extraction v2 Text Detection Online Experience The General Scene Information Extraction Pipeline (PP-ChatOCRv2-common) is a unique intelligent analysis solution for complex documents from PaddlePaddle. It combines Large Language Models (LLMs) and OCR technology, leveraging the Wenxin Large Model to integrate massive data and knowledge, achieving high accuracy and wide applicability. The system flow of PP-ChatOCRv2-common is as follows: Input the prediction image, send it to the general OCR system, predict text through text detection and text recognition models, perform vector retrieval between the predicted text and user queries to obtain relevant text information, and finally pass these text information to the prompt generator to recombine them into prompts for the Wenxin Large Model to generate prediction results.
  • Key information extraction from various scenarios such as ID cards, bank cards, household registration books, train tickets, and paper invoices
Text Recognition"},{"location":"en/support_list/pipelines_list_dcu.html","title":"PaddleX Pipelines (DCU)","text":""},{"location":"en/support_list/pipelines_list_dcu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
"},{"location":"en/support_list/pipelines_list_dcu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_mlu.html","title":"PaddleX Pipelines (MLU)","text":""},{"location":"en/support_list/pipelines_list_mlu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis.
  • Stock prediction
  • Climate forecasting
  • Disease spread prediction
  • Energy demand forecasting
  • Traffic flow prediction
  • Product lifecycle prediction
  • Electric load forecasting
"},{"location":"en/support_list/pipelines_list_mlu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_npu.html","title":"PaddleX Pipelines (NPU)","text":""},{"location":"en/support_list/pipelines_list_npu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition General Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
"},{"location":"en/support_list/pipelines_list_npu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_xpu.html","title":"PaddleX Pipelines (XPU)","text":""},{"location":"en/support_list/pipelines_list_xpu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
"},{"location":"en/support_list/pipelines_list_xpu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"}]} \ No newline at end of file +{"config":{"lang":["en","zh"],"separator":"[\\s\\u200b\\-_,:!=\\[\\]()\"`/]+|\\.(?!\\d)|&[lg]t;|(?!\\b)(?=[A-Z][a-z])","pipeline":["stopWordFilter"]},"docs":[{"location":"index.html","title":"Home","text":""},{"location":"index.html#_1","title":"\ud83d\udd0d \u200b\u7b80\u4ecb","text":"

PaddleX 3.0 \u200b\u662f\u200b\u57fa\u4e8e\u200b\u98de\u6868\u200b\u6846\u67b6\u200b\u6784\u5efa\u200b\u7684\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200b\uff0c\u200b\u5b83\u200b\u96c6\u6210\u200b\u4e86\u200b\u4f17\u591a\u200b\u5f00\u7bb1\u200b\u5373\u7528\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u4ece\u200b\u8bad\u7ec3\u200b\u5230\u200b\u63a8\u7406\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u652f\u6301\u200b\u56fd\u5185\u5916\u200b\u591a\u6b3e\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\uff0c\u200b\u52a9\u529b\u200bAI \u200b\u5f00\u53d1\u8005\u200b\u8fdb\u884c\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200bOCR \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b"},{"location":"index.html#_2","title":"\ud83c\udf1f \u200b\u7279\u6027","text":"

\ud83c\udfa8 \u200b\u6a21\u578b\u200b\u4e30\u5bcc\u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1a\u200b\u5c06\u200b\u8986\u76d6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u3001OCR\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7b49\u200b\u591a\u4e2a\u200b\u5173\u952e\u200b\u9886\u57df\u200b\u7684\u200b200+ \u200b\u98de\u6868\u200b\u6a21\u578b\u200b\u6574\u5408\u200b\u4e3a\u200b19 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff0c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u3002\u200b\u540c\u65f6\u200b\u652f\u6301\u200b20+ \u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5f00\u53d1\u8005\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u4f7f\u7528\u200b\u3002

\ud83d\ude80 \u200b\u63d0\u9ad8\u6548\u7387\u200b\u964d\u4f4e\u200b\u95e8\u69db\u200b\uff1a\u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u548c\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u6253\u9020\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u7ed3\u5408\u200b\u3001\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u548c\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7684\u200b8 \u200b\u6761\u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u964d\u4f4e\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3002

\ud83c\udf10 \u200b\u591a\u79cd\u200b\u573a\u666f\u200b\u7075\u6d3b\u200b\u90e8\u7f72\u200b\uff1a\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3001\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u548c\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u7b49\u200b\u591a\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u786e\u4fdd\u200b\u4e0d\u540c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0b\u200b\u6a21\u578b\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u548c\u200b\u5feb\u901f\u200b\u54cd\u5e94\u200b\u3002

\ud83d\udd27 \u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u9ad8\u6548\u200b\u652f\u6301\u200b\uff1a\u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\uff0c\u200b\u786e\u4fdd\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u3002

"},{"location":"index.html#_3","title":"\ud83d\udce3 \u200b\u8fd1\u671f\u200b\u66f4\u65b0","text":"

\ud83d\udd25\ud83d\udd25 2024.9.30\uff0cPaddleX 3.0 Beta1 \u200b\u5f00\u6e90\u200b\u7248\u200b\u6b63\u5f0f\u200b\u53d1\u5e03\u200b\uff0c\u200b\u63d0\u4f9b\u200b 200+ \u200b\u6a21\u578b\u200b \u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1b\u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u5e76\u200b\u5f00\u6e90\u200b PP-ChatOCRv3 \u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u57fa\u7840\u200b\u80fd\u529b\u200b\uff1b\u200b\u652f\u6301\u200b 100+ \u200b\u6a21\u578b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff08\u200b\u6301\u7eed\u200b\u8fed\u4ee3\u200b\u4e2d\u200b\uff09\uff0c4\u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b8\u200b\u4e2a\u200b\u91cd\u70b9\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1b100+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6607\u200b\u817e\u200b 910B\uff0c39+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6606\u4ed1\u200b\u82af\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u3002\u200b\u4f4e\u6210\u672c\u200b\u5b8c\u6210\u200b\u4e00\u7ad9\u5f0f\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u52a0\u901f\u200b\u4ea7\u4e1a\u200b\u5e94\u7528\u200b\u3002\u200b\u65b0\u589e\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u5229\u5668\u200b\uff0c\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7b56\u7565\u200b\u663e\u8457\u200b\u589e\u5f3a\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u5b9e\u65f6\u200b\u9884\u6d4b\u200b\u300210\u200b\u6708\u200b24\u200b\u65e5\u200b\uff08\u200b\u5468\u56db\u200b\uff0919\uff1a00\u200b\u76f4\u64ad\u200b\u4e3a\u200b\u60a8\u200b\u6df1\u5ea6\u200b\u89e3\u6790\u200b PP-ChatOCRv3 \u200b\u5f00\u6e90\u200b\u7248\u672c\u200b\u4ee5\u53ca\u200b PaddleX 3.0 Beta1 \u200b\u5728\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u65b9\u9762\u200b\u7684\u200b\u5353\u8d8a\u200b\u4f18\u52bf\u200b\u3002 \u200b\u62a5\u540d\u200b\u94fe\u63a5\u200b

\u2757 \u200b\u66f4\u200b\u591a\u200b\u5b9d\u85cf\u200b\u8bfe\u7a0b\u200b

\ud83d\udd25 2024.6.27\uff0cPaddleX 3.0 Beta \u200b\u5f00\u6e90\u200b\u7248\u200b\u6b63\u5f0f\u200b\u53d1\u5e03\u200b\uff0c\u200b\u652f\u6301\u200b\u4ee5\u4f4e\u200b\u4ee3\u7801\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5728\u200b\u672c\u5730\u200b\u7aef\u200b\u4f7f\u7528\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8fdb\u884c\u200b\u4ea7\u7ebf\u200b\u548c\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u3002

\ud83d\udd25 2024.3.25\uff0cPaddleX 3.0 \u200b\u4e91\u7aef\u200b\u53d1\u5e03\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4ee5\u200b\u96f6\u200b\u4ee3\u7801\u200b\u7684\u200b\u65b9\u5f0f\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\u200b\u4f7f\u7528\u200b\u3002

\u200b\u66f4\u200b\u591a\u200b

"},{"location":"index.html#_4","title":"\ud83d\udd20 \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u8bf4\u660e","text":"

PaddleX \u200b\u81f4\u529b\u4e8e\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7ea7\u522b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3001\u200b\u63a8\u7406\u200b\u4e0e\u200b\u90e8\u7f72\u200b\u3002\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u6307\u200b\u4e00\u7cfb\u5217\u200b\u9884\u5b9a\u200b\u4e49\u597d\u200b\u7684\u200b\u3001\u200b\u9488\u5bf9\u200b\u7279\u5b9a\u200bAI\u200b\u4efb\u52a1\u200b\u7684\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5305\u542b\u200b\u80fd\u591f\u200b\u72ec\u7acb\u200b\u5b8c\u6210\u200b\u67d0\u7c7b\u200b\u4efb\u52a1\u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\uff08\u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff09\u200b\u7ec4\u5408\u200b\u3002

"},{"location":"index.html#_5","title":"\ud83d\udcca \u200b\u80fd\u529b\u200b\u652f\u6301","text":"

PaddleX\u200b\u7684\u200b\u5404\u4e2a\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u672c\u5730\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5728\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5404\u4e2a\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b/\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b/\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u5b8c\u6574\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6982\u89c8\u200b\u6216\u200b\u5404\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u5728\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e3a\u200b\u5f00\u53d1\u8005\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u57fa\u4e8e\u200b\u4e91\u7aef\u200b\u56fe\u5f62\u5316\u200b\u5f00\u53d1\u200b\u754c\u9762\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u5de5\u5177\u200b, \u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\u548c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u5f00\u542f\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b\u6559\u7a0b\u200b\u300a\u200b\u96f6\u200b\u95e8\u69db\u200b\u5f00\u53d1\u200b\u4ea7\u4e1a\u200b\u7ea7\u200bAI\u200b\u6a21\u578b\u200b\u300b

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5feb\u901f\u200b\u63a8\u7406\u200b \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b \u200b\u4e8c\u6b21\u5f00\u53d1\u200b \u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b \u200b\u901a\u7528\u200bOCR \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u94fe\u63a5\u200b \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u94fe\u63a5\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u94fe\u63a5\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u94fe\u63a5\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u4eba\u8138\u8bc6\u522b\u200b \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7

Tip

\u200b\u4ee5\u4e0a\u200b\u529f\u80fd\u200b\u5747\u200b\u57fa\u4e8e\u200b GPU/CPU \u200b\u5b9e\u73b0\u200b\u3002PaddleX \u200b\u8fd8\u200b\u53ef\u200b\u5728\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u3001\u200b\u5bd2\u6b66\u7eaa\u200b\u548c\u200b\u6d77\u5149\u200b\u7b49\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u548c\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u3002\u200b\u4e0b\u8868\u200b\u8be6\u7ec6\u200b\u5217\u51fa\u200b\u4e86\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b\uff0c\u200b\u5177\u4f53\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8bf7\u53c2\u9605\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u6606\u4ed1\u200b\u82af\u200bXPU)/\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u6607\u200b\u817e\u200bNPU)/\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u5bd2\u6b66\u7eaa\u200bMLU)/\u200b\u6a21\u578b\u200b\u5217\u8868\u200b(\u200b\u6d77\u5149\u200bDCU)\u3002\u200b\u6211\u4eec\u200b\u6b63\u5728\u200b\u9002\u914d\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u63a8\u52a8\u200b\u9ad8\u6027\u80fd\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u7684\u200b\u5b9e\u65bd\u200b\u3002

\ud83d\udd25\ud83d\udd25 \u200b\u56fd\u4ea7\u5316\u200b\u786c\u4ef6\u200b\u80fd\u529b\u200b\u652f\u6301\u200b

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u6607\u200b\u817e\u200b 910B \u200b\u6606\u4ed1\u200b\u82af\u200b R200/R300 \u200b\u5bd2\u6b66\u7eaa\u200b MLU370X8 \u200b\u6d77\u5149\u200b Z100 \u200b\u901a\u7528\u200bOCR \u2705 \u2705 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u2705 \u2705 \u2705 \u2705 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u2705 \u2705 \u2705 \u2705 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u2705 \u2705 \u2705 \ud83d\udea7 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7"},{"location":"index.html#discussion","title":"\ud83d\udcac Discussion","text":"

\u200b\u6211\u4eec\u200b\u975e\u5e38\u200b\u6b22\u8fce\u200b\u5e76\u200b\u9f13\u52b1\u200b\u793e\u533a\u200b\u6210\u5458\u200b\u5728\u200b Discussions \u200b\u677f\u5757\u200b\u4e2d\u200b\u63d0\u51fa\u200b\u95ee\u9898\u200b\u3001\u200b\u5206\u4eab\u200b\u60f3\u6cd5\u200b\u548c\u200b\u53cd\u9988\u200b\u3002\u200b\u65e0\u8bba\u200b\u60a8\u200b\u662f\u200b\u60f3\u8981\u200b\u62a5\u544a\u200b\u4e00\u4e2a\u200b bug\u3001\u200b\u8ba8\u8bba\u200b\u4e00\u4e2a\u200b\u529f\u80fd\u200b\u8bf7\u6c42\u200b\u3001\u200b\u5bfb\u6c42\u200b\u5e2e\u52a9\u200b\u8fd8\u662f\u200b\u4ec5\u4ec5\u200b\u60f3\u8981\u200b\u4e86\u89e3\u200b\u9879\u76ee\u200b\u7684\u200b\u6700\u65b0\u200b\u52a8\u6001\u200b\uff0c\u200b\u8fd9\u91cc\u200b\u90fd\u200b\u662f\u200b\u4e00\u4e2a\u200b\u7edd\u4f73\u200b\u7684\u200b\u5e73\u53f0\u200b\u3002

"},{"location":"CHANGLOG.html","title":"\u7248\u672c\u200b\u66f4\u65b0\u200b\u4fe1\u606f","text":""},{"location":"CHANGLOG.html#_2","title":"\u6700\u65b0\u200b\u7248\u672c\u4fe1\u606f","text":""},{"location":"CHANGLOG.html#paddlex-v300beta19302024","title":"PaddleX v3.0.0beta1(9.30/2024)","text":"

PaddleX 3.0 Beta1 \u200b\u63d0\u4f9b\u200b 200+ \u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1b\u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u5e76\u200b\u5f00\u6e90\u200b PP-ChatOCRv3 \u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u57fa\u7840\u200b\u80fd\u529b\u200b\uff1b\u200b\u652f\u6301\u200b 100+ \u200b\u6a21\u578b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c7 \u200b\u7c7b\u200b\u91cd\u70b9\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1b70+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6607\u200b\u817e\u200b 910B\uff0c15+ \u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u5168\u200b\u6d41\u7a0b\u200b\u9002\u914d\u200b\u6606\u4ed1\u200b\u82af\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u3002

  • \u200b\u6a21\u578b\u200b\u4e30\u5bcc\u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff1a \u200b\u5c06\u200b\u8986\u76d6\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u3001OCR\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7b49\u200b\u591a\u4e2a\u200b\u5173\u952e\u200b\u9886\u57df\u200b\u7684\u200b 200+ \u200b\u98de\u6868\u200b\u6a21\u578b\u200b\u6574\u5408\u200b\u4e3a\u200b 13 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u901a\u8fc7\u200b\u6781\u7b80\u200b\u7684\u200b Python API \u200b\u4e00\u952e\u200b\u8c03\u7528\u200b\uff0c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u3002\u200b\u540c\u65f6\u200b\u652f\u6301\u200b 20+ \u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5f00\u53d1\u8005\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u4f7f\u7528\u200b\u3002
  • \u200b\u63d0\u9ad8\u6548\u7387\u200b\u964d\u4f4e\u200b\u95e8\u69db\u200b\uff1a \u200b\u5b9e\u73b0\u200b\u57fa\u4e8e\u200b\u56fe\u5f62\u754c\u9762\u200b\u548c\u200b\u7edf\u4e00\u200b\u547d\u4ee4\u200b\u7684\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u6253\u9020\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u7ed3\u5408\u200b\u3001\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u548c\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7684\u200b8\u200b\u6761\u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u964d\u4f4e\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3002
  • \u200b\u591a\u79cd\u200b\u573a\u666f\u200b\u7075\u6d3b\u200b\u90e8\u7f72\u200b\uff1a \u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3001\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u548c\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u7b49\u200b\u591a\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u786e\u4fdd\u200b\u4e0d\u540c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0b\u200b\u6a21\u578b\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u548c\u200b\u5feb\u901f\u200b\u54cd\u5e94\u200b\u3002
  • \u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u9ad8\u6548\u200b\u652f\u6301\u200b\uff1a \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\uff0c\u200b\u786e\u4fdd\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u3002
"},{"location":"CHANGLOG.html#paddlex-v300beta6272024","title":"PaddleX v3.0.0beta(6.27/2024)","text":"

PaddleX 3.0beta \u200b\u96c6\u6210\u200b\u4e86\u200b\u98de\u6868\u200b\u751f\u6001\u200b\u7684\u200b\u4f18\u52bf\u200b\u80fd\u529b\u200b\uff0c\u200b\u8986\u76d6\u200b 7 \u200b\u5927\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200b 16 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u52a9\u529b\u200b\u5f00\u53d1\u8005\u200b\u5728\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002

  • \u200b\u57fa\u7840\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff08\u200b\u6a21\u578b\u200b\u4e30\u5bcc\u200b\uff0c\u200b\u573a\u666f\u200b\u5168\u9762\u200b\uff09\uff1a \u200b\u7cbe\u9009\u200b 68 \u200b\u4e2a\u200b\u4f18\u8d28\u200b\u98de\u6868\u200b\u6a21\u578b\u200b\uff0c\u200b\u6db5\u76d6\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u3001OCR\u3001\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7b49\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\u3002
  • \u200b\u7279\u8272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff08\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u6548\u7387\u200b\uff09\uff1a \u200b\u63d0\u4f9b\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u7ed3\u5408\u200b\u3001\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u548c\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u7684\u200b\u9ad8\u6548\u200b\u89e3\u51b3\u65b9\u6848\u200b\u3002
  • \u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b\uff08\u200b\u4fbf\u6377\u200b\u5f00\u53d1\u200b\u4e0e\u200b\u90e8\u7f72\u200b\uff09\uff1a \u200b\u63d0\u4f9b\u200b\u96f6\u200b\u4ee3\u7801\u200b\u548c\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u4e24\u79cd\u200b\u5f00\u53d1\u65b9\u5f0f\u200b\u3002
  • \u200b\u96f6\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\uff1a\u200b\u7528\u6237\u200b\u901a\u8fc7\u200b\u56fe\u5f62\u754c\u9762\u200b\uff08GUI\uff09\u200b\u4ea4\u4e92\u5f0f\u200b\u63d0\u4ea4\u200b\u540e\u53f0\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\uff0c\u200b\u6253\u901a\u200b\u5728\u7ebf\u200b\u548c\u200b\u79bb\u7ebf\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5e76\u200b\u652f\u6301\u200b\u4ee5\u200b API \u200b\u5f62\u5f0f\u200b\u8c03\u7528\u200b\u5728\u7ebf\u200b\u670d\u52a1\u200b\u3002
  • \u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u200b\uff1a\u200b\u901a\u8fc7\u200b\u7edf\u4e00\u200b\u7684\u200b API \u200b\u63a5\u53e3\u200b\u5b9e\u73b0\u200b 16 \u200b\u6761\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\uff0c\u200b\u540c\u65f6\u200b\u652f\u6301\u200b\u7528\u6237\u200b\u81ea\u5b9a\u4e49\u200b\u6a21\u578b\u200b\u6d41\u7a0b\u200b\u4e32\u8054\u200b\u3002
  • \u200b\u591a\u200b\u786c\u4ef6\u200b\u672c\u5730\u200b\u652f\u6301\u200b\uff08\u200b\u517c\u5bb9\u6027\u200b\u5f3a\u200b\uff09\uff1a \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b\u3001\u200b\u6607\u200b\u817e\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b\u7b49\u200b\u591a\u79cd\u200b\u786c\u4ef6\u200b\uff0c\u200b\u7eaf\u200b\u79bb\u7ebf\u200b\u4f7f\u7528\u200b\u3002
"},{"location":"CHANGLOG.html#paddlex-v21012102021","title":"PaddleX v2.1.0(12.10/2021)","text":"

\u200b\u65b0\u589e\u200b\u8d85\u200b\u8f7b\u91cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200bPPLCNet\uff0c\u200b\u5728\u200bIntel CPU\u200b\u4e0a\u200b\uff0c\u200b\u5355\u5f20\u200b\u56fe\u50cf\u200b\u9884\u6d4b\u200b\u901f\u5ea6\u200b\u7ea6\u200b5ms\uff0cImageNet-1K\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200bTop1\u200b\u8bc6\u522b\u200b\u51c6\u786e\u7387\u200b\u8fbe\u5230\u200b80.82%\uff0c\u200b\u8d85\u8d8a\u200bResNet152\u200b\u7684\u200b\u6a21\u578b\u200b\u6548\u679c\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u65b0\u589e\u200b\u8f7b\u91cf\u7ea7\u200b\u68c0\u6d4b\u200b\u7279\u8272\u200b\u6a21\u578b\u200bPP-PicoDet\uff0c\u200b\u7b2c\u4e00\u4e2a\u200b\u5728\u200b1M\u200b\u53c2\u200b\u6570\u91cf\u200b\u4e4b\u5185\u200bmAP(0.5:0.95)\u200b\u8d85\u8d8a\u200b30+(\u200b\u8f93\u5165\u200b416\u200b\u50cf\u7d20\u200b\u65f6\u200b)\uff0c\u200b\u7f51\u7edc\u200b\u9884\u6d4b\u200b\u5728\u200bARM CPU\u200b\u4e0b\u53ef\u8fbe\u200b150FPS \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u5347\u7ea7\u200bPaddleX Restful API\uff0c\u200b\u652f\u6301\u200b\u98de\u6868\u200b\u52a8\u6001\u56fe\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u65b0\u589e\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8d1f\u200b\u6837\u672c\u200b\u8bad\u7ec3\u200b\u7b56\u7565\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b \u200b\u65b0\u589e\u200bpython\u200b\u8f7b\u91cf\u7ea7\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b \u200b\u6b22\u8fce\u200b\u4f53\u9a8c\u200b

"},{"location":"CHANGLOG.html#paddlex-v2009102021","title":"PaddleX v2.0.0(9.10/2021)","text":"
  • PaddleX API
  • \u200b\u65b0\u589e\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u3001\u200b\u4ee5\u53ca\u200b\u9884\u6d4b\u200b\u9519\u8bef\u200b\u539f\u56e0\u200b\u5206\u6790\u200b\uff0c\u200b\u8f85\u52a9\u200b\u5206\u6790\u6a21\u578b\u200b\u6548\u679c\u200b
  • \u200b\u65b0\u589e\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u8d1f\u200b\u6837\u672c\u200b\u4f18\u5316\u200b\uff0c\u200b\u6291\u5236\u200b\u80cc\u666f\u200b\u533a\u57df\u200b\u7684\u200b\u8bef\u68c0\u200b
  • \u200b\u5b8c\u5584\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u652f\u6301\u200b\u8fd4\u56de\u200b\u9884\u6d4b\u200b\u7c7b\u522b\u200b\u548c\u200b\u5f52\u4e00\u5316\u200b\u540e\u200b\u7684\u200b\u9884\u6d4b\u200b\u7f6e\u4fe1\u5ea6\u200b
  • \u200b\u5b8c\u5584\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u652f\u6301\u200b\u8fd4\u56de\u200b\u5f52\u4e00\u5316\u200b\u540e\u200b\u7684\u200b\u9884\u6d4b\u200b\u7f6e\u4fe1\u5ea6\u200b
  • \u200b\u9884\u6d4b\u200b\u90e8\u7f72\u200b
  • \u200b\u5b8c\u5907\u200bPaddleX python\u200b\u9884\u6d4b\u200b\u90e8\u7f72\u200b, PaddleX\u200b\u6a21\u578b\u200b\u4f7f\u7528\u200b2\u200b\u4e2a\u200bAPI\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u5b8c\u6210\u200b\u90e8\u7f72\u200b
  • PaddleX C++\u200b\u90e8\u7f72\u200b\u5168\u9762\u200b\u5347\u7ea7\u200b\uff0c\u200b\u652f\u6301\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u5957\u4ef6\u200bPaddleDetection\u3001PaddleClas\u3001PaddleSeg\u3001PaddleX\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u7edf\u4e00\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b
  • \u200b\u5168\u65b0\u200b\u53d1\u5e03\u200bManufacture SDK\uff0c\u200b\u63d0\u4f9b\u200b\u5de5\u4e1a\u200b\u7ea7\u200b\u591a\u7aef\u200b\u591a\u200b\u5e73\u53f0\u200b\u90e8\u7f72\u200b\u52a0\u901f\u200b\u7684\u200b\u9884\u200b\u7f16\u8bd1\u200b\u98de\u6868\u200b\u90e8\u7f72\u200b\u5f00\u53d1\u5305\u200b\uff08SDK\uff09\uff0c\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u200b\u4e1a\u52a1\u200b\u903b\u8f91\u200b\u6d41\u7a0b\u200b\u6587\u4ef6\u200b\u5373\u200b\u53ef\u4ee5\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u65b9\u5f0f\u200b\u5feb\u901f\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u90e8\u7f72\u200b
  • PaddleX GUI
  • \u200b\u5347\u7ea7\u200bPaddleX GUI\uff0c\u200b\u652f\u6301\u200b30\u200b\u7cfb\u5217\u200b\u663e\u5361\u200b
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b\u6a21\u578b\u200bPP-YOLO V2, COCO test\u200b\u6570\u636e\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u8fbe\u5230\u200b49.5%\u3001V100\u200b\u9884\u6d4b\u200b\u901f\u5ea6\u200b\u8fbe\u5230\u200b68.9 FPS
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b4.2MB\u200b\u7684\u200b\u8d85\u200b\u8f7b\u91cf\u7ea7\u200b\u6a21\u578b\u200bPP-YOLO tiny
  • \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b\u5b9e\u65f6\u200b\u5206\u5272\u200b\u6a21\u578b\u200bBiSeNetV2
  • \u200b\u65b0\u589e\u200b\u5bfc\u51fa\u200bAPI\u200b\u8bad\u7ec3\u200b\u811a\u672c\u200b\u529f\u80fd\u200b\uff0c\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200bPaddleX API\u200b\u8bad\u7ec3\u200b
  • \u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u6848\u4f8b\u200b
  • \u200b\u65b0\u589e\u200b\u4ee5\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u4e3a\u4e3b\u200b\u7684\u200b\u94a2\u7b4b\u200b\u8ba1\u6570\u200b\u3001\u200b\u7f3a\u9677\u200b\u68c0\u6d4b\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
  • \u200b\u65b0\u589e\u200b\u4ee5\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u4e3a\u4e3b\u200b\u7684\u200b\u673a\u68b0\u624b\u200b\u6293\u53d6\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
  • \u200b\u65b0\u589e\u200b\u4e32\u8054\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3001\u200b\u4f20\u7edf\u200b\u89c6\u89c9\u200b\u7b97\u6cd5\u200b\u7684\u200b\u5de5\u4e1a\u200b\u8868\u8ba1\u200b\u8bfb\u6570\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u90e8\u7f72\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
  • \u200b\u65b0\u589e\u200bWindows\u200b\u7cfb\u7edf\u200b\u4e0b\u200b\u4f7f\u7528\u200bC#\u200b\u8bed\u8a00\u200b\u90e8\u7f72\u200b\u6848\u4f8b\u200b\u6559\u7a0b\u200b
"},{"location":"CHANGLOG.html#paddlex-v200rc05192021","title":"PaddleX v2.0.0rc0(5.19/2021)","text":"
  • \u200b\u5168\u9762\u200b\u652f\u6301\u200b\u98de\u6868\u200b2.0\u200b\u52a8\u6001\u56fe\u200b\uff0c\u200b\u66f4\u200b\u6613\u7528\u200b\u7684\u200b\u5f00\u53d1\u200b\u6a21\u5f0f\u200b
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200bPP-YOLOv2, COCO test\u200b\u6570\u636e\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u8fbe\u5230\u200b49.5%\u3001V100\u200b\u9884\u6d4b\u200b\u901f\u5ea6\u200b\u8fbe\u5230\u200b68.9 FPS
  • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b4.2MB\u200b\u7684\u200b\u8d85\u200b\u8f7b\u91cf\u7ea7\u200b\u6a21\u578b\u200bPP-YOLO tiny
  • \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u65b0\u589e\u200b\u5b9e\u65f6\u200b\u5206\u5272\u200b\u6a21\u578b\u200bBiSeNetV2
  • C++\u200b\u90e8\u7f72\u200b\u6a21\u5757\u200b\u5168\u9762\u200b\u5347\u7ea7\u200b
    • PaddleInference\u200b\u90e8\u7f72\u200b\u9002\u914d\u200b2.0\u200b\u9884\u6d4b\u200b\u5e93\u200b\uff08\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\uff09
    • \u200b\u652f\u6301\u200b\u98de\u6868\u200bPaddleDetection\u3001PaddleSeg\u3001PaddleClas\u200b\u4ee5\u53ca\u200bPaddleX\u200b\u7684\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b
    • \u200b\u65b0\u589e\u200b\u57fa\u4e8e\u200bPaddleInference\u200b\u7684\u200bGPU\u200b\u591a\u5361\u200b\u9884\u6d4b\u200b\uff08\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\uff09
    • GPU\u200b\u90e8\u7f72\u200b\u65b0\u589e\u200b\u57fa\u4e8e\u200bONNX\u200b\u7684\u200b\u7684\u200bTensorRT\u200b\u9ad8\u6027\u80fd\u200b\u52a0\u901f\u200b\u5f15\u64ce\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b
    • GPU\u200b\u90e8\u7f72\u200b\u65b0\u589e\u200b\u57fa\u4e8e\u200bONNX\u200b\u7684\u200bTriton\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff08\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\uff09
"},{"location":"CHANGLOG.html#paddlex-v13012192020","title":"PaddleX v1.3.0(12.19/2020)","text":"
  • \u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b

    • \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200bResNet50_vd\u200b\u65b0\u589e\u200b10\u200b\u4e07\u200b\u5206\u7c7b\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200bFasterRCNN\u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u88c1\u526a\u200b\u652f\u6301\u200b
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u65b0\u589e\u200b\u591a\u901a\u9053\u200b\u56fe\u50cf\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b
  • \u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u66f4\u65b0\u200b

    • \u200b\u4fee\u590d\u200bOpenVINO\u200b\u90e8\u7f72\u200bC++\u200b\u4ee3\u7801\u200b\u4e2d\u200b\u90e8\u5206\u200bBug
    • \u200b\u6811\u8393\u200b\u6d3e\u200b\u90e8\u7f72\u200b\u65b0\u589e\u200bArm V8\u200b\u652f\u6301\u200b
  • \u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200b\u5de5\u4e1a\u200b\u8d28\u68c0\u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u57fa\u4e8e\u200bGPU\u200b\u548c\u200bCPU\u200b\u4e24\u79cd\u200b\u90e8\u7f72\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u8d28\u68c0\u200b\u65b9\u6848\u200b\uff0c\u200b\u53ca\u200b\u4e0e\u200b\u8d28\u68c0\u200b\u76f8\u5173\u200b\u7684\u200b\u4f18\u5316\u200b\u7b56\u7565\u200b
  • \u200b\u65b0\u589e\u200bRestFUL API\u200b\u6a21\u5757\u200b \u200b\u65b0\u589e\u200bRestFUL API\u200b\u6a21\u5757\u200b\uff0c\u200b\u5f00\u53d1\u8005\u200b\u53ef\u200b\u901a\u8fc7\u200b\u6b64\u200b\u6a21\u5757\u200b\u5feb\u901f\u200b\u5f00\u53d1\u200b\u57fa\u4e8e\u200bPaddleX\u200b\u7684\u200b\u8bad\u7ec3\u200b\u5e73\u53f0\u200b

    • \u200b\u589e\u52a0\u200b\u57fa\u4e8e\u200bRestFUL API\u200b\u7684\u200bHTML Demo
    • \u200b\u589e\u52a0\u200b\u57fa\u4e8e\u200bRestFUL API\u200b\u7684\u200bRemote\u200b\u7248\u200b\u53ef\u89c6\u5316\u200b\u5ba2\u6237\u7aef\u200b \u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200bOpenVINO\u200b\u7684\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b
"},{"location":"CHANGLOG.html#paddlex-v120992020","title":"PaddleX v1.2.0(9.9/2020)","text":"
  • \u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200bPPYOLO
    • FasterRCNN\u3001MaskRCNN\u3001YOLOv3\u3001DeepLabv3p\u200b\u7b49\u200b\u6a21\u578b\u200b\u65b0\u589e\u200b\u5185\u7f6e\u200bCOCO\u200b\u6570\u636e\u200b\u96c6\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200bFasterRCNN\u200b\u548c\u200bMaskRCNN\u200b\u65b0\u589e\u200bbackbone HRNet_W18
    • \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200bDeepLabv3p\u200b\u65b0\u589e\u200bbackbone MobileNetV3_large_ssld
  • \u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200bOpenVINO\u200b\u7684\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b
    • \u200b\u65b0\u589e\u200b\u6a21\u578b\u200b\u5728\u200b\u6811\u8393\u200b\u6d3e\u200b\u4e0a\u200b\u7684\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b
    • \u200b\u4f18\u5316\u200bPaddleLite Android\u200b\u90e8\u7f72\u200b\u7684\u200b\u6570\u636e\u200b\u9884\u5904\u7406\u200b\u548c\u200b\u540e\u5904\u7406\u200b\u4ee3\u7801\u200b\u6027\u80fd\u200b
    • \u200b\u4f18\u5316\u200bPaddle\u200b\u670d\u52a1\u7aef\u200bC++\u200b\u4ee3\u7801\u200b\u90e8\u7f72\u200b\u4ee3\u7801\u200b\uff0c\u200b\u589e\u52a0\u200buse_mkl\u200b\u7b49\u200b\u53c2\u6570\u200b\uff0c\u200b\u901a\u8fc7\u200bmkldnn\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u5728\u200bCPU\u200b\u4e0a\u200b\u7684\u200b\u9884\u6d4b\u200b\u6027\u80fd\u200b
  • \u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b\u66f4\u65b0\u200b

    • \u200b\u65b0\u589e\u200bRGB\u200b\u56fe\u50cf\u200b\u9065\u611f\u200b\u5206\u5272\u200b\u6848\u4f8b\u200b
    • \u200b\u65b0\u589e\u200b\u591a\u901a\u9053\u200b\u9065\u611f\u200b\u5206\u5272\u200b\u6848\u4f8b\u200b
  • \u200b\u5176\u5b83\u200b
    • \u200b\u65b0\u589e\u200b\u6570\u636e\u200b\u96c6\u200b\u5207\u5206\u200b\u529f\u80fd\u200b\uff0c\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u5207\u5206\u200bImageNet\u3001PascalVOC\u3001MSCOCO\u200b\u548c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b
"},{"location":"CHANGLOG.html#paddlex-v1107132020","title":"PaddleX v1.1.0(7.13/2020)","text":"
  • \u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b
    • \u200b\u65b0\u589e\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200bHRNet\u3001FastSCNN
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200bFasterRCNN\u3001\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200bMaskRCNN\u200b\u65b0\u589e\u200bbackbone HRNet
    • \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b/\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u65b0\u589e\u200bCOCO\u200b\u6570\u636e\u200b\u96c6\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b
    • \u200b\u96c6\u6210\u200bX2Paddle\uff0cPaddleX\u200b\u6240\u6709\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u548c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5bfc\u51fa\u200b\u4e3a\u200bONNX\u200b\u534f\u8bae\u200b
  • \u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u66f4\u65b0\u200b
    • \u200b\u6a21\u578b\u200b\u52a0\u5bc6\u200b\u589e\u52a0\u200b\u652f\u6301\u200bWindows\u200b\u5e73\u53f0\u200b
    • \u200b\u65b0\u589e\u200bJetson\u3001PaddleLite\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u9884\u6d4b\u200b\u65b9\u6848\u200b
    • C++\u200b\u90e8\u7f72\u200b\u4ee3\u7801\u200b\u65b0\u589e\u200bbatch\u200b\u6279\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5e76\u200b\u91c7\u7528\u200bOpenMP\u200b\u5bf9\u200b\u9884\u5904\u7406\u200b\u8fdb\u884c\u200b\u5e76\u884c\u200b\u52a0\u901f\u200b
  • \u200b\u65b0\u589e\u200b2\u200b\u4e2a\u200bPaddleX\u200b\u4ea7\u4e1a\u200b\u6848\u4f8b\u200b
    • \u200b\u4eba\u50cf\u200b\u5206\u5272\u200b\u6848\u4f8b\u200b
    • \u200b\u5de5\u4e1a\u200b\u8868\u8ba1\u200b\u8bfb\u6570\u200b\u6848\u4f8b\u200b
  • \u200b\u65b0\u589e\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u529f\u80fd\u200b\uff0cLabelMe\u3001\u200b\u7cbe\u7075\u200b\u6807\u6ce8\u200b\u52a9\u624b\u200b\u548c\u200bEasyData\u200b\u5e73\u53f0\u200b\u6807\u6ce8\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u4e3a\u200bPaddleX\u200b\u652f\u6301\u200b\u52a0\u8f7d\u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b
  • PaddleX\u200b\u6587\u6863\u200b\u66f4\u65b0\u200b\uff0c\u200b\u4f18\u5316\u200b\u6587\u6863\u200b\u7ed3\u6784\u200b
"},{"location":"CHANGLOG.html#paddlex-v1005212020","title":"PaddleX v1.0.0(5.21/2020)","text":"
  • \u200b\u5168\u200b\u6d41\u7a0b\u200b\u6253\u901a\u200b
  • \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\uff1a\u200b\u652f\u6301\u200bEasyData\u200b\u667a\u80fd\u200b\u6570\u636e\u200b\u670d\u52a1\u5e73\u53f0\u200b\u6570\u636e\u200b\u534f\u8bae\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5e73\u53f0\u200b\u4fbf\u6377\u200b\u5b8c\u6210\u200b\u667a\u80fd\u200b\u6807\u6ce8\u200b,\u200b\u4f4e\u8d28\u200b\u6570\u636e\u200b\u6e05\u6d17\u200b\u5de5\u4f5c\u200b, \u200b\u540c\u65f6\u200b\u517c\u5bb9\u200b\u4e3b\u6d41\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u534f\u8bae\u200b, \u200b\u52a9\u529b\u200b\u5f00\u53d1\u8005\u200b\u66f4\u200b\u5feb\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u5de5\u4f5c\u200b\u3002
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a\u200b\u96c6\u6210\u200bPaddleClas, PaddleDetection, PaddleSeg\u200b\u89c6\u89c9\u200b\u5f00\u53d1\u200b\u5957\u4ef6\u200b\uff0c\u200b\u4e30\u5bcc\u200b\u7684\u200b\u9ad8\u8d28\u91cf\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\uff0c\u200b\u66f4\u200b\u5feb\u200b\u5b9e\u73b0\u200b\u5de5\u4e1a\u200b\u7ea7\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u3002
  • \u200b\u6a21\u578b\u200b\u8c03\u4f18\u200b\uff1a\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u53ef\u200b\u89e3\u91ca\u6027\u200b\u6a21\u5757\u200b\u3001VisualDL\u200b\u53ef\u89c6\u5316\u200b\u5206\u6790\u200b\u7ec4\u4ef6\u200b, \u200b\u63d0\u4f9b\u200b\u4e30\u5bcc\u200b\u7684\u200b\u4fe1\u606f\u200b\u66f4\u597d\u200b\u5730\u200b\u7406\u89e3\u200b\u6a21\u578b\u200b\uff0c\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u3002
  • \u200b\u591a\u7aef\u200b\u5b89\u5168\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5185\u7f6e\u200bPaddleSlim\u200b\u6a21\u578b\u200b\u538b\u7f29\u5de5\u5177\u200b\u548c\u200b\u6a21\u578b\u200b\u52a0\u5bc6\u200b\u90e8\u7f72\u200b\u6a21\u5757\u200b\uff0c\u200b\u7ed3\u5408\u200bPaddle Inference\u200b\u6216\u200bPaddle Lite\u200b\u4fbf\u6377\u200b\u5b8c\u6210\u200b\u9ad8\u6027\u80fd\u200b\u7684\u200b\u591a\u7aef\u200b\u5b89\u5168\u200b\u90e8\u7f72\u200b\u3002

  • \u200b\u878d\u5408\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b

  • \u200b\u7cbe\u9009\u200b\u98de\u6868\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u7684\u200b\u6210\u719f\u200b\u6a21\u578b\u200b\u7ed3\u6784\u200b\uff0c\u200b\u5f00\u653e\u200b\u6848\u4f8b\u200b\u5b9e\u8df5\u200b\u6559\u7a0b\u200b\uff0c\u200b\u52a0\u901f\u200b\u5f00\u53d1\u8005\u200b\u4ea7\u4e1a\u200b\u843d\u5730\u200b\u3002

  • \u200b\u6613\u7528\u200b\u6613\u200b\u96c6\u6210\u200b

  • \u200b\u7edf\u4e00\u200b\u6613\u7528\u200b\u7684\u200b\u5168\u200b\u6d41\u7a0b\u200bAPI\uff0c5\u200b\u6b65\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c10\u200b\u884c\u200b\u4ee3\u7801\u200b\u5b9e\u73b0\u200bPython/C++\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3002
  • \u200b\u63d0\u4f9b\u200b\u4ee5\u200bPaddleX\u200b\u4e3a\u200b\u6838\u5fc3\u200b\u96c6\u6210\u200b\u7684\u200b\u8de8\u5e73\u53f0\u200b\u53ef\u89c6\u5316\u200b\u5de5\u5177\u200bPaddleX-GUI\uff0c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u98de\u6868\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u5168\u200b\u6d41\u7a0b\u200b\u3002
"},{"location":"FAQ.html","title":"FAQ","text":""},{"location":"FAQ.html#qpaddlex","title":"Q\uff1aPaddleX\u200b\u662f\u200b\u4ec0\u4e48\u200b\uff1f","text":"

A\uff1aPaddleX \u200b\u662f\u200b\u7531\u200b\u98de\u6868\u200b\u56e2\u961f\u200b\u63a8\u51fa\u200b\u7684\u200b\u4e00\u6b3e\u200b\u7cbe\u9009\u200b\u6a21\u578b\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200b\uff0c\u200b\u65e8\u5728\u200b\u4e3a\u200b\u5f00\u53d1\u8005\u200b\u63d0\u4f9b\u200b\u4e00\u4e2a\u200b\u66f4\u52a0\u200b\u4fbf\u6377\u200b\u548c\u200b\u9ad8\u6548\u200b\u7684\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\u3002\u200b\u8fd9\u200b\u6b3e\u200b\u5de5\u5177\u200b\u4e0d\u4ec5\u200b\u652f\u6301\u200b\u56fd\u5185\u5916\u200b\u591a\u6b3e\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u63a8\u7406\u200b\uff0c\u200b\u8fd8\u200b\u80fd\u591f\u200b\u517c\u5bb9\u200b\u591a\u79cd\u4e0d\u540c\u200b\u7684\u200b\u7cfb\u7edf\u914d\u7f6e\u200b\uff0c\u200b\u4ece\u800c\u200b\u6ee1\u8db3\u7528\u6237\u200b\u5728\u200b\u4e0d\u540c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u9700\u6c42\u200b\u3002PaddleX \u200b\u7684\u200b\u5e94\u7528\u200b\u8303\u56f4\u200b\u975e\u5e38\u200b\u5e7f\u6cdb\u200b\uff0c\u200b\u8986\u76d6\u200b\u4e86\u200b\u5de5\u4e1a\u200b\u3001\u200b\u80fd\u6e90\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u3001\u200b\u6559\u80b2\u200b\u7b49\u200b\u591a\u4e2a\u200b\u884c\u4e1a\u200b\u9886\u57df\u200b\uff0c\u200b\u80fd\u591f\u200b\u4e3a\u200b\u8fd9\u4e9b\u200b\u884c\u4e1a\u200b\u63d0\u4f9b\u200b\u4e13\u4e1a\u200b\u7684\u200b\u652f\u6301\u200b\u548c\u200b\u89e3\u51b3\u65b9\u6848\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b PaddleX \uff0c\u200b\u5f00\u53d1\u8005\u200b\u53ef\u4ee5\u200b\u66f4\u200b\u5bb9\u6613\u200b\u5730\u200b\u5c06\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6280\u672f\u200b\u5e94\u7528\u200b\u4e8e\u200b\u5b9e\u9645\u200b\u7684\u200b\u4ea7\u4e1a\u200b\u5b9e\u8df5\u200b\u4e2d\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u6280\u672f\u200b\u7684\u200b\u843d\u5730\u200b\u548c\u200b\u8f6c\u5316\u200b\uff0c\u200b\u4fc3\u8fdb\u200b\u5404\u200b\u884c\u4e1a\u200b\u7684\u200b\u6570\u5b57\u5316\u200b\u8f6c\u578b\u200b\u548c\u200b\u667a\u80fd\u5316\u200b\u5347\u7ea7\u200b\u3002

"},{"location":"FAQ.html#q","title":"Q\uff1a\u200b\u4ec0\u4e48\u200b\u662f\u200b\u4ea7\u7ebf\u200b\uff1f\u200b\u4ec0\u4e48\u200b\u662f\u200b\u6a21\u5757\u200b\uff1f\u200b\u4e8c\u8005\u200b\u6709\u4f55\u200b\u5173\u7cfb\u200b\uff1f","text":"

A\uff1a\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\uff0c\u200b\u6a21\u5757\u200b\u88ab\u200b\u5b9a\u4e49\u200b\u4e3a\u200b\u5b9e\u73b0\u200b\u57fa\u672c\u529f\u80fd\u200b\u7684\u200b\u6700\u5c0f\u200b\u5355\u4f4d\u200b\uff0c\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u627f\u62c5\u200b\u7740\u200b\u7279\u5b9a\u200b\u7684\u200b\u4efb\u52a1\u200b\uff0c\u200b\u4f8b\u5982\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u57fa\u672c\u529f\u80fd\u200b\u3002\u200b\u5728\u200b\u8fd9\u4e2a\u200b\u6846\u67b6\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u7ebf\u200b\u5219\u200b\u662f\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u5757\u200b\u5171\u540c\u200b\u4f5c\u7528\u200b\u6240\u200b\u5b9e\u73b0\u200b\u7684\u200b\u5b9e\u9645\u200b\u529f\u80fd\u200b\uff0c\u200b\u8fd9\u79cd\u200b\u529f\u80fd\u200b\u7684\u200b\u6574\u5408\u200b\u901a\u5e38\u200b\u4f1a\u200b\u5f62\u6210\u200b\u66f4\u200b\u590d\u6742\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff08OCR\uff09\u200b\u7b49\u200b\u6280\u672f\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u6a21\u5757\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u4e4b\u95f4\u200b\u7684\u200b\u5173\u7cfb\u200b\u53ef\u4ee5\u200b\u7406\u89e3\u200b\u4e3a\u200b\u57fa\u7840\u200b\u4e0e\u200b\u5e94\u7528\u200b\u4e4b\u95f4\u200b\u7684\u200b\u5173\u7cfb\u200b\uff0c\u200b\u6a21\u5757\u200b\u4f5c\u4e3a\u200b\u6700\u5c0f\u200b\u5355\u4f4d\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6784\u5efa\u200b\u7684\u200b\u57fa\u7840\u200b\uff0c\u200b\u800c\u4ea7\u7ebf\u200b\u5219\u200b\u662f\u200b\u8fd9\u4e9b\u200b\u57fa\u7840\u200b\u6a21\u5757\u200b\u7ecf\u8fc7\u200b\u5408\u7406\u200b\u7ec4\u5408\u200b\u4e0e\u200b\u914d\u7f6e\u200b\u540e\u200b\u6240\u200b\u5c55\u73b0\u200b\u51fa\u6765\u200b\u7684\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u6548\u679c\u200b\u3002\u200b\u8fd9\u79cd\u200b\u8bbe\u8ba1\u200b\u65b9\u5f0f\u200b\u4f7f\u5f97\u200b\u7528\u6237\u200b\u80fd\u591f\u200b\u7075\u6d3b\u200b\u5730\u200b\u9009\u62e9\u200b\u548c\u200b\u7ec4\u5408\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5757\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u5b9e\u73b0\u200b\u4ed6\u4eec\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u529f\u80fd\u200b\uff0c\u200b\u4ece\u800c\u200b\u6781\u5927\u200b\u5730\u200b\u63d0\u5347\u200b\u4e86\u200b\u5f00\u53d1\u200b\u7684\u200b\u7075\u6d3b\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u5b98\u65b9\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u3001\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u7b49\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b\u3002

"},{"location":"FAQ.html#qwheel","title":"Q\uff1a\u200b\u600e\u6837\u200b\u9009\u62e9\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u548c\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff1f","text":"

A\uff1a\u200b\u82e5\u200b\u60a8\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3b\u8981\u200b\u96c6\u4e2d\u200b\u4e8e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\uff0c\u200b\u90a3\u4e48\u200b\u6211\u4eec\u200b\u5f3a\u70c8\u63a8\u8350\u200b\u60a8\u200b\u9009\u62e9\u200b\u4e00\u79cd\u200b\u66f4\u52a0\u200b\u4fbf\u6377\u200b\u548c\u200b\u8f7b\u91cf\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5373\u200b Wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002\u200b\u8fd9\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u65e8\u5728\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u4e00\u4e2a\u200b\u5feb\u901f\u200b\u3001\u200b\u7b80\u5355\u200b\u7684\u200b\u5b89\u88c5\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u7279\u522b\u200b\u9002\u5408\u200b\u4e8e\u200b\u9700\u8981\u200b\u8fc5\u901f\u200b\u90e8\u7f72\u200b\u548c\u200b\u96c6\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u573a\u666f\u200b\u3002\u200b\u4f7f\u7528\u200b Wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u53ef\u4ee5\u200b\u663e\u8457\u200b\u51cf\u5c11\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u590d\u6742\u6027\u200b\uff0c\u200b\u907f\u514d\u200b\u4e0d\u5fc5\u8981\u200b\u7684\u200b\u914d\u7f6e\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ece\u800c\u200b\u8ba9\u200b\u5f00\u53d1\u8005\u200b\u80fd\u591f\u200b\u5c06\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u65f6\u95f4\u200b\u548c\u200b\u7cbe\u529b\u200b\u96c6\u4e2d\u200b\u5728\u200b\u6a21\u578b\u200b\u7684\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u548c\u200b\u4f18\u5316\u200b\u4e0a\u200b\u3002\u200b\u65e0\u8bba\u200b\u60a8\u200b\u662f\u200b\u65b0\u624b\u200b\u8fd8\u662f\u200b\u6709\u200b\u7ecf\u9a8c\u200b\u7684\u200b\u5f00\u53d1\u8005\u200b\uff0c\u200b\u8fd9\u79cd\u200b\u8f7b\u91cf\u5316\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u90fd\u200b\u5c06\u200b\u4e3a\u200b\u60a8\u200b\u7684\u200b\u5de5\u4f5c\u200b\u6d41\u7a0b\u200b\u5e26\u6765\u200b\u6781\u5927\u200b\u7684\u200b\u4fbf\u5229\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\u65f6\u200b\uff0c\u200b\u9009\u62e9\u200b Wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u65e0\u7591\u200b\u4f1a\u200b\u8ba9\u200b\u60a8\u200b\u7684\u200b\u6574\u4e2a\u200b\u5f00\u53d1\u200b\u8fc7\u7a0b\u200b\u66f4\u52a0\u200b\u9ad8\u6548\u200b\u6d41\u7545\u200b\u3002

"},{"location":"FAQ.html#qpaddlex_1","title":"Q\uff1aPaddleX\u200b\u548c\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u533a\u522b\u200b\u662f\u200b\u4ec0\u4e48\u200b\uff1f","text":"

A\uff1a\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u662f\u200bPaddleX \u200b\u7684\u200b\u4e91\u7aef\u200b\u8f7d\u4f53\u200b\uff0c\u200b\u5e95\u5c42\u200b\u4ee3\u7801\u200b\u4e0e\u200bPaddleX\u200b\u4fdd\u6301\u4e00\u81f4\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u8ba4\u4e3a\u200b\u662f\u200b\u4e91\u7aef\u200bPaddleX\u3002\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8bbe\u8ba1\u200b\u7406\u5ff5\u200b\u662f\u200b\u8ba9\u200b\u7528\u6237\u200b\u80fd\u591f\u200b\u5728\u200b\u65e0\u9700\u200b\u6df1\u5165\u200b\u4e86\u89e3\u200b\u7f16\u7a0b\u200b\u548c\u200b\u7b97\u6cd5\u200b\u77e5\u8bc6\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5feb\u901f\u200b\u6784\u5efa\u200b\u548c\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\uff0c\u200b\u5728\u200b\u6b64\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u661f\u6cb3\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f88\u591a\u200b\u7279\u8272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5982\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u5c11\u91cf\u200b\u6837\u672c\u200b\u8bad\u7ec3\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u4f7f\u7528\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65b9\u6848\u200b\u89e3\u51b3\u200b\u590d\u6742\u200b\u65f6\u5e8f\u200b\u95ee\u9898\u200b\u7b49\u200b\u3002PaddleX \u200b\u662f\u200b\u4e00\u79cd\u200b\u672c\u5730\u200b\u5f00\u53d1\u5de5\u5177\u200b\uff0c\u200b\u5b83\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u529f\u80fd\u200b\uff0c\u200b\u652f\u6301\u200b\u8fdb\u884c\u200b\u66f4\u200b\u6df1\u5165\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u3002\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u5f00\u53d1\u8005\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6839\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u9700\u6c42\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u7684\u200b\u8c03\u6574\u200b\u548c\u200b\u6269\u5c55\u200b\uff0c\u200b\u521b\u5efa\u200b\u51fa\u200b\u66f4\u200b\u7b26\u5408\u200b\u7279\u5b9a\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u89e3\u51b3\u65b9\u6848\u200b\u3002\u200b\u4e14\u200bPaddleX\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u63a5\u53e3\u200b\uff0c\u200b\u652f\u6301\u200b\u7528\u6237\u200b\u81ea\u7531\u200b\u5730\u200b\u7ec4\u5408\u200b\u6a21\u578b\u200b\u4f7f\u7528\u200b\u3002

"},{"location":"FAQ.html#qpaddlex_2","title":"Q\uff1a\u200b\u5f53\u200b\u6211\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u9047\u5230\u200b\u95ee\u9898\u200b\uff0c\u200b\u5e94\u8be5\u200b\u600e\u6837\u200b\u53cd\u9988\u200b\u5462\u200b\uff1f","text":"

A\uff1a\u200b\u6b22\u8fce\u200b\u6765\u200b\u8ba8\u8bba\u533a\u200b\u4e0e\u200b\u6d77\u91cf\u200b\u5f00\u53d1\u8005\u200b\u4e00\u8d77\u200b\u4ea4\u6d41\u200b\uff01\u200b\u82e5\u200b\u60a8\u200b\u53d1\u73b0\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u9519\u8bef\u200b\u6216\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u4e5f\u200b\u6b22\u8fce\u200b\u5411\u200b\u6211\u4eec\u200b\u63d0\u51fa\u200bissue\uff0c\u200b\u503c\u73ed\u200b\u540c\u5b66\u200b\u5c06\u200b\u5c3d\u5feb\u200b\u4e3a\u200b\u60a8\u200b\u89e3\u7b54\u200b\u95ee\u9898\u200b\u3002

"},{"location":"quick_start.html","title":"\u5feb\u901f\u200b\u5f00\u59cb","text":""},{"location":"quick_start.html#_1","title":"\ud83d\udee0\ufe0f \u200b\u5b89\u88c5","text":"

\u2757\u200b\u5b89\u88c5\u200b PaddleX \u200b\u524d\u200b\u8bf7\u200b\u5148\u200b\u786e\u4fdd\u60a8\u200b\u6709\u200b\u57fa\u7840\u200b\u7684\u200b Python \u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\uff08\u200b\u6ce8\u200b\uff1a\u200b\u5f53\u524d\u200b\u652f\u6301\u200bPython 3.8 \uff5e Python 3.10\u200b\u4e0b\u200b\u8fd0\u884c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200bPython\u200b\u7248\u672c\u200b\u9002\u914d\u200b\u4e2d\u200b\uff09\u3002

  • \u200b\u5b89\u88c5\u200b PaddlePaddle

    # cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

    \u2757 \u200b\u66f4\u591a\u200b\u98de\u6868\u200b Wheel \u200b\u7248\u672c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u3002

  • \u200b\u5b89\u88c5\u200bPaddleX

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n

\u2757 \u200b\u66f4\u200b\u591a\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"quick_start.html#_2","title":"\ud83d\udcbb \u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u7edf\u4e00\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a

paddlex --pipeline [\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b] --input [\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b] --device [\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b]\n

\u200b\u53ea\u200b\u9700\u200b\u6307\u5b9a\u200b\u4e09\u4e2a\u200b\u53c2\u6570\u200b\uff1a

  • pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b
  • input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u6587\u4ef6\u200b\uff08\u200b\u5982\u200b\u56fe\u7247\u200b\uff09\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200b URL
  • device: \u200b\u4f7f\u7528\u200b\u7684\u200b GPU \u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b 0 \u200b\u5757\u200b GPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200b CPU\uff08cpu\uff09

\u200b\u4ee5\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0\n
\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

{\n'input_path': '/root/.paddlex/predict_input/general_ocr_002.png',\n'dt_polys': [array([[161,  27],\n       [353,  22],\n       [354,  69],\n       [162,  74]], dtype=int16), array([[426,  26],\n       [657,  21],\n       [657,  58],\n       [426,  62]], dtype=int16), array([[702,  18],\n       [822,  13],\n       [824,  57],\n       [704,  62]], dtype=int16), array([[341, 106],\n       [405, 106],\n       [405, 128],\n       [341, 128]], dtype=int16)\n       ...],\n'dt_scores': [0.758478200014338, 0.7021546472698513, 0.8536622648391111, 0.8619181462164781, 0.8321051217096188, 0.8868756173427551, 0.7982964727675609, 0.8289939036796322, 0.8289428877522524, 0.8587063317632897, 0.7786755892491615, 0.8502032769081344, 0.8703346500042997, 0.834490931790065, 0.908291103353393, 0.7614978661708064, 0.8325774055997542, 0.7843421347676149, 0.8680889482955594, 0.8788859304537682, 0.8963341277518075, 0.9364654810069546, 0.8092413027028257, 0.8503743089091863, 0.7920740420391101, 0.7592224394793805, 0.7920547400069311, 0.6641757962457888, 0.8650289477605955, 0.8079483304467047, 0.8532207681055275, 0.8913377034754717],\n'rec_text': ['\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', 'CLASS', '\u200b\u5e8f\u53f7\u200b SERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200b', '\u200b\u65e5\u671f\u200b DATE', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHW', '035', 'MU2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', \u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE10MINUTESBEFOREDEPARTURETIME'],\n'rec_score': [0.9985831379890442, 0.999696917533874512, 0.9985735416412354, 0.9842517971992493, 0.9383274912834167, 0.9943678975105286, 0.9419361352920532, 0.9221674799919128, 0.9555020928382874, 0.9870321154594421, 0.9664073586463928, 0.9988052248954773, 0.9979352355003357, 0.9985110759735107, 0.9943482875823975, 0.9991195797920227, 0.9936401844024658, 0.9974591135978699, 0.9743705987930298, 0.9980487823486328, 0.9874696135520935, 0.9900962710380554, 0.9952947497367859, 0.9950481653213501, 0.989926815032959, 0.9915552139282227, 0.9938777685165405, 0.997239887714386, 0.9963340759277344, 0.9936134815216064, 0.97223961353302]}\n

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4f7f\u7528\u200b\u547d\u4ee4\u200b

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b paddlex --pipeline image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b paddlex --pipeline instance_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png --device gpu:0 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b paddlex --pipeline semantic_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png --device gpu:0 \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b paddlex --pipeline small_object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/small_object_detection.jpg --device gpu:0 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b paddlex --pipeline anomaly_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_grid.png --device gpu:0 \u200b\u901a\u7528\u200bOCR paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b paddlex --pipeline table_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg --device gpu:0 \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b paddlex --pipeline layout_parsing --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/demo_paper.png --device gpu:0 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b paddlex --pipeline formula_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/demo_image/general_formula_recognition.png --device gpu:0 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b paddlex --pipeline seal_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/seal_text_det.png --device gpu:0 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b paddlex --pipeline ts_fc --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv --device gpu:0 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b paddlex --pipeline ts_ad --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv --device gpu:0 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b paddlex --pipeline ts_cls --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv --device gpu:0"},{"location":"quick_start.html#python","title":"\ud83d\udcdd Python \u200b\u811a\u672c\u200b\u4f7f\u7528","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u7edf\u4e00\u200b\u7684\u200b Python \u200b\u811a\u672c\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=[\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b])\noutput = pipeline.predict([\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u540d\u79f0\u200b])\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n
\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

  • create_pipeline() \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b
  • \u200b\u4f20\u5165\u200b\u56fe\u7247\u200b\u5e76\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b
  • \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b

\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u7684\u200b Python \u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5c06\u200b create_pipeline() \u200b\u65b9\u6cd5\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u200b\u8c03\u6574\u200b\u4e3a\u200b\u76f8\u5e94\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u540d\u79f0\u200b\u3002\u200b\u4e0b\u9762\u200b\u5217\u51fa\u200b\u4e86\u200b\u6bcf\u4e2a\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u7684\u200b\u53c2\u6570\u200b\u540d\u79f0\u200b\u53ca\u200b\u8be6\u7ec6\u200b\u7684\u200b\u4f7f\u7528\u200b\u89e3\u91ca\u200b\uff1a

\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u5bf9\u5e94\u200b\u53c2\u6570\u200b \u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 PP-ChatOCRv3-doc \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b image_classification \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b object_detection \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b instance_segmentation \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b semantic_segmentation \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b multi_label_image_classification \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b small_object_detection \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b anomaly_detection \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200bOCR OCR \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b table_recognition \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b layout_parsing \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b formula_recognition \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b seal_recognition \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b ts_fc \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b ts_ad \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b ts_cls \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e"},{"location":"data_annotations/cv_modules/image_classification.html","title":"PaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_classification.html#1-labelme","title":"1. Labelme \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/image_classification.html#11-labelme","title":"1.1 Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_classification.html#12-labelme","title":"1.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/image_classification.html#13-labelme","title":"1.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/image_classification.html#131","title":"1.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b pets\u3002
  • \u200b\u5728\u200b pets \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
  • \u200b\u5728\u200b pets \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b flags.txt\uff0c\u200b\u5e76\u200b\u5728\u200b flags.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u4ee5\u732b\u200b\u72d7\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b flags.txt \u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/image_classification.html#132-labelme","title":"1.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON \u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_classification.html#133","title":"1.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b Flags \u200b\u754c\u9762\u200b\u9009\u62e9\u200b\u7c7b\u522b\u200b\u3002

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

  • \u200b\u5b8c\u6210\u200b\u5168\u90e8\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200bconvert_to_imagenet.py\u200b\u811a\u672c\u200b\u5c06\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ImageNet-1k \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u751f\u6210\u200b train.txt\uff0cval.txt \u200b\u548c\u200blabel.txt\u3002

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path\u200b\u4e3a\u200b\u6807\u6ce8\u200b\u7684\u200b labelme \u200b\u683c\u5f0f\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

  • \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/image_classification.html#2","title":"2. \u200b\u6570\u636e\u683c\u5f0f","text":"
  • PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b ClsDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200btrain.txt\u3001val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 label.txt  # \u200b\u6807\u6ce8\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u7c7b\u522b\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a45 wallflower\n\u251c\u2500\u2500 train.txt  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200bid\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/image_06765.jpg 0\n\u2514\u2500\u2500 val.txt    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200bid\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/image_06767.jpg 10\n
* \u200b\u5982\u679c\u200b\u60a8\u200b\u5df2\u6709\u200b\u6570\u636e\u200b\u96c6\u4e14\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u4e3a\u200b\u5982\u4e0b\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f46\u662f\u200b\u6ca1\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u811a\u672c\u200b\u5c06\u200b\u5df2\u6709\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u751f\u6210\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002

dataset_dir          # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images           # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n   \u251c\u2500\u2500 train         # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n      \u251c\u2500\u2500 class0     # \u200b\u7c7b\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u5426\u5219\u200b\u751f\u6210\u200b\u7684\u200b\u7c7b\u522b\u200b\u6620\u5c04\u200b\u6587\u4ef6\u200blabel.txt\u200b\u65e0\u200b\u610f\u4e49\u200b\n         \u251c\u2500\u2500 xxx.jpg # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n         \u251c\u2500\u2500 xxx.jpg # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n         ...\n      \u251c\u2500\u2500 class1     # \u200b\u7c7b\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u5426\u5219\u200b\u751f\u6210\u200b\u7684\u200b\u7c7b\u522b\u200b\u6620\u5c04\u200b\u6587\u4ef6\u200blabel.txt\u200b\u65e0\u200b\u610f\u4e49\u200b\n      ...\n   \u251c\u2500\u2500 val           # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n
* \u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b\u662f\u200b PaddleX 2.x\u200b\u7248\u672c\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5728\u200b\u7ecf\u8fc7\u8bad\u7ec3\u200b\u96c6\u200b/\u200b\u9a8c\u8bc1\u200b\u96c6\u200b/\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u5207\u5206\u200b\u540e\u200b\uff0c\u200b\u624b\u52a8\u200b\u5c06\u200b train_list.txt\u3001val_list.txt\u3001test_list.txt\u200b\u4fee\u6539\u200b\u4e3a\u200btrain.txt\u3001val.txt\u3001test.txt\uff0c\u200b\u5e76\u4e14\u200b\u6309\u7167\u200b\u89c4\u5219\u200b\u4fee\u6539\u200b label.txt \u200b\u5373\u53ef\u200b\u3002

\u200b\u539f\u7248\u200blabel.txt\uff1a

classname1\nclassname2\nclassname3\n...\n
\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200blabel.txt\uff1a

0 classname1\n1 classname2\n2 classname3\n...\n
"},{"location":"data_annotations/cv_modules/image_feature.html","title":"PaddleX\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u8be5\u200b\u90e8\u5206\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_feature.html#1-labelme","title":"1. Labelme \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/image_feature.html#11-labelme","title":"1.1 Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_feature.html#12-labelme","title":"1.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/image_feature.html#13-labelme","title":"1.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/image_feature.html#131","title":"1.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b pets\u3002
  • \u200b\u5728\u200b pets \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
  • \u200b\u5728\u200b pets \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b flags.txt\uff0c\u200b\u5e76\u200b\u5728\u200b flags.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u4ee5\u732b\u200b\u72d7\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b flags.txt \u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/image_feature.html#132-labelme","title":"1.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON \u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/image_feature.html#133","title":"1.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b Flags \u200b\u754c\u9762\u200b\u9009\u62e9\u200b\u7c7b\u522b\u200b\u3002

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

  • \u200b\u5b8c\u6210\u200b\u5168\u90e8\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200bconvert_to_imagenet.py\u200b\u811a\u672c\u200b\u5c06\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ImageNet-1k \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u751f\u6210\u200b train.txt\uff0cval.txt \u200b\u548c\u200blabel.txt\u3002

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path\u200b\u4e3a\u200b\u6807\u6ce8\u200b\u7684\u200b labelme \u200b\u683c\u5f0f\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

  • \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/image_feature.html#134","title":"1.3.4 \u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u5728\u200b\u83b7\u5f97\u200b LabelMe \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bShiTuRecDataset\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableMel\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u5e76\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\u3002

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u89e3\u538b\u200b LabelMe \u200b\u683c\u5f0f\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n#\u200b\u5c06\u200b LabelMe \u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\npython main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"data_annotations/cv_modules/image_feature.html#3","title":"3. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b ShiTuRecDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200btrain.txt\u3001query.txt\u3001 gallery.txt \u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 gallery.txt   # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u5f85\u200b\u68c0\u7d22\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/WOMEN/Blouses_Shirts/id_00000001/02_2_side.jpg 3997\n\u2514\u2500\u2500 query.txt     # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u6570\u636e\u5e93\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/WOMEN/Blouses_Shirts/id_00000001/02_1_front.jpg 3997\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html","title":"PaddleX\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002\u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":"

\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u662f\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u6db5\u76d6\u200b\u4e94\u79cd\u200b\u4e0d\u540c\u200b\u7684\u200b\u6c34\u679c\u200b\uff0c\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u4e0d\u540c\u200b\u89d2\u5ea6\u200b\u7684\u200b\u62cd\u6444\u200b\u7167\u7247\u200b\u3002\u200b\u56fe\u7247\u200b\u793a\u4f8b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#2-labelme","title":"2. Labelme\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/instance_segmentation.html#21-labelme","title":"2.1 Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#22-labelme","title":"2.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/instance_segmentation.html#23-labelme","title":"2.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/instance_segmentation.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b fruit\u3002
  • \u200b\u5728\u200b fruit \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200b images \u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
  • \u200b\u5728\u200b fruit \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b label.txt\uff0c\u200b\u5e76\u200b\u5728\u200b label.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u4ee5\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b label.txt \u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/instance_segmentation.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5e26\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

cd path/to/fruit\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* labels \u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200bJSON\u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/instance_segmentation.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b Edit \u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9009\u5219\u200b Create Polygons\u3002 * \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u521b\u5efa\u200b\u591a\u8fb9\u5f62\u200b\u63cf\u7ed8\u200b\u5206\u5272\u200b\u533a\u57df\u200b\u8fb9\u754c\u200b\u3002

* \u200b\u518d\u6b21\u200b\u70b9\u51fb\u200b\u9009\u62e9\u200b\u5206\u5272\u200b\u533a\u57df\u200b\u7c7b\u522b\u200b\u3002

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

  • \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

* \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b\u3002

  • \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6807\u51c6\u200b labelme \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b\u3002 \u2003\u2003\u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200b train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt \u200b\u4e24\u4e2a\u200b\u6587\u672c\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b annotations \u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b\u5168\u90e8\u200b json \u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u6309\u200b\u4e00\u5b9a\u200b\u6bd4\u4f8b\u200b\u5206\u522b\u200b\u5199\u5165\u200b train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u5168\u90e8\u200b\u5199\u5165\u200b\u5230\u200b train_anno_list.txt \u200b\u540c\u65f6\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u7a7a\u200b\u7684\u200b val_anno_list.txt \u200b\u6587\u4ef6\u200b\uff0c\u200b\u5f85\u200b\u4e0a\u4f20\u200b\u96f6\u200b\u4ee3\u7801\u200b\u4f7f\u7528\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u529f\u80fd\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt \u200b\u7684\u200b\u5177\u4f53\u200b\u586b\u5199\u200b\u683c\u5f0f\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

  • \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

  • \u200b\u5c06\u200b fruit \u200b\u76ee\u5f55\u200b\u6253\u5305\u200b\u538b\u7f29\u200b\u4e3a\u200b .tar \u200b\u6216\u200b .zip \u200b\u683c\u5f0f\u200b\u538b\u7f29\u5305\u200b\u5373\u53ef\u200b\u5f97\u5230\u200b\u6c34\u679c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6807\u51c6\u200b labelme \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b\u3002
"},{"location":"data_annotations/cv_modules/instance_segmentation.html#3","title":"3. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b COCOInstSegDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir                  # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 annotations              # \u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n\u2502   \u251c\u2500\u2500 instance_train.json  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2502   \u2514\u2500\u2500 instance_val.json    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2514\u2500\u2500 images                   # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b COCO \u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

\u200b\u5f53\u200b\u5927\u5bb6\u200b\u4f7f\u7528\u200b\u7684\u200b\u662f\u200b PaddleX 2.x \u200b\u7248\u672c\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u65f6\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u5bf9\u5e94\u200b\u7684\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u90e8\u5206\u200b\uff0c\u200b\u5c06\u200b VOC \u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u3002\uff08\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6ce8\u660e\u200b\uff09

\u200b\u6ce8\u200b\uff1a

  • \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u8981\u6c42\u200b\u91c7\u7528\u200b COCO \u200b\u6570\u636e\u683c\u5f0f\u200b\u6807\u6ce8\u200b\u51fa\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6bcf\u5f20\u200b\u56fe\u50cf\u200b\u5404\u4e2a\u200b\u76ee\u6807\u200b\u533a\u57df\u200b\u7684\u200b\u50cf\u7d20\u200b\u8fb9\u754c\u200b\u548c\u200b\u7c7b\u522b\u200b\uff0c\u200b\u91c7\u7528\u200b [x1,y1,x2,y2,...,xn,yn] \u200b\u8868\u793a\u200b\u7269\u4f53\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u8fb9\u754c\u200b\uff08segmentation\uff09\u3002\u200b\u5176\u4e2d\u200b\uff0c(xn,yn) \u200b\u8868\u793a\u200b\u591a\u8fb9\u5f62\u200b\u5404\u4e2a\u200b\u89d2\u70b9\u200b\u5750\u6807\u200b\u3002\u200b\u6807\u6ce8\u200b\u4fe1\u606f\u200b\u5b58\u653e\u200b\u5230\u200b annotations \u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b json \u200b\u6587\u4ef6\u200b\u4e2d\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u96c6\u200b instance_train.json \u200b\u548c\u200b\u9a8c\u8bc1\u200b\u96c6\u200b instance_val.json \u200b\u5206\u5f00\u200b\u5b58\u653e\u200b\u3002
  • \u200b\u5982\u679c\u200b\u4f60\u200b\u6709\u200b\u4e00\u6279\u200b\u672a\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b LabelMe \u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u4f7f\u7528\u200b LabelMe \u200b\u6807\u6ce8\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0cPaddleX\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002
  • \u200b\u4e3a\u200b\u786e\u4fdd\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u987a\u5229\u5b8c\u6210\u200b\uff0c\u200b\u8bf7\u200b\u4e25\u683c\u200b\u9075\u5faa\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\uff1a LabelMe \u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002
"},{"location":"data_annotations/cv_modules/ml_classification.html","title":"PaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u8fd9\u90e8\u5206\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u548c\u200bPaddleLabel\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/ml_classification.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":"

\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u662f\u200b\u4eba\u5de5\u200b\u91c7\u96c6\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u6570\u636e\u200b\u79cd\u7c7b\u200b\u6db5\u76d6\u200b\u4e86\u200b\u5b89\u5168\u5e3d\u200b\u548c\u200b\u4eba\u200b\u7684\u200b\u5934\u90e8\u200b\u4e24\u79cd\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u4e0d\u540c\u200b\u89d2\u5ea6\u200b\u7684\u200b\u62cd\u6444\u200b\u7167\u7247\u200b\u3002 \u200b\u56fe\u7247\u200b\u793a\u4f8b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/ml_classification.html#2-labelme","title":"2. Labelme\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/ml_classification.html#21-labelme","title":"2.1 Labelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/ml_classification.html#22-labelme","title":"2.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/ml_classification.html#23-labelme","title":"2.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/ml_classification.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b hemlet\u3002
  • \u200b\u5728\u200b hemlet \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b hemlet \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b label.txt\uff0c\u200b\u5e76\u200b\u5728\u200b label.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200blabel.txt\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

"},{"location":"data_annotations/cv_modules/ml_classification.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b:

cd path/to/hemlet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON\u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/ml_classification.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b Labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b\"\u200b\u7f16\u8f91\u200b\"\u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b

* \u200b\u9009\u62e9\u200b\u521b\u5efa\u200b\u77e9\u5f62\u6846\u200b

* \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u62d6\u52a8\u200b\u5341\u5b57\u200b\u6846\u9009\u200b\u76ee\u6807\u200b\u533a\u57df\u200b

* \u200b\u518d\u6b21\u200b\u70b9\u51fb\u200b\u9009\u62e9\u200b\u76ee\u6807\u200b\u6846\u200b\u7c7b\u522b\u200b

* \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b Labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

* \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b:

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bLabelme\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u4e24\u4e2a\u200b\u6587\u672c\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b\u5168\u90e8\u200bjson\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u6309\u200b\u4e00\u5b9a\u200b\u6bd4\u4f8b\u200b\u5206\u522b\u200b\u5199\u5165\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u5168\u90e8\u200b\u5199\u5165\u200b\u5230\u200btrain_anno_list.txt\u200b\u540c\u65f6\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u7a7a\u200b\u7684\u200bval_anno_list.txt\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u529f\u80fd\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002train_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u7684\u200b\u5177\u4f53\u200b\u586b\u5199\u200b\u683c\u5f0f\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/ml_classification.html#234","title":"2.3.4 \u200b\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bcoco\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u548c\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"data_annotations/cv_modules/ml_classification.html#3-paddlelabel","title":"3. PaddleLabel \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/ml_classification.html#31-paddlelabel","title":"3.1 PaddleLabel\u200b\u7684\u200b\u5b89\u88c5\u200b\u548c\u200b\u542f\u52a8","text":"
  • \u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u5e72\u51c0\u200b\u7684\u200bconda\u200b\u73af\u5883\u200b\uff1a
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • \u200b\u540c\u6837\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200bpip\u200b\u4e00\u952e\u200b\u5b89\u88c5\u200b
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • \u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4f7f\u7528\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u4e4b\u4e00\u200b\u542f\u52a8\u200b \uff1a
    paddlelabel  # \u200b\u542f\u52a8\u200bpaddlelabel\npdlabel # \u200b\u7f29\u5199\u200b\uff0c\u200b\u548c\u200bpaddlelabel\u200b\u5b8c\u5168\u76f8\u540c\u200b\n
    PaddleLabel \u200b\u542f\u52a8\u200b\u540e\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u5728\u200b\u6d4f\u89c8\u5668\u200b\u4e2d\u200b\u6253\u5f00\u200b\u7f51\u9875\u200b\uff0c\u200b\u63a5\u4e0b\u6765\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b\u6d41\u7a0b\u200b\u4e86\u200b\u3002
"},{"location":"data_annotations/cv_modules/ml_classification.html#32-paddlelabel","title":"3.2 PaddleLabel\u200b\u7684\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":"
  • \u200b\u6253\u5f00\u200b\u81ea\u200b\u52a8\u5f39\u200b\u51fa\u200b\u7684\u200b\u7f51\u9875\u200b\uff0c\u200b\u70b9\u51fb\u200b\u6837\u4f8b\u200b\u9879\u76ee\u200b\uff0c\u200b\u70b9\u51fb\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b

* \u200b\u586b\u5199\u200b\u9879\u76ee\u540d\u79f0\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6ce8\u610f\u200b\u8def\u5f84\u200b\u662f\u200b\u672c\u5730\u200b\u673a\u5668\u200b\u4e0a\u200b\u7684\u200b \u200b\u7edd\u5bf9\u8def\u5f84\u200b\u3002\u200b\u5b8c\u6210\u200b\u540e\u200b\u70b9\u51fb\u200b\u521b\u5efa\u200b\u3002

* \u200b\u9996\u5148\u200b\u5b9a\u4e49\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ee5\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u63d0\u4f9b\u200b10\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u7c7b\u522b\u200b\u6709\u200b\u552f\u4e00\u200b\u5bf9\u5e94\u200b\u7684\u200bid\uff0c\u200b\u70b9\u51fb\u200b\u6dfb\u52a0\u200b\u7c7b\u522b\u200b\uff0c\u200b\u521b\u5efa\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u7c7b\u522b\u200b\u540d\u200b * \u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b * \u200b\u9996\u5148\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u6807\u7b7e\u200b * \u200b\u70b9\u51fb\u200b\u5de6\u4fa7\u200b\u7684\u200b\u77e9\u5f62\u200b\u9009\u62e9\u200b\u6309\u94ae\u200b * \u200b\u5728\u200b\u56fe\u7247\u200b\u4e2d\u200b\u6846\u9009\u200b\u9700\u8981\u200b\u533a\u57df\u200b\uff0c\u200b\u6ce8\u610f\u200b\u6309\u200b\u8bed\u4e49\u200b\u8fdb\u884c\u200b\u5206\u533a\u200b\uff0c\u200b\u5982\u200b\u51fa\u73b0\u200b\u591a\u680f\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u5206\u522b\u200b\u6807\u6ce8\u200b\u591a\u4e2a\u200b\u6846\u200b * \u200b\u5b8c\u6210\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u53f3\u4e0b\u89d2\u200b\u4f1a\u200b\u51fa\u73b0\u200b\u6807\u6ce8\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u68c0\u67e5\u200b\u6807\u6ce8\u200b\u662f\u5426\u200b\u6b63\u786e\u200b * \u200b\u5168\u90e8\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\u70b9\u51fb\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b

* \u200b\u5bfc\u51fa\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b * \u200b\u5728\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b\u4e2d\u200b\u6309\u200b\u9700\u6c42\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7136\u540e\u200b\u70b9\u51fb\u200b\u5bfc\u51fa\u200b\u6570\u636e\u200b\u96c6\u200b

* \u200b\u586b\u5199\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u548c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u4f9d\u7136\u200b\u662f\u200b\u4e00\u4e2a\u200b\u7edd\u5bf9\u8def\u5f84\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\u8bf7\u200b\u9009\u62e9\u200bcoco

* \u200b\u5bfc\u51fa\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e0b\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u83b7\u5f97\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5e76\u200b\u5c06\u200b\u4e09\u4e2a\u200bjson\u200b\u6587\u4ef6\u200b\u4ee5\u53ca\u200bimage\u200b\u76ee\u5f55\u200b\u8fdb\u884c\u200b\u91cd\u547d\u540d\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6e90\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b \u200b\u91cd\u547d\u540d\u200b\u540e\u200b\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b train.json instance_train.json val.json instance_train.json test.json instance_test.json image images
  • \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200bannotations\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bjson\u200b\u6587\u4ef6\u200b\u5168\u90e8\u200b\u79fb\u52a8\u200b\u5230\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5f97\u5230\u200b\u6700\u540e\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u76ee\u5f55\u200b\u5982\u4e0b\u200b\uff1a

* \u200b\u5c06\u200bhemlet\u200b\u76ee\u5f55\u200b\u6253\u5305\u200b\u538b\u7f29\u200b\u4e3a\u200b.tar\u200b\u6216\u200b.zip\u200b\u683c\u5f0f\u200b\u538b\u7f29\u5305\u200b\u5373\u53ef\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/cv_modules/ml_classification.html#4","title":"4. \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u5728\u200b\u83b7\u5f97\u200bCOCO\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bMLClsDataset\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableMe\u200b\u6216\u200bPaddleLabel\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u5e76\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\uff1a

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u89e3\u538b\u200bCOCO\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n#\u200b\u5c06\u200bCOCO\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200bMLClsDataset\u200b\u6570\u636e\u200b\u96c6\u200b\npython main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n
"},{"location":"data_annotations/cv_modules/ml_classification.html#5","title":"5. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b MLClsDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200btrain.txt\u3001val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 label.txt  # \u200b\u6807\u6ce8\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u7c7b\u522b\u200bid\u200b\u548c\u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a45 wallflower\n\u251c\u2500\u2500 train.txt  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/0041_2456602544.jpg   0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n\u2514\u2500\u2500 val.txt    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/0045_845243484.jpg    0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html","title":"PaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b","text":"

\u200b\u8fd9\u90e8\u5206\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200bLabelme\u200b\u548c\u200bPaddleLabel\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002 \u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":""},{"location":"data_annotations/cv_modules/object_detection.html#2-labelme","title":"2. Labelme \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/object_detection.html#21-labelme","title":"2.1 Labelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html#22-labelme","title":"2.2 Labelme \u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/object_detection.html#23-labelme","title":"2.3 Labelme \u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/object_detection.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b hemlet\u3002
  • \u200b\u5728\u200b hemlet \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u5fc5\u987b\u200b\u4e3a\u200bimages\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

* \u200b\u5728\u200b hemlet \u200b\u6587\u4ef6\u5939\u200b\u4e2d\u200b\u521b\u5efa\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b label.txt\uff0c\u200b\u5e76\u200b\u5728\u200b label.txt \u200b\u4e2d\u200b\u6309\u884c\u200b\u5199\u5165\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200blabel.txt\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

"},{"location":"data_annotations/cv_modules/object_detection.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200b Labelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b:

cd path/to/hemlet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags \u200b\u4e3a\u200b\u56fe\u50cf\u200b\u521b\u5efa\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f20\u5165\u200b\u6807\u7b7e\u200b\u8def\u5f84\u200b\u3002 * nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200b JSON\u200b\u6587\u4ef6\u200b\u3002 * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b\u3002 * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\u3002

"},{"location":"data_annotations/cv_modules/object_detection.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b Labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b\"\u200b\u7f16\u8f91\u200b\"\u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b

* \u200b\u9009\u62e9\u200b\u521b\u5efa\u200b\u77e9\u5f62\u6846\u200b

* \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u62d6\u52a8\u200b\u5341\u5b57\u200b\u6846\u9009\u200b\u76ee\u6807\u200b\u533a\u57df\u200b

* \u200b\u518d\u6b21\u200b\u70b9\u51fb\u200b\u9009\u62e9\u200b\u76ee\u6807\u200b\u6846\u200b\u7c7b\u522b\u200b

* \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b Labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200b output \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200b autosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09\u3002

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b Next Image \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u3002

* \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b:

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bLabelme\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u4e24\u4e2a\u200b\u6587\u672c\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u7684\u200b\u5168\u90e8\u200bjson\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u6309\u200b\u4e00\u5b9a\u200b\u6bd4\u4f8b\u200b\u5206\u522b\u200b\u5199\u5165\u200btrain_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u5168\u90e8\u200b\u5199\u5165\u200b\u5230\u200btrain_anno_list.txt\u200b\u540c\u65f6\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u7a7a\u200b\u7684\u200bval_anno_list.txt\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u529f\u80fd\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002train_anno_list.txt\u200b\u548c\u200bval_anno_list.txt\u200b\u7684\u200b\u5177\u4f53\u200b\u586b\u5199\u200b\u683c\u5f0f\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/object_detection.html#234","title":"2.3.4 \u200b\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u4f7f\u7528\u200bLabelme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bcoco\u200b\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableme\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u548c\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"data_annotations/cv_modules/object_detection.html#3-paddlelabel","title":"3. PaddleLabel \u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/object_detection.html#31-paddlelabel","title":"3.1 PaddleLabel\u200b\u7684\u200b\u5b89\u88c5\u200b\u548c\u200b\u542f\u52a8","text":"
  • \u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u5e72\u51c0\u200b\u7684\u200bconda\u200b\u73af\u5883\u200b\uff1a
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • \u200b\u540c\u6837\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200bpip\u200b\u4e00\u952e\u200b\u5b89\u88c5\u200b
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • \u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4f7f\u7528\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u4e4b\u4e00\u200b\u542f\u52a8\u200b \uff1a
    paddlelabel  # \u200b\u542f\u52a8\u200bpaddlelabel\npdlabel # \u200b\u7f29\u5199\u200b\uff0c\u200b\u548c\u200bpaddlelabel\u200b\u5b8c\u5168\u76f8\u540c\u200b\n
    PaddleLabel \u200b\u542f\u52a8\u200b\u540e\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u5728\u200b\u6d4f\u89c8\u5668\u200b\u4e2d\u200b\u6253\u5f00\u200b\u7f51\u9875\u200b\uff0c\u200b\u63a5\u4e0b\u6765\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b\u6d41\u7a0b\u200b\u4e86\u200b\u3002
"},{"location":"data_annotations/cv_modules/object_detection.html#32-paddlelabel","title":"3.2 PaddleLabel\u200b\u7684\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":"
  • \u200b\u6253\u5f00\u200b\u81ea\u200b\u52a8\u5f39\u200b\u51fa\u200b\u7684\u200b\u7f51\u9875\u200b\uff0c\u200b\u70b9\u51fb\u200b\u6837\u4f8b\u200b\u9879\u76ee\u200b\uff0c\u200b\u70b9\u51fb\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b

* \u200b\u586b\u5199\u200b\u9879\u76ee\u540d\u79f0\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6ce8\u610f\u200b\u8def\u5f84\u200b\u662f\u200b\u672c\u5730\u200b\u673a\u5668\u200b\u4e0a\u200b\u7684\u200b \u200b\u7edd\u5bf9\u8def\u5f84\u200b\u3002\u200b\u5b8c\u6210\u200b\u540e\u200b\u70b9\u51fb\u200b\u521b\u5efa\u200b\u3002

* \u200b\u9996\u5148\u200b\u5b9a\u4e49\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ee5\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u63d0\u4f9b\u200b10\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u7c7b\u522b\u200b\u6709\u200b\u552f\u4e00\u200b\u5bf9\u5e94\u200b\u7684\u200bid\uff0c\u200b\u70b9\u51fb\u200b\u6dfb\u52a0\u200b\u7c7b\u522b\u200b\uff0c\u200b\u521b\u5efa\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u7c7b\u522b\u200b\u540d\u200b * \u200b\u5f00\u59cb\u200b\u6807\u6ce8\u200b * \u200b\u9996\u5148\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u7684\u200b\u6807\u7b7e\u200b * \u200b\u70b9\u51fb\u200b\u5de6\u4fa7\u200b\u7684\u200b\u77e9\u5f62\u200b\u9009\u62e9\u200b\u6309\u94ae\u200b * \u200b\u5728\u200b\u56fe\u7247\u200b\u4e2d\u200b\u6846\u9009\u200b\u9700\u8981\u200b\u533a\u57df\u200b\uff0c\u200b\u6ce8\u610f\u200b\u6309\u200b\u8bed\u4e49\u200b\u8fdb\u884c\u200b\u5206\u533a\u200b\uff0c\u200b\u5982\u200b\u51fa\u73b0\u200b\u591a\u680f\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u5206\u522b\u200b\u6807\u6ce8\u200b\u591a\u4e2a\u200b\u6846\u200b * \u200b\u5b8c\u6210\u200b\u6807\u6ce8\u200b\u540e\u200b\uff0c\u200b\u53f3\u4e0b\u89d2\u200b\u4f1a\u200b\u51fa\u73b0\u200b\u6807\u6ce8\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u68c0\u67e5\u200b\u6807\u6ce8\u200b\u662f\u5426\u200b\u6b63\u786e\u200b * \u200b\u5168\u90e8\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\u70b9\u51fb\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b

* \u200b\u5bfc\u51fa\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b * \u200b\u5728\u200b\u9879\u76ee\u200b\u603b\u89c8\u200b\u4e2d\u200b\u6309\u200b\u9700\u6c42\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7136\u540e\u200b\u70b9\u51fb\u200b\u5bfc\u51fa\u200b\u6570\u636e\u200b\u96c6\u200b

* \u200b\u586b\u5199\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u548c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u8def\u5f84\u200b\u4f9d\u7136\u200b\u662f\u200b\u4e00\u4e2a\u200b\u7edd\u5bf9\u8def\u5f84\u200b\uff0c\u200b\u5bfc\u51fa\u200b\u683c\u5f0f\u200b\u8bf7\u200b\u9009\u62e9\u200bcoco

* \u200b\u5bfc\u51fa\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e0b\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u83b7\u5f97\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002

* \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b * \u200b\u5e76\u200b\u5c06\u200b\u4e09\u4e2a\u200bjson\u200b\u6587\u4ef6\u200b\u4ee5\u53ca\u200bimage\u200b\u76ee\u5f55\u200b\u8fdb\u884c\u200b\u91cd\u547d\u540d\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6e90\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b \u200b\u91cd\u547d\u540d\u200b\u540e\u200b\u6587\u4ef6\u200b(\u200b\u76ee\u5f55\u200b)\u200b\u540d\u200b train.json instance_train.json val.json instance_train.json test.json instance_test.json image images
  • \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\u521b\u5efa\u200bannotations\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bjson\u200b\u6587\u4ef6\u200b\u5168\u90e8\u200b\u79fb\u52a8\u200b\u5230\u200bannotations\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5f97\u5230\u200b\u6700\u540e\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u76ee\u5f55\u200b\u5982\u4e0b\u200b\uff1a

* \u200b\u5c06\u200bhemlet\u200b\u76ee\u5f55\u200b\u6253\u5305\u200b\u538b\u7f29\u200b\u4e3a\u200b.tar\u200b\u6216\u200b.zip\u200b\u683c\u5f0f\u200b\u538b\u7f29\u5305\u200b\u5373\u53ef\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200bcoco\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/cv_modules/object_detection.html#4","title":"4. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200b COCODetDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir                  # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 annotations              # \u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n\u2502   \u251c\u2500\u2500 instance_train.json  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2502   \u2514\u2500\u2500 instance_val.json    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u91c7\u7528\u200bCOCO\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\n\u2514\u2500\u2500 images                   # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\n

\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b COCO \u200b\u683c\u5f0f\u200b\u3002\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b \u3002

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html","title":"PaddleX\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u4ecb\u7ecd\u200b\u5982\u4f55\u200b\u4f7f\u7528\u200b Labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u5b8c\u6210\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u76f8\u5173\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u3002\u200b\u70b9\u51fb\u200b\u4e0a\u8ff0\u200b\u94fe\u63a5\u200b\uff0c\u200b\u53c2\u8003\u200b\u2fb8\u200b\u2eda\u200b\u2f42\u200b\u6863\u200b\u5373\u53ef\u200b\u5b89\u88c5\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u2f2f\u200b\u5177\u200b\u5e76\u200b\u67e5\u770b\u200b\u8be6\u7ec6\u200b\u4f7f\u200b\u2f64\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":"

\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u662f\u200b\u4eba\u5de5\u200b\u91c7\u96c6\u200b\u7684\u200b\u8857\u666f\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u6570\u636e\u200b\u79cd\u7c7b\u200b\u6db5\u76d6\u200b\u4e86\u200b\u8f66\u8f86\u200b\u548c\u200b\u9053\u8def\u200b\u4e24\u79cd\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u4e0d\u540c\u200b\u89d2\u5ea6\u200b\u7684\u200b\u62cd\u6444\u200b\u7167\u7247\u200b\u3002\u200b\u56fe\u7247\u200b\u793a\u4f8b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#2-labelme","title":"2. Labelme\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/cv_modules/semantic_segmentation.html#21-labelme","title":"2.1 Labelme\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

Labelme \u200b\u662f\u200b\u4e00\u4e2a\u200b python \u200b\u8bed\u8a00\u200b\u7f16\u5199\u200b\uff0c\u200b\u5e26\u6709\u200b\u56fe\u5f62\u754c\u9762\u200b\u7684\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u8f6f\u4ef6\u200b\u3002\u200b\u53ef\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7b49\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5728\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b JSON \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#22-labelme","title":"2.2 Labelme\u200b\u5b89\u88c5","text":"

\u200b\u4e3a\u200b\u907f\u514d\u200b\u73af\u5883\u200b\u51b2\u7a81\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5728\u200b conda \u200b\u73af\u5883\u200b\u4e0b\u200b\u5b89\u88c5\u200b\u3002

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#23-labelme","title":"2.3 Labelme\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":""},{"location":"data_annotations/cv_modules/semantic_segmentation.html#231","title":"2.3.1 \u200b\u51c6\u5907\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e","text":"
  • \u200b\u521b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b seg_dataset
  • \u200b\u5728\u200b seg_dataset \u200b\u4e2d\u200b\u521b\u5efa\u200b images \u200b\u76ee\u5f55\u200b\uff08\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u200b\u4fee\u6539\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u4fdd\u6301\u200b\u540e\u7eed\u200b\u547d\u4ee4\u200b\u7684\u200b\u56fe\u7247\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u6b63\u786e\u200b\uff09\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f85\u200b\u6807\u6ce8\u200b\u56fe\u7247\u200b\u5b58\u50a8\u200b\u5728\u200b images \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a
"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#232-labelme","title":"2.3.2 \u200b\u542f\u52a8\u200bLabelme","text":"

\u200b\u7ec8\u7aef\u200b\u8fdb\u5165\u200b\u5230\u200b\u5f85\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u542f\u52a8\u200b labelme \u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u3002

# Windows\ncd C:\\path\\to\\seg_dataset\n# Mac/Linux\ncd path/to/seg_dataset\n
labelme images --nodata --autosave --output annotations\n
* nodata \u200b\u505c\u6b62\u200b\u5c06\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u5b58\u50a8\u200b\u5230\u200bJSON\u200b\u6587\u4ef6\u200b * autosave \u200b\u81ea\u52a8\u200b\u5b58\u50a8\u200b * ouput \u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#233","title":"2.3.3 \u200b\u5f00\u59cb\u200b\u56fe\u7247\u200b\u6807\u6ce8","text":"
  • \u200b\u542f\u52a8\u200b labelme \u200b\u540e\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

* \u200b\u70b9\u51fb\u200b\"\u200b\u7f16\u8f91\u200b\"\u200b\u9009\u62e9\u200b\u6807\u6ce8\u200b\u7c7b\u578b\u200b

* \u200b\u9009\u62e9\u200b\u521b\u5efa\u200b\u591a\u8fb9\u5f62\u200b

* \u200b\u5728\u200b\u56fe\u7247\u200b\u4e0a\u200b\u7ed8\u5236\u200b\u76ee\u6807\u200b\u8f6e\u5ed3\u200b

  • \u200b\u51fa\u73b0\u200b\u5982\u4e0b\u200b\u5de6\u56fe\u200b\u6240\u793a\u200b\u8f6e\u5ed3\u7ebf\u200b\u95ed\u5408\u200b\u65f6\u200b\uff0c\u200b\u5f39\u200b\u51fa\u200b\u7c7b\u522b\u200b\u9009\u62e9\u200b\u6846\u200b\uff0c\u200b\u53ef\u200b\u8f93\u5165\u200b\u6216\u200b\u9009\u62e9\u200b\u76ee\u6807\u200b\u7c7b\u522b\u200b

\u200b\u901a\u5e38\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u524d\u666f\u200b\u76ee\u6807\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u6807\u6ce8\u200b\u7c7b\u522b\u200b\u5373\u53ef\u200b\uff0c\u200b\u5176\u4ed6\u200b\u50cf\u7d20\u200b\u9ed8\u8ba4\u200b\u4f5c\u4e3a\u200b\u80cc\u666f\u200b\u3002\u200b\u5982\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u6807\u6ce8\u200b\u80cc\u666f\u200b\u533a\u57df\u200b\uff0c\u200b\u7c7b\u522b\u200b\u5fc5\u987b\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b background\uff0c\u200b\u5426\u5219\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u6570\u636e\u200b\u96c6\u4f1a\u200b\u51fa\u73b0\u200b\u9519\u8bef\u200b\u3002 \u200b\u5bf9\u4e8e\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u566a\u58f0\u200b\u90e8\u5206\u200b\u6216\u200b\u4e0d\u200b\u53c2\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u90e8\u5206\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b ignore \u200b\u7c7b\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u65f6\u4f1a\u200b\u81ea\u52a8\u200b\u8df3\u8fc7\u200b\u5bf9\u5e94\u200b\u90e8\u5206\u200b\u3002 \u200b\u9488\u5bf9\u200b\u5e26\u6709\u200b\u7a7a\u6d1e\u200b\u7684\u200b\u76ee\u6807\u200b\uff0c\u200b\u5728\u200b\u6807\u6ce8\u200b\u5b8c\u200b\u76ee\u6807\u200b\u5916\u200b\u8f6e\u5ed3\u200b\u540e\u200b\uff0c\u200b\u518d\u200b\u6cbf\u200b\u7a7a\u6d1e\u200b\u8fb9\u7f18\u200b\u753b\u200b\u591a\u8fb9\u5f62\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u7a7a\u6d1e\u200b\u6307\u5b9a\u200b\u4e3a\u200b\u7279\u5b9a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5982\u679c\u200b\u7a7a\u6d1e\u200b\u662f\u200b\u80cc\u666f\u200b\u5219\u200b\u6307\u5b9a\u200b\u4e3a\u200b background\uff0c\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

  • \u200b\u6807\u6ce8\u200b\u597d\u540e\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u3002\uff08\u200b\u82e5\u200b\u5728\u200b\u542f\u52a8\u200b labelme \u200b\u65f6\u200b\u672a\u6307\u5b9a\u200boutput \u200b\u5b57\u200b\u6bb5\u200b\uff0c\u200b\u4f1a\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u5b58\u50a8\u200b\u65f6\u200b\u63d0\u793a\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u8def\u5f84\u200b\uff0c\u200b\u82e5\u200b\u6307\u5b9a\u200bautosave \u200b\u5b57\u200b\u6bb5\u200b\u4f7f\u7528\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u70b9\u51fb\u200b\u5b58\u50a8\u200b\u6309\u94ae\u200b\uff09

* \u200b\u7136\u540e\u200b\u70b9\u51fb\u200b \"Next Image\" \u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b

  • \u200b\u6700\u7ec8\u200b\u6807\u6ce8\u200b\u597d\u200b\u7684\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u5982\u56fe\u6240\u793a\u200b

  • \u200b\u8c03\u6574\u200b\u76ee\u5f55\u200b\u5f97\u5230\u200b\u5b89\u5168\u5e3d\u200b\u68c0\u6d4b\u200b\u6807\u51c6\u200blabelme\u200b\u683c\u5f0f\u200b\u6570\u636e\u200b\u96c6\u200b \u2003\u2003a. \u200b\u5728\u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b seg_datset \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u6267\u884c\u200b\u76ee\u5f55\u200b\u6574\u7406\u200b\u811a\u672c\u200b\u3002\u200b\u6267\u884c\u200b\u811a\u672c\u200b\u540e\u200b\u7684\u200b train_anno_list.txt \u200b\u548c\u200b val_anno_list.txt \u200b\u4e2d\u200b\u5177\u4f53\u5185\u5bb9\u200b\u5982\u56fe\u6240\u793a\u200b\uff1a

python format_seg_labelme_dataset.py\n
b. \u200b\u7ecf\u8fc7\u200b\u6574\u7406\u200b\u5f97\u5230\u200b\u7684\u200b\u6700\u7ec8\u200b\u76ee\u5f55\u200b\u7ed3\u6784\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#234","title":"2.3.4 \u200b\u683c\u5f0f\u200b\u8f6c\u6362","text":"

\u200b\u4f7f\u7528\u200bLabelMe\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bSeg \u200b\u6570\u636e\u683c\u5f0f\u200b\u3002\u200b\u4e0b\u9762\u200b\u7ed9\u51fa\u200b\u4e86\u200b\u6309\u7167\u200b\u4e0a\u8ff0\u200b\u6559\u7a0b\u200b\u4f7f\u7528\u200bLableMe\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u548c\u200b\u8fdb\u884c\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u4ee3\u7801\u200b\u793a\u4f8b\u200b\u3002

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n\npython main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"data_annotations/cv_modules/semantic_segmentation.html#_1","title":"\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200bSegDataset\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir         # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 annotations     # \u200b\u5b58\u653e\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u6ce8\u610f\u200b\u4e0e\u200b\u6807\u8bc6\u200b\u6587\u4ef6\u200b\u7684\u200b\u5185\u5bb9\u200b\u76f8\u5bf9\u200b\u5e94\u200b\n\u251c\u2500\u2500 images          # \u200b\u5b58\u653e\u200b\u539f\u59cb\u200b\u56fe\u50cf\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u6ce8\u610f\u200b\u4e0e\u200b\u6807\u8bc6\u200b\u6587\u4ef6\u200b\u7684\u200b\u5185\u5bb9\u200b\u76f8\u5bf9\u200b\u5e94\u200b\n\u251c\u2500\u2500 train.txt       # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u662f\u200b\u539f\u59cb\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/P0005.jpg annotations/P0005.png\n\u2514\u2500\u2500 val.txt         # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u662f\u200b\u539f\u59cb\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/N0139.jpg annotations/N0139.png\n
\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u662f\u200b\u5355\u901a\u9053\u200b\u7070\u5ea6\u200b\u56fe\u200b\u6216\u8005\u200b\u5355\u901a\u9053\u200b\u4f2a\u200b\u5f69\u8272\u200b\u56fe\u200b\uff0c\u200b\u5efa\u8bae\u200b\u4f7f\u7528\u200bPNG\u200b\u683c\u5f0f\u200b\u4fdd\u5b58\u200b\u3002\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u79cd\u200b\u50cf\u7d20\u200b\u503c\u200b\u4ee3\u8868\u200b\u4e00\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u7c7b\u522b\u200b\u5fc5\u987b\u200b\u4ece\u200b0\u200b\u5f00\u59cb\u200b\u4f9d\u6b21\u200b\u9012\u589e\u200b\uff0c\u200b\u4f8b\u5982\u200b0\u30011\u30012\u30013\u200b\u8868\u793a\u200b4\u200b\u79cd\u7c7b\u200b\u522b\u200b\u3002\u200b\u6807\u6ce8\u200b\u56fe\u50cf\u200b\u7684\u200b\u50cf\u7d20\u200b\u5b58\u50a8\u200b\u662f\u200b8bit\uff0c\u200b\u6240\u4ee5\u200b\u6807\u6ce8\u200b\u7c7b\u522b\u200b\u6700\u200b\u591a\u200b\u652f\u6301\u200b256\u200b\u7c7b\u200b\u3002

\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/ocr_modules/table_recognition.html","title":"PaddleX\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":""},{"location":"data_annotations/ocr_modules/table_recognition.html#1","title":"1. \u200b\u6570\u636e\u200b\u6807\u6ce8","text":"

\u200b\u8fdb\u884c\u200b\u8868\u683c\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u65f6\u200b\uff0c\u200b\u4f7f\u7528\u200bPPOCRLabelv2\u200b\u5de5\u5177\u200b\u3002\u200b\u8be6\u7ec6\u200b\u6b65\u9aa4\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u3010\u200b\u89c6\u9891\u200b\u6f14\u793a\u200b\u3011

\u200b\u8868\u683c\u200b\u6807\u6ce8\u200b\u9488\u5bf9\u200b\u8868\u683c\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u63d0\u53d6\u200b\uff0c\u200b\u5c06\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u8868\u683c\u200b\u8f6c\u6362\u200b\u4e3a\u200bExcel\u200b\u683c\u5f0f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u6807\u6ce8\u200b\u65f6\u200b\u9700\u8981\u200b\u914d\u5408\u200b\u5916\u90e8\u200b\u8f6f\u4ef6\u200b\u6253\u5f00\u200bExcel\u200b\u540c\u65f6\u200b\u5b8c\u6210\u200b\u3002\u200b\u5728\u200bPPOCRLabel\u200b\u8f6f\u4ef6\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u8868\u683c\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u6807\u6ce8\u200b\uff08\u200b\u6587\u5b57\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\uff09\u3001\u200b\u5728\u200bExcel\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u4fe1\u606f\u200b\u6807\u6ce8\u200b\uff0c\u200b\u63a8\u8350\u200b\u7684\u200b\u6b65\u9aa4\u200b\u4e3a\u200b\uff1a

  1. \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\uff1a\u200b\u6253\u5f00\u200b\u8868\u683c\u200b\u56fe\u7247\u200b\u540e\u200b\uff0c\u200b\u70b9\u51fb\u200b\u8f6f\u4ef6\u200b\u53f3\u4e0a\u89d2\u200b\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u200b\u6309\u94ae\u200b\uff0c\u200b\u8f6f\u4ef6\u200b\u8c03\u7528\u200bPP-Structure\u200b\u4e2d\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u81ea\u52a8\u200b\u4e3a\u200b\u8868\u683c\u200b\u6253\u200b\u6807\u7b7e\u200b\uff0c\u200b\u540c\u65f6\u200b\u5f39\u200b\u51fa\u200bExcel
  2. \u200b\u66f4\u6539\u200b\u6807\u6ce8\u200b\u7ed3\u679c\u200b\uff1a\u200b\u4ee5\u200b\u8868\u683c\u200b\u4e2d\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u589e\u52a0\u200b\u6807\u6ce8\u200b\u6846\u200b\uff08\u200b\u5373\u200b\u4e00\u4e2a\u200b\u5355\u5143\u683c\u200b\u5185\u200b\u7684\u200b\u6587\u5b57\u200b\u90fd\u200b\u6807\u8bb0\u200b\u4e3a\u200b\u4e00\u4e2a\u200b\u6846\u200b\uff09\u3002\u200b\u6807\u6ce8\u200b\u6846\u4e0a\u200b\u9f20\u6807\u200b\u53f3\u952e\u200b\u540e\u200b\u70b9\u51fb\u200b\u200b\u5355\u5143\u683c\u200b\u91cd\u200b\u8bc6\u522b\u200b\u200b\u53ef\u200b\u5229\u7528\u200b\u6a21\u578b\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u5355\u5143\u683c\u200b\u5185\u200b\u7684\u200b\u6587\u5b57\u200b\u3002
  3. \u200b\u8c03\u6574\u200b\u5355\u5143\u683c\u200b\u987a\u5e8f\u200b\uff1a\u200b\u70b9\u51fb\u200b\u8f6f\u4ef6\u200b\u200b\u89c6\u56fe\u200b-\u200b\u663e\u793a\u200b\u6846\u200b\u7f16\u53f7\u200b\u200b\u6253\u5f00\u200b\u6807\u6ce8\u200b\u6846\u200b\u5e8f\u53f7\u200b\uff0c\u200b\u5728\u200b\u8f6f\u4ef6\u200b\u754c\u9762\u200b\u53f3\u4fa7\u200b\u62d6\u52a8\u200b\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u200b\u4e00\u680f\u200b\u4e0b\u200b\u7684\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\uff0c\u200b\u4f7f\u5f97\u200b\u6807\u6ce8\u200b\u6846\u200b\u7f16\u53f7\u200b\u6309\u7167\u200b\u4ece\u5de6\u5230\u53f3\u200b\uff0c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\u7684\u200b\u987a\u5e8f\u6392\u5217\u200b\uff0c\u200b\u6309\u884c\u200b\u4f9d\u6b21\u200b\u6807\u6ce8\u200b\u3002
  4. \u200b\u6807\u6ce8\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\uff1a\u200b\u5728\u200b\u5916\u90e8\u200bExcel\u200b\u8f6f\u4ef6\u200b\u4e2d\u200b\uff0c\u200b\u5c06\u200b\u5b58\u5728\u200b\u6587\u5b57\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u6807\u8bb0\u200b\u4e3a\u200b\u4efb\u610f\u200b\u6807\u8bc6\u7b26\u200b\uff08\u200b\u5982\u200b1\uff09\uff0c\u200b\u4fdd\u8bc1\u200bExcel\u200b\u4e2d\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u5408\u5e76\u200b\u60c5\u51b5\u200b\u4e0e\u200b\u539f\u56fe\u200b\u76f8\u540c\u200b\u5373\u53ef\u200b\uff08\u200b\u5373\u200b\u4e0d\u200b\u9700\u8981\u200bExcel\u200b\u4e2d\u200b\u7684\u200b\u5355\u5143\u683c\u200b\u6587\u5b57\u200b\u4e0e\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u5b8c\u5168\u76f8\u540c\u200b\uff09
  5. \u200b\u5bfc\u51fa\u200bJSON\u200b\u683c\u5f0f\u200b\uff1a\u200b\u5173\u95ed\u200b\u6240\u6709\u200b\u8868\u683c\u200b\u56fe\u50cf\u200b\u5bf9\u5e94\u200b\u7684\u200bExcel\uff0c\u200b\u70b9\u51fb\u200b\u200b\u6587\u4ef6\u200b-\u200b\u5bfc\u51fa\u200b\u8868\u683c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u751f\u6210\u200bgt.txt\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u3002
"},{"location":"data_annotations/ocr_modules/table_recognition.html#2","title":"2. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX \u200b\u9488\u5bf9\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7ec4\u7ec7\u200b\u7ed3\u6784\u200b\u548c\u200b\u6807\u6ce8\u200b\u683c\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

dataset_dir    # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images     # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u548c\u200btrain.txt val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 train.txt  # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a{\"filename\": \"images/border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"<tr>\", \"<td\", \" colspan=\\\"3\\\"\", \">\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\"]}, \"cells\": [{\"tokens\": [\"\u3001\", \"\u200b\u81ea\u200b\", \"\u200b\u6211\u200b\"], \"bbox\": [[[5, 2], [231, 2], [231, 35], [5, 35]]]}, {\"tokens\": [\"9\"], \"bbox\": [[[168, 68], [231, 68], [231, 98], [168, 98]]]}]}, \"gt\": \"<html><body><table><tr><td colspan=\\\"3\\\">\u3001\u200b\u81ea\u6211\u200b</td></tr><tr><td>Aghas</td><td>\u200b\u5931\u5434\u200b</td><td>\u200b\u6708\u200b\uff0c</td></tr><tr><td>lonwyCau</td><td></td><td>9</td></tr></table></body></html>\"}\n\u2514\u2500\u2500 val.txt    # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a{\"filename\": \"images/no_border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"<tr>\", \"<td\", \" colspan=\\\"2\\\"\", \">\", \"</td>\", \"<td\", \" rowspan=\\\"2\\\"\", \">\", \"</td>\", \"<td\", \" rowspan=\\\"2\\\"\", \">\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\", \"<tr>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"<td>\", \"</td>\", \"</tr>\"]}, \"cells\": [{\"tokens\": [\"a\", \"d\", \"e\", \"s\"], \"bbox\": [[[0, 4], [284, 4], [284, 34], [0, 34]]]}, {\"tokens\": [\"$\", \"7\", \"5\", \"1\", \"8\", \".\", \"8\", \"3\"], \"bbox\": [[[442, 67], [616, 67], [616, 100], [442, 100]]]}]}, \"gt\": \"<html><body><table><tr><td colspan=\\\"2\\\">ades</td><td rowspan=\\\"2\\\">\u200b\u7814\u7a76\u200b\u4e2d\u5fc3\u200b\u4e3b\u4efb\u200b\u6ed5\u5efa\u200b</td><td rowspan=\\\"2\\\">\u200b\u54c1\u200b\u3001\u200b\u5bb6\u5c45\u7528\u54c1\u200b\u4f4d\u5c45\u200b\u5546\u200b</td></tr><tr><td>naut</td><td>\u200b\u5219\u200b\u662f\u200b\u521b\u529e\u200b\u601d\u200b</td></tr><tr><td>\u200b\u5404\u65b9\u200b\u610f\u89c1\u5efa\u8bae\u200b\uff0c\u200b\u786e\u4fdd\u200b</td><td>9.66</td><td>\u200b\u9053\u200b\u5f00\u4e1a\u200b\uff0c\u200b\u8d1f\u8d23\u200b</td><td>$7518.83</td></tr></table></body></html>\"}\n
\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u91c7\u7528\u200b PubTabNet \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u6bcf\u884c\u200b\u5185\u5bb9\u200b\u90fd\u200b\u662f\u200b\u4e00\u4e2a\u200bpython\u200b\u5b57\u5178\u200b\u3002

\u200b\u8bf7\u200b\u5927\u5bb6\u200b\u53c2\u8003\u200b\u4e0a\u8ff0\u200b\u89c4\u8303\u200b\u51c6\u5907\u200b\u6570\u636e\u200b\uff0c\u200b\u6b64\u5916\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b

"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html","title":"PaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":""},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#1","title":"1. \u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u793a\u4f8b","text":""},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#2-ppocrlabel","title":"2. PPOCRLabel\u200b\u6807\u6ce8","text":""},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#21-ppocrlabel","title":"2.1 PPOCRLabel\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\u4ecb\u7ecd","text":"

PPOCRLabel \u200b\u662f\u200b\u4e00\u6b3e\u200b\u9002\u7528\u200b\u4e8e\u200bOCR\u200b\u9886\u57df\u200b\u7684\u200b\u534a\u81ea\u52a8\u5316\u200b\u56fe\u5f62\u200b\u6807\u6ce8\u200b\u5de5\u5177\u200b\uff0c\u200b\u5185\u7f6e\u200bPP-OCR\u200b\u6a21\u578b\u200b\u5bf9\u200b\u6570\u636e\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u548c\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u3002\u200b\u4f7f\u7528\u200bPython3\u200b\u548c\u200bPyQT5\u200b\u7f16\u5199\u200b\uff0c\u200b\u652f\u6301\u200b\u77e9\u5f62\u6846\u200b\u6807\u6ce8\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u6ce8\u200b\u3001\u200b\u4e0d\u89c4\u5219\u200b\u6587\u672c\u200b\u6807\u6ce8\u200b\u3001\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u6807\u6ce8\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5728\u200bOCR\u200b\u7684\u200b\u6807\u6ce8\u200b\u4efb\u52a1\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u5b58\u50a8\u200b\u4e3a\u200b txt \u200b\u6587\u4ef6\u200b\u3002

"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#22-ppocrlabel","title":"2.2 \u200b\u5b89\u88c5\u200b\u4e0e\u200b\u8fd0\u884c\u200bPPOCRLabel","text":"

PPOCRLabel\u200b\u53ef\u200b\u901a\u8fc7\u200bwhl\u200b\u5305\u4e0e\u200bPython\u200b\u811a\u672c\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\u542f\u52a8\u200b\uff0cwhl\u200b\u5305\u200b\u5f62\u5f0f\u200b\u542f\u52a8\u200b\u66f4\u52a0\u200b\u65b9\u4fbf\u200b\uff0c\u200b\u8fd9\u91cc\u200b\u53ea\u200b\u63d0\u4f9b\u200bwhl\u200b\u5305\u200b\u8bf4\u660e\u200b\uff1a

  • windows \u200b\u5b89\u88c5\u200b\uff1a
    pip install PPOCRLabel  # \u200b\u5b89\u88c5\u200b\n\n# \u200b\u9009\u62e9\u200b\u6807\u7b7e\u200b\u6a21\u5f0f\u200b\u6765\u200b\u542f\u52a8\u200b\nPPOCRLabel --lang ch  # \u200b\u542f\u52a8\u200b\u3010\u200b\u666e\u901a\u200b\u6a21\u5f0f\u200b\u3011\uff0c\u200b\u7528\u4e8e\u200b\u6253\u200b\u3010\u200b\u68c0\u6d4b\u200b+\u200b\u8bc6\u522b\u200b\u3011\u200b\u573a\u666f\u200b\u7684\u200b\u6807\u7b7e\u200b\n

[!NOTE] \u200b\u901a\u8fc7\u200bwhl\u200b\u5305\u200b\u5b89\u88c5\u200bPPOCRLabel\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4e0b\u8f7d\u200b paddleocr whl\u200b\u5305\u200b\uff0c\u200b\u5176\u4e2d\u200bshapely\u200b\u4f9d\u8d56\u200b\u53ef\u80fd\u200b\u4f1a\u200b\u51fa\u73b0\u200b [winRrror 126] \u200b\u627e\u200b\u4e0d\u5230\u200b\u6307\u5b9a\u200b\u6a21\u5757\u200b\u7684\u200b\u95ee\u9898\u200b\u3002 \u200b\u7684\u200b\u9519\u8bef\u200b\uff0c\u200b\u5efa\u8bae\u200b\u4e0b\u8f7d\u200bshapely\u200b\u5b89\u88c5\u5305\u200b\u5b8c\u6210\u200b\u5b89\u88c5\u200b\u3002

  • MacOS
    pip3 install PPOCRLabel\npip3 install opencv-contrib-python-headless==4.2.0.32 # \u200b\u5982\u679c\u200b\u4e0b\u8f7d\u200b\u8fc7\u6162\u200b\u8bf7\u200b\u6dfb\u52a0\u200b\"-i https://mirror.baidu.com/pypi/simple\"\n\n# \u200b\u9009\u62e9\u200b\u6807\u7b7e\u200b\u6a21\u5f0f\u200b\u6765\u200b\u542f\u52a8\u200b\nPPOCRLabel --lang ch  # \u200b\u542f\u52a8\u200b\u3010\u200b\u666e\u901a\u200b\u6a21\u5f0f\u200b\u3011\uff0c\u200b\u7528\u4e8e\u200b\u6253\u200b\u3010\u200b\u68c0\u6d4b\u200b+\u200b\u8bc6\u522b\u200b\u3011\u200b\u573a\u666f\u200b\u7684\u200b\u6807\u7b7e\u200b\n
"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#23","title":"2.3 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7684\u200b\u6807\u6ce8\u200b\u8fc7\u7a0b","text":"
  1. \u200b\u5b89\u88c5\u200b\u4e0e\u200b\u8fd0\u884c\u200b\uff1a\u200b\u4f7f\u7528\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u5b89\u88c5\u200b\u4e0e\u200b\u8fd0\u884c\u200b\u7a0b\u5e8f\u200b\u3002
  2. \u200b\u6253\u5f00\u200b\u6587\u4ef6\u5939\u200b\uff1a\u200b\u5728\u200b\u83dc\u5355\u680f\u200b\u70b9\u51fb\u200b \u201c\u200b\u6587\u4ef6\u200b\u201d - \"\u200b\u6253\u5f00\u200b\u76ee\u5f55\u200b\" \u200b\u9009\u62e9\u200b\u5f85\u200b\u6807\u8bb0\u200b\u56fe\u7247\u200b\u7684\u200b\u6587\u4ef6\u5939\u200b.

3. \u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201d\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u201c\uff0c\u200b\u4f7f\u7528\u200bPP-OCR\u200b\u8d85\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5bf9\u200b\u56fe\u7247\u200b\u6587\u4ef6\u540d\u200b\u524d\u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u4e3a\u200b \u201cX\u201d \u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u3002

4. \u200b\u624b\u52a8\u200b\u6807\u6ce8\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201c\u200b\u77e9\u5f62\u200b\u6807\u6ce8\u200b\u201d\uff08\u200b\u63a8\u8350\u200b\u76f4\u63a5\u200b\u5728\u200b\u82f1\u6587\u200b\u6a21\u5f0f\u200b\u4e0b\u200b\u70b9\u51fb\u200b\u952e\u76d8\u200b\u4e2d\u200b\u7684\u200b \u201cW\u201d)\uff0c\u200b\u7528\u6237\u200b\u53ef\u200b\u5bf9\u200b\u5f53\u524d\u200b\u56fe\u7247\u200b\u4e2d\u200b\u6a21\u578b\u200b\u672a\u200b\u68c0\u51fa\u200b\u7684\u200b\u90e8\u5206\u200b\u8fdb\u884c\u200b\u624b\u52a8\u200b\u7ed8\u5236\u200b\u6807\u8bb0\u200b\u6846\u200b\u3002\u200b\u70b9\u51fb\u200b\u952e\u76d8\u200bQ\uff0c\u200b\u5219\u200b\u4f7f\u7528\u200b\u56db\u70b9\u200b\u6807\u6ce8\u200b\u6a21\u5f0f\u200b\uff08\u200b\u6216\u200b\u70b9\u51fb\u200b\u201c\u200b\u7f16\u8f91\u200b\u201d - \u201c\u200b\u56db\u70b9\u200b\u6807\u6ce8\u200b\u201d\uff09\uff0c\u200b\u7528\u6237\u200b\u4f9d\u6b21\u200b\u70b9\u51fb\u200b4\u200b\u4e2a\u70b9\u200b\u540e\u200b\uff0c\u200b\u53cc\u51fb\u200b\u5de6\u952e\u200b\u8868\u793a\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u3002 5. \u200b\u6807\u8bb0\u200b\u6846\u200b\u7ed8\u5236\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u7528\u6237\u200b\u70b9\u51fb\u200b \u201c\u200b\u786e\u8ba4\u200b\u201d\uff0c\u200b\u68c0\u6d4b\u200b\u6846\u4f1a\u200b\u5148\u200b\u88ab\u200b\u9884\u200b\u5206\u914d\u200b\u4e00\u4e2a\u200b \u201c\u200b\u5f85\u200b\u8bc6\u522b\u200b\u201d \u200b\u6807\u7b7e\u200b\u3002 6. \u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\uff1a\u200b\u5c06\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6240\u6709\u200b\u68c0\u6d4b\u200b\u753b\u200b\u7ed8\u5236\u200b/\u200b\u8c03\u6574\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u70b9\u51fb\u200b \u201c\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u201d\uff0cPP-OCR\u200b\u6a21\u578b\u200b\u4f1a\u200b\u5bf9\u200b\u5f53\u524d\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6240\u6709\u200b\u68c0\u6d4b\u200b\u6846\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b[3]\u3002

7. \u200b\u5185\u5bb9\u200b\u66f4\u6539\u200b\uff1a\u200b\u5355\u51fb\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5bf9\u200b\u4e0d\u200b\u51c6\u786e\u200b\u7684\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u624b\u52a8\u200b\u66f4\u6539\u200b\u3002 8. \u200b\u786e\u8ba4\u200b\u6807\u8bb0\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201c\u200b\u786e\u8ba4\u200b\u201d\uff0c\u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u5207\u6362\u200b\u4e3a\u200b \u201c\u221a\u201d\uff0c\u200b\u8df3\u8f6c\u200b\u81f3\u4e0b\u200b\u4e00\u5f20\u200b\u3002 9. \u200b\u5220\u9664\u200b\uff1a\u200b\u70b9\u51fb\u200b \u201c\u200b\u5220\u9664\u200b\u56fe\u50cf\u200b\u201d\uff0c\u200b\u56fe\u7247\u200b\u5c06\u4f1a\u200b\u88ab\u200b\u5220\u9664\u200b\u81f3\u200b\u56de\u6536\u7ad9\u200b\u3002 10. \u200b\u5bfc\u51fa\u200b\u7ed3\u679c\u200b\uff1a\u200b\u7528\u6237\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u83dc\u5355\u200b\u4e2d\u200b\u201c\u200b\u6587\u4ef6\u200b-\u200b\u5bfc\u51fa\u200b\u6807\u8bb0\u200b\u7ed3\u679c\u200b\u201d\u200b\u624b\u52a8\u200b\u5bfc\u51fa\u200b\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u70b9\u51fb\u200b\u201c\u200b\u6587\u4ef6\u200b - \u200b\u81ea\u52a8\u200b\u5bfc\u51fa\u200b\u6807\u8bb0\u200b\u7ed3\u679c\u200b\u201d\u200b\u5f00\u542f\u200b\u81ea\u52a8\u200b\u5bfc\u51fa\u200b\u3002\u200b\u624b\u52a8\u200b\u786e\u8ba4\u200b\u8fc7\u200b\u7684\u200b\u6807\u8bb0\u200b\u5c06\u4f1a\u200b\u88ab\u200b\u5b58\u653e\u200b\u5728\u200b\u6240\u200b\u6253\u5f00\u200b\u56fe\u7247\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\u7684\u200bLabel.txt\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u83dc\u5355\u680f\u200b\u70b9\u51fb\u200b \u201c\u200b\u6587\u4ef6\u200b\u201d - \"\u200b\u5bfc\u51fa\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\"\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u5c06\u200b\u6b64\u7c7b\u200b\u56fe\u7247\u200b\u7684\u200b\u8bc6\u522b\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u4fdd\u5b58\u200b\u5728\u200bcrop_img\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\uff0c\u200b\u8bc6\u522b\u200b\u6807\u7b7e\u200b\u4fdd\u5b58\u200b\u5728\u200brec_gt.txt\u200b\u4e2d\u200b\u3002

\u200b\u6ce8\u610f\u4e8b\u9879\u200b:

  • PPOCRLabel\u200b\u4ee5\u200b\u6587\u4ef6\u5939\u200b\u4e3a\u200b\u57fa\u672c\u200b\u6807\u8bb0\u200b\u5355\u4f4d\u200b\uff0c\u200b\u6253\u5f00\u200b\u5f85\u200b\u6807\u8bb0\u200b\u7684\u200b\u56fe\u7247\u200b\u6587\u4ef6\u5939\u200b\u540e\u200b\uff0c\u200b\u4e0d\u4f1a\u200b\u5728\u200b\u7a97\u53e3\u200b\u680f\u4e2d\u200b\u663e\u793a\u200b\u56fe\u7247\u200b\uff0c\u200b\u800c\u662f\u200b\u5728\u200b\u70b9\u51fb\u200b \"\u200b\u9009\u62e9\u200b\u6587\u4ef6\u5939\u200b\" \u200b\u4e4b\u540e\u200b\u76f4\u63a5\u200b\u5c06\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\u7684\u200b\u56fe\u7247\u200b\u5bfc\u5165\u5230\u200b\u7a0b\u5e8f\u200b\u4e2d\u200b\u3002
  • \u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u8868\u793a\u200b\u672c\u5f20\u200b\u56fe\u7247\u200b\u7528\u6237\u200b\u662f\u5426\u200b\u624b\u52a8\u200b\u4fdd\u5b58\u200b\u8fc7\u200b\uff0c\u200b\u672a\u200b\u624b\u52a8\u200b\u4fdd\u5b58\u200b\u8fc7\u200b\u5373\u200b\u4e3a\u200b \u201cX\u201d\uff0c\u200b\u624b\u52a8\u200b\u4fdd\u5b58\u200b\u8fc7\u200b\u4e3a\u200b \u201c\u221a\u201d\u3002\u200b\u70b9\u51fb\u200b \u201c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u201d\u200b\u6309\u94ae\u200b\u540e\u200b\uff0cPPOCRLabel\u200b\u4e0d\u4f1a\u200b\u5bf9\u200b\u72b6\u6001\u200b\u4e3a\u200b \u201c\u221a\u201d \u200b\u7684\u200b\u56fe\u7247\u200b\u91cd\u65b0\u200b\u6807\u6ce8\u200b\u3002
  • \u200b\u70b9\u51fb\u200b\u201c\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u201d\u200b\u540e\u200b\uff0c\u200b\u6a21\u578b\u200b\u4f1a\u200b\u5bf9\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u8986\u76d6\u200b\u3002\u200b\u56e0\u6b64\u200b\u5982\u679c\u200b\u5728\u6b64\u4e4b\u524d\u200b\u624b\u52a8\u200b\u66f4\u6539\u200b\u8fc7\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u6709\u200b\u53ef\u80fd\u200b\u5728\u200b\u91cd\u65b0\u200b\u8bc6\u522b\u200b\u540e\u200b\u4ea7\u751f\u200b\u53d8\u52a8\u200b\u3002
  • PPOCRLabel\u200b\u4ea7\u751f\u200b\u7684\u200b\u6587\u4ef6\u200b\u653e\u7f6e\u200b\u4e8e\u200b\u6807\u8bb0\u200b\u56fe\u7247\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\uff0c\u200b\u5305\u62ec\u200b\u4ee5\u4e0b\u200b\u51e0\u79cd\u200b\uff0c\u200b\u8bf7\u52ff\u200b\u624b\u52a8\u200b\u66f4\u6539\u200b\u5176\u4e2d\u200b\u5185\u5bb9\u200b\uff0c\u200b\u5426\u5219\u200b\u4f1a\u200b\u5f15\u8d77\u200b\u7a0b\u5e8f\u200b\u51fa\u73b0\u5f02\u5e38\u200b\u3002
\u200b\u6587\u4ef6\u540d\u200b \u200b\u8bf4\u660e\u200b Label.txt \u200b\u68c0\u6d4b\u200b\u6807\u7b7e\u200b\uff0c\u200b\u53ef\u200b\u76f4\u63a5\u200b\u7528\u4e8e\u200bPPOCR\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u7528\u6237\u200b\u6bcf\u200b\u786e\u8ba4\u200b5\u200b\u5f20\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u540e\u200b\uff0c\u200b\u7a0b\u5e8f\u200b\u4f1a\u200b\u8fdb\u884c\u200b\u81ea\u52a8\u200b\u5199\u5165\u200b\u3002\u200b\u5f53\u200b\u7528\u6237\u200b\u5173\u95ed\u200b\u5e94\u7528\u7a0b\u5e8f\u200b\u6216\u200b\u5207\u6362\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u540e\u200b\u540c\u6837\u200b\u4f1a\u200b\u8fdb\u884c\u200b\u5199\u5165\u200b\u3002 fileState.txt \u200b\u56fe\u7247\u200b\u72b6\u6001\u200b\u6807\u8bb0\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u5f53\u524d\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\u5df2\u7ecf\u200b\u88ab\u200b\u7528\u6237\u200b\u624b\u52a8\u200b\u786e\u8ba4\u200b\u8fc7\u200b\u7684\u200b\u56fe\u7247\u200b\u540d\u79f0\u200b\u3002 Cache.cach \u200b\u7f13\u5b58\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u7684\u200b\u7ed3\u679c\u200b\u3002 rec_gt.txt \u200b\u8bc6\u522b\u200b\u6807\u7b7e\u200b\u3002\u200b\u53ef\u200b\u76f4\u63a5\u200b\u7528\u4e8e\u200bPPOCR\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u9700\u200b\u7528\u6237\u200b\u624b\u52a8\u200b\u70b9\u51fb\u200b\u83dc\u5355\u680f\u200b\u201c\u200b\u6587\u4ef6\u200b\u201d - \"\u200b\u5bfc\u51fa\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\"\u200b\u540e\u200b\u4ea7\u751f\u200b\u3002 crop_img \u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u3002\u200b\u6309\u7167\u200b\u68c0\u6d4b\u200b\u6846\u200b\u5207\u5272\u200b\u540e\u200b\u7684\u200b\u56fe\u7247\u200b\u3002\u200b\u4e0e\u200brec_gt.txt\u200b\u540c\u65f6\u200b\u4ea7\u751f\u200b\u3002

\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u6570\u636e\u200b\u5212\u5206\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u6b65\u9aa4\u200b\u64cd\u4f5c\u200b\uff1a

cd ./PPOCRLabel # \u200b\u5c06\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200bPPOCRLabel\u200b\u6587\u4ef6\u5939\u200b\u4e0b\u200b\npython gen_ocr_train_val_test.py --trainValTestRatio 7:3:0 --datasetRootPath ../train_data\n
* trainValTestRatio \u200b\u662f\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u3001\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u91cf\u200b\u5212\u5206\u200b\u6bd4\u4f8b\u200b\uff0c\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8bbe\u5b9a\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u662f\u200b6:2:2 * datasetRootPath \u200b\u662f\u200bPPOCRLabel\u200b\u6807\u6ce8\u200b\u7684\u200b\u5b8c\u6574\u200b\u6570\u636e\u200b\u96c6\u200b\u5b58\u653e\u200b\u8def\u5f84\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u8def\u5f84\u200b\u662f\u200b PaddleOCR/train_data \u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u524d\u200b\u5e94\u6709\u200b\u5982\u4e0b\u200b\u7ed3\u6784\u200b\uff1a

|-train_data\n  |-crop_img\n    |- word_001_crop_0.png\n    |- word_002_crop_0.jpg\n    |- word_003_crop_0.jpg\n    | ...\n  | Label.txt\n  | rec_gt.txt\n  |- word_001.png\n  |- word_002.jpg\n  |- word_003.jpg\n  | ...\n
\u200b\u66f4\u200b\u591a\u200b\u5de5\u5177\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u8bf7\u200b\u53c2\u8003\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b

"},{"location":"data_annotations/ocr_modules/text_detection_recognition.html#3","title":"3. \u200b\u6570\u636e\u683c\u5f0f","text":"

PaddleX\u200b\u9488\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u5b9a\u4e49\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u540d\u79f0\u200b\u662f\u200bTextDetDataset\uff0c\u200b\u6574\u7406\u200b\u6807\u6ce8\u200b\u5b8c\u6210\u200b\u7684\u200b\u6570\u636e\u200b\u4e3a\u200b\u5982\u4e0b\u200b\u6587\u4ef6\u7ec4\u7ec7\u200b\u5f62\u5f0f\u200b\u548c\u200b\u547d\u540d\u200b\uff1a

dataset_dir     # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images      # \u200b\u5b58\u653e\u200b\u56fe\u50cf\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u548c\u200btrain.txt val.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n\u251c\u2500\u2500 train.txt   # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/img_0.jpg \\t [{\"transcription\": \"MASA\", \"points\": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]\n\u2514\u2500\u2500 val.txt     # \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/img_61.jpg \\t [{\"transcription\": \"TEXT\", \"points\": [[31, 10], [310, 140], [420, 220], [310, 170]]}, {...}]\n
\u200b\u5c06\u200b\u56fe\u50cf\u200b\u653e\u7f6e\u200b\u5728\u200bimages\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u751f\u200b\u7684\u200bLabel.txt\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u91cd\u65b0\u547d\u540d\u200b\u4e3a\u200btrain.txt\uff0c\u200b\u540c\u65f6\u200b\u6807\u6ce8\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u56fe\u50cf\u200b\u65f6\u200b\u4ea7\u751f\u200b\u7684\u200bLabel.txt\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u91cd\u65b0\u547d\u540d\u200b\u4e3a\u200bval.txt\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5747\u200b\u653e\u7f6e\u200b\u5728\u200bdataset_dir\uff08\u200b\u540d\u79f0\u200b\u53ef\u53d8\u200b\uff09\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u3002\u200b\u6ce8\u610f\u200btrain.txt/val.txt\u200b\u4e2d\u200b\u7684\u200b\u56fe\u50cf\u200b\u7684\u200b\u8def\u5f84\u200b\u5e94\u662f\u200bimages/xxx\u3002

\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u6bcf\u884c\u200b\u5185\u5bb9\u200b\u662f\u200b\u4e00\u5f20\u200b\u56fe\u50cf\u200b\u7684\u200b\u8def\u5f84\u200b\u548c\u200b\u4e00\u4e2a\u200b\u7ec4\u6210\u200b\u5143\u7d20\u200b\u662f\u200b\u5b57\u5178\u200b\u7684\u200b\u5217\u8868\u200b\uff0c\u200b\u8def\u5f84\u200b\u548c\u200b\u5217\u8868\u200b\u5fc5\u987b\u200b\u4f7f\u7528\u200b\u5236\u8868\u7b26\u200b\u2019\\t\u2018\u200b\u8fdb\u884c\u200b\u5206\u9694\u200b\uff0c\u200b\u4e0d\u53ef\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u8fdb\u884c\u200b\u5206\u9694\u200b\u3002

\u200b\u5bf9\u4e8e\u200b\u7ec4\u6210\u200b\u5143\u7d20\u200b\u662f\u200b\u5b57\u5178\u200b\u7684\u200b\u5217\u8868\u200b\uff0c\u200b\u5b57\u5178\u200b\u4e2d\u200b points \u200b\u8868\u793a\u200b\u6587\u672c\u6846\u200b\u7684\u200b\u56db\u4e2a\u200b\u9876\u70b9\u200b\u7684\u200b\u5750\u6807\u200b\uff08x, y\uff09\uff0c\u200b\u4ece\u200b\u5de6\u4e0a\u89d2\u200b\u7684\u200b\u9876\u70b9\u200b\u5f00\u59cb\u200b\u6309\u200b\u987a\u65f6\u9488\u200b\u6392\u5e8f\u200b\uff1b\u200b\u5b57\u5178\u200b\u4e2d\u200btranscription\u200b\u8868\u793a\u200b\u8be5\u200b\u6587\u672c\u6846\u200b\u7684\u200b\u6587\u5b57\u200b\uff0c\u200b\u82e5\u200btranscription \u200b\u7684\u200b\u200b\u5185\u5bb9\u200b\u4e3a\u200b\u201c###\u201d\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u8be5\u200b\u6587\u672c\u6846\u200b\u65e0\u6548\u200b\uff0c\u200b\u4e0d\u200b\u53c2\u4e0e\u200b\u8bad\u7ec3\u200b\u3002\u200b\u5177\u4f53\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u4e86\u200bPPOCRLabel\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5728\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u540e\u200b\u5c06\u200b\u6587\u5b57\u200b\u68c0\u6d4b\u200b\uff08det\uff09\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u7684\u200bdet_gt_train.txt\u200b\u6539\u540d\u200b\u4e3a\u200btrain.txt\u3001det_gt_test.txt\u200b\u6539\u540d\u200b\u4e3a\u200bval.txt\u200b\u5373\u53ef\u200b\u3002

"},{"location":"data_annotations/time_series_modules/time_series_anomaly_detection.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e0\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u4efb\u52a1\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4e0d\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u3002\u200b\u6536\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u6837\u672c\u200b\u5c3d\u53ef\u80fd\u200b\u4fdd\u8bc1\u200b\u90fd\u200b\u662f\u200b\u6b63\u5e38\u200b\u6570\u636e\u200b\uff0c\u200b\u5373\u200b\u6ca1\u6709\u200b\u5f02\u5e38\u200b\uff08\u200b\u7528\u200b0\u200b\u8868\u793a\u200b\u65e0\u200b\u5f02\u5e38\u200b\uff09\uff0c\u200b\u8bad\u7ec3\u200b\u96c6\u4e2d\u200b\u8868\u793a\u200b\u5f02\u5e38\u200b\u7684\u200b\u6807\u7b7e\u200b\u5217\u5747\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0\uff0c\u200b\u6216\u8005\u200b\u4e0d\u200b\u8bbe\u7f6e\u200b\u6807\u7b7e\u200b\u5217\u200b\u4e5f\u200b\u662f\u200b\u53ef\u4ee5\u200b\u7684\u200b\u3002\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u4e3a\u4e86\u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u9700\u8981\u200b\u8fdb\u884c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u67d0\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u200b\u5f02\u5e38\u200b\u7684\u200b\u70b9\u200b\uff0c\u200b\u5c06\u200b\u8be5\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 1 \u200b\u5373\u53ef\u200b\uff0c\u200b\u5176\u4ed6\u200b\u6b63\u5e38\u200b\u7684\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u4e3a\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b0\u3002

"},{"location":"data_annotations/time_series_modules/time_series_classification.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u6807\u6ce8\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u57fa\u4e8e\u200b\u6536\u96c6\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u660e\u786e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u7684\u200b\u5206\u7c7b\u200b\u76ee\u6807\u200b\uff0c\u200b\u5e76\u200b\u5b9a\u4e49\u200b\u76f8\u5e94\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u5728\u200bcsv\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u8bbe\u7f6e\u200b\u8868\u793a\u200b\u6837\u672c\u200b\u7684\u200bgroud_id\u200b\u5217\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b group_id\u200b\u5c31\u200b\u8868\u793a\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u6837\u672c\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u80a1\u7968\u4ef7\u683c\u200b\u9884\u6d4b\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u53ef\u80fd\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\uff080\uff09\u3001\u201c\u200b\u6301\u5e73\u200b\u201d\uff081\uff09\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\uff082\uff09\u3002\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0 \uff1b\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b2\u3002\u200b\u5982\u4e0b\u200b\u56fe\u200b\uff0c\u200b\u7eff\u8272\u200b\u6846\u662f\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b(groud_id=0)\uff0c\u200b\u7c7b\u522b\u200b(label)\u200b\u662f\u200b1\uff0c\u200b\u7ea2\u8272\u200b\u6846\u662f\u200b\u53e6\u200b\u4e00\u4e2a\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6837\u672c\u200b(groud_id=1)\uff0c\u200b\u7c7b\u522b\u200b(label)\u200b\u662f\u200b0\uff0c\u200b\u5982\u679c\u200b\u6709\u200bn\u200b\u4e2a\u200b\u6837\u672c\u200b\u53ef\u4ee5\u200b\u8bbe\u7f6e\u200bgroud_id=0,...n-1\uff1b\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u957f\u5ea6\u200b(time=0,...,9)\u200b\u90fd\u200b\u662f\u200b10\uff0c\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b\uff08dim_0, dim_1\uff09\u200b\u662f\u200b2\u3002

"},{"location":"data_annotations/time_series_modules/time_series_forecasting.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b","text":"

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u6570\u636e\u200b\u662f\u200b\u65e0\u9700\u200b\u6807\u6ce8\u200b\u7684\u200b\uff0c\u200b\u53ea\u8981\u200b\u6536\u96c6\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u5c06\u200b\u6240\u6709\u200b\u6570\u636e\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u7684\u200b\u987a\u5e8f\u6392\u5217\u200b\u5728\u200bcsv\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u5373\u53ef\u200b\u3002\u200b\u8bad\u7ec3\u200b\u65f6\u4f1a\u200b\u5c06\u200b\u6570\u636e\u200b\u81ea\u52a8\u200b\u5207\u200b\u5206\u4e3a\u200b\u591a\u4e2a\u200b\u65f6\u95f4\u200b\u7247\u6bb5\u200b\uff0c\u200b\u7ec4\u5408\u200b\u8bad\u7ec3\u6837\u672c\u200b\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff0c\u200b\u5386\u53f2\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u548c\u200b\u672a\u6765\u200b\u7684\u200b\u5e8f\u5217\u200b\u5206\u522b\u200b\u8868\u793a\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u548c\u200b\u5176\u200b\u5bf9\u5e94\u200b\u7684\u200b\u9884\u6d4b\u200b\u76ee\u6807\u200b\u3002\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002

"},{"location":"installation/installation.html","title":"PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u2757\u200b\u5b89\u88c5\u200b PaddleX \u200b\u524d\u200b\u8bf7\u200b\u5148\u200b\u786e\u4fdd\u60a8\u200b\u6709\u200b\u57fa\u7840\u200b\u7684\u200b Python \u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\uff08\u200b\u6ce8\u200b\uff1a\u200b\u5f53\u524d\u200b\u652f\u6301\u200bPython 3.8 \uff5e Python 3.10\u200b\u4e0b\u200b\u8fd0\u884c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200bPython\u200b\u7248\u672c\u200b\u9002\u914d\u200b\u4e2d\u200b\uff09\u3002

"},{"location":"installation/installation.html#1","title":"1. \u200b\u5feb\u901f\u200b\u5b89\u88c5","text":"

\u200b\u6b22\u8fce\u60a8\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200bPaddleX\uff0c\u200b\u5728\u200b\u6211\u4eec\u200b\u6b63\u5f0f\u200b\u5f00\u59cb\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u9996\u5148\u200b\u660e\u786e\u200b\u60a8\u200b\u7684\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u9700\u6c42\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002 PaddleX\u200b\u4e3a\u200b\u60a8\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff1aWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u548c\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\uff0c\u200b\u4e0b\u9762\u200b\u5206\u522b\u200b\u5bf9\u200b\u5176\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u8fdb\u884c\u200b\u4ecb\u7ecd\u200b\uff1a

"},{"location":"installation/installation.html#11-wheel","title":"1.1 Wheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b \uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u66f4\u200b\u4fbf\u6377\u200b\u3001\u200b\u66f4\u200b\u8f7b\u91cf\u200b\u7684\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200b\u8f7b\u91cf\u7ea7\u200b\u7684\u200bWheel\u200b\u5305\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u5373\u53ef\u200b\u57fa\u4e8e\u200bPaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u6240\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u5e76\u200b\u80fd\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u8fdb\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

\u200b\u53c2\u8003\u200b\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bWheel\u200b\u5305\u200b\uff1a

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u4fdd\u8bc1\u200b PaddlePaddle \u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff0c\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u65b9\u53ef\u200b\u8fdb\u884c\u200b\u4e0b\u200b\u4e00\u6b65\u200b\u3002

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n
"},{"location":"installation/installation.html#12","title":"1.2 \u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u4e8c\u6b21\u5f00\u53d1\u200b \uff08\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u3001\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3001\u200b\u81ea\u5b9a\u4e49\u200b\u6a21\u578b\u200b\u7ed3\u6784\u200b\u3001\u200b\u81ea\u5b9a\u4e49\u200b\u63a8\u7406\u200b\u4ee3\u7801\u200b\u7b49\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u529f\u80fd\u200b\u66f4\u52a0\u200b\u5f3a\u5927\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5b89\u88c5\u200b\u60a8\u200b\u9700\u8981\u200b\u7684\u200bPaddleX\u200b\u63d2\u4ef6\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u4e0d\u4ec5\u200b\u540c\u6837\u200b\u80fd\u591f\u200b\u5bf9\u200b\u63d2\u4ef6\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\uff0c\u200b\u8fd8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u5176\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u66f4\u200b\u9ad8\u7ea7\u200b\u7684\u200b\u64cd\u4f5c\u200b\u3002

PaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5982\u4e0b\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u6839\u636e\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff1a

\ud83d\udc49 \u200b\u63d2\u4ef6\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09 \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u6a21\u5757\u200b \u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b PaddleSeg \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b PaddleDetection \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCR \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCRPaddleDetection \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b PaddleOCRPaddleDetectionPaddleClas \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u901a\u7528\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b PaddleSeg

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u7684\u200b\u63d2\u4ef6\u200b\u4e3a\u200bPaddleXXX\uff0c\u200b\u5728\u200b\u53c2\u8003\u200b\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b\uff1a

git clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\npip install -e .\npaddlex --install PaddleXXX  # \u200b\u4f8b\u5982\u200bPaddleOCR\n

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u91c7\u7528\u200b\u8fd9\u79cd\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u540e\u200b\uff0c\u200b\u662f\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel \u200b\u5305\u200b\u3002

\u200b\u5982\u679c\u200b\u4e0a\u8ff0\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u53ef\u4ee5\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8df3\u8fc7\u200b\u63a5\u4e0b\u6765\u200b\u7684\u200b\u6b65\u9aa4\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bLinux\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b2. Linux\u200b\u5b89\u88c5\u200bPaddleX\u200b\u8be6\u7ec6\u200b\u6559\u7a0b\u200b\u3002\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\u3002

"},{"location":"installation/installation.html#2-linuxpaddex","title":"2. Linux\u200b\u5b89\u88c5\u200bPaddeX\u200b\u8be6\u7ec6\u200b\u6559\u7a0b","text":"

\u200b\u4f7f\u7528\u200bLinux\u200b\u5b89\u88c5\u200bPaddleX\u200b\u65f6\u200b\uff0c\u200b\u6211\u4eec\u200b\u5f3a\u70c8\u63a8\u8350\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5b98\u65b9\u200bDocker\u200b\u955c\u50cf\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u7136\u200b\u4e5f\u200b\u53ef\u200b\u4f7f\u7528\u200b\u5176\u4ed6\u200b\u81ea\u5b9a\u4e49\u200b\u65b9\u5f0f\u200b\u5b89\u88c5\u200b\u3002

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b Docker \u200b\u955c\u50cf\u200b\u5b89\u88c5\u200b\u65f6\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5df2\u7ecf\u200b\u5185\u7f6e\u200b\u4e86\u200b PaddlePaddle\u3001PaddleX\uff08\u200b\u5305\u62ec\u200bwheel\u200b\u5305\u200b\u548c\u200b\u6240\u6709\u200b\u63d2\u4ef6\u200b\uff09\uff0c\u200b\u5e76\u200b\u914d\u7f6e\u200b\u597d\u200b\u4e86\u200b\u76f8\u5e94\u200b\u7684\u200bCUDA\u200b\u73af\u5883\u200b\uff0c\u200b\u60a8\u200b\u83b7\u53d6\u200b Docker \u200b\u955c\u50cf\u200b\u5e76\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b\u5373\u53ef\u200b\u5f00\u59cb\u200b\u4f7f\u7528\u200b\u3002

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5b9a\u4e49\u200b\u65b9\u5f0f\u200b\u5b89\u88c5\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u5148\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b PaddlePaddle \u200b\u6846\u67b6\u200b\uff0c\u200b\u968f\u540e\u200b\u83b7\u53d6\u200b PaddleX \u200b\u6e90\u7801\u200b\uff0c\u200b\u6700\u540e\u200b\u9009\u62e9\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b PaddleX \u200b\u4ec5\u200b\u652f\u6301\u200b 11.8 \u200b\u548c\u200b 12.3 \u200b\u7248\u672c\u200b\u7684\u200b CUDA\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u200b\u5df2\u200b\u5b89\u88c5\u200b\u7684\u200b Nvidia \u200b\u9a71\u52a8\u200b\u652f\u6301\u200b\u7684\u200b\u4e0a\u8ff0\u200b CUDA \u200b\u7248\u672c\u200b\u3002

"},{"location":"installation/installation.html#21-dockerpaddlex","title":"2.1 \u200b\u57fa\u4e8e\u200bDocker\u200b\u83b7\u53d6\u200bPaddleX","text":"

\u200b\u53c2\u8003\u200b\u4e0b\u8ff0\u200b\u547d\u4ee4\u200b\uff0c\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5b98\u65b9\u200b Docker \u200b\u955c\u50cf\u200b\uff0c\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u540d\u4e3a\u200b paddlex \u200b\u7684\u200b\u5bb9\u5668\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f53\u524d\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u6620\u5c04\u200b\u5230\u200b\u5bb9\u5668\u200b\u5185\u200b\u7684\u200b /paddle \u200b\u76ee\u5f55\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b >= 19.03\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a

# \u200b\u5bf9\u4e8e\u200b CPU \u200b\u7528\u6237\u200b\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b GPU \u200b\u7528\u6237\u200b\n# \u200b\u5bf9\u4e8e\u200b CUDA11.8 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b CUDA12.3 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 19.03 \u200b\u4f46\u200b >= 17.06\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a
\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
# \u200b\u5bf9\u4e8e\u200b CPU \u200b\u7528\u6237\u200b\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b GPU \u200b\u7528\u6237\u200b\n# \u200b\u5bf9\u4e8e\u200b CUDA11.8 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b CUDA12.3 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 17.06\uff0c\u200b\u8bf7\u200b\u5347\u7ea7\u200b Docker \u200b\u7248\u672c\u200b\u3002

  • \u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u66f4\u200b\u6df1\u5165\u200b\u4e86\u89e3\u200b Docker \u200b\u7684\u200b\u539f\u7406\u200b\u6216\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b Docker\u200b\u5b98\u65b9\u7f51\u7ad9\u200b \u200b\u6216\u200b Docker\u200b\u5b98\u65b9\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"installation/installation.html#22-paddlex","title":"2.2 \u200b\u81ea\u5b9a\u4e49\u200b\u65b9\u5f0f\u200b\u5b89\u88c5\u200bPaddleX","text":"

\u200b\u5728\u200b\u5b89\u88c5\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u53c2\u8003\u200b\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u98de\u6868\u200b\u7684\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"installation/installation.html#221-paddlex","title":"2.2.1 \u200b\u83b7\u53d6\u200b PaddleX \u200b\u6e90\u7801","text":"

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u8bf7\u200b\u4f7f\u7528\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u4ece\u200b GitHub \u200b\u83b7\u53d6\u200b PaddleX \u200b\u6700\u65b0\u200b\u6e90\u7801\u200b\uff1a

git clone https://github.com/PaddlePaddle/PaddleX.git\n
\u200b\u5982\u679c\u200b\u8bbf\u95ee\u200b GitHub \u200b\u7f51\u901f\u200b\u8f83\u6162\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4ece\u200b Gitee \u200b\u4e0b\u8f7d\u200b\uff0c\u200b\u547d\u4ee4\u200b\u5982\u4e0b\u200b\uff1a

git clone https://gitee.com/paddlepaddle/PaddleX.git\n
"},{"location":"installation/installation.html#222-paddlex","title":"2.2.2 \u200b\u5b89\u88c5\u200bPaddleX","text":"

\u200b\u83b7\u53d6\u200b PaddleX \u200b\u6700\u65b0\u200b\u6e90\u7801\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u6216\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

  • \u200b\u82e5\u200b\u60a8\u200b\u9009\u62e9\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

cd PaddleX\n\n# \u200b\u5b89\u88c5\u200b PaddleX whl\n# -e\uff1a\u200b\u4ee5\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel\npip install -e .\n
* \u200b\u82e5\u200b\u60a8\u200b\u9009\u62e9\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u5e76\u4e14\u200b\u60a8\u200b\u9700\u8981\u200b\u7684\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\u4e3a\u200b PaddleXXX\uff08\u200b\u53ef\u4ee5\u200b\u6709\u200b\u591a\u4e2a\u200b\uff09\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

cd PaddleX\n\n# \u200b\u5b89\u88c5\u200b PaddleX whl\n# -e\uff1a\u200b\u4ee5\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel\npip install -e .\n\n# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleXXX\n
\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200bPaddleOCR\u3001PaddleClas\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u5b89\u88c5\u200b\u63d2\u4ef6\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleOCR\u3001PaddleClas \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleOCR PaddleClas\n
\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u586b\u5199\u200b\u5177\u4f53\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\npaddlex --install\n
\u200b\u63d2\u4ef6\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u514b\u9686\u200b\u6e90\u4e3a\u200b github.com\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u652f\u6301\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b--platform \u200b\u6307\u5b9a\u200b\u514b\u9686\u200b\u6e90\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200bPaddleX\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install --platform gitee.com\n
\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u5c06\u4f1a\u200b\u6709\u200b\u5982\u4e0b\u200b\u63d0\u793a\u200b\uff1a

All packages are installed.\n
\u200b\u66f4\u200b\u591a\u200b\u786c\u4ef6\u200b\u73af\u5883\u200b\u7684\u200bPaddleX\u200b\u5b89\u88c5\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b

"},{"location":"installation/paddlepaddle_install.html","title":"\u98de\u6868\u200bPaddlePaddle\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b PaddlePaddle \u200b\u65f6\u200b\uff0c\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b Docker \u200b\u5b89\u88c5\u200b\u548c\u200b\u901a\u8fc7\u200b pip \u200b\u5b89\u88c5\u200b\u3002

"},{"location":"installation/paddlepaddle_install.html#docker","title":"\u57fa\u4e8e\u200b Docker \u200b\u5b89\u88c5\u200b\u98de\u6868","text":"

\u200b\u82e5\u200b\u60a8\u200b\u901a\u8fc7\u200b Docker \u200b\u5b89\u88c5\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u4e0b\u8ff0\u200b\u547d\u4ee4\u200b\uff0c\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b Docker \u200b\u955c\u50cf\u200b\uff0c\u200b\u521b\u5efa\u200b\u4e00\u4e2a\u200b\u540d\u4e3a\u200b paddlex \u200b\u7684\u200b\u5bb9\u5668\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5f53\u524d\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u6620\u5c04\u200b\u5230\u200b\u5bb9\u5668\u200b\u5185\u200b\u7684\u200b /paddle \u200b\u76ee\u5f55\u200b\uff1a

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b >= 19.03\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a

# \u200b\u5bf9\u4e8e\u200b cpu \u200b\u7528\u6237\u200b:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b gpu \u200b\u7528\u6237\u200b:\n# CUDA11.8 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA12.3 \u200b\u7528\u6237\u200b\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 19.03 \u200b\u4f46\u200b >= 17.06\uff0c\u200b\u8bf7\u200b\u6267\u884c\u200b\uff1a
\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
# \u200b\u5bf9\u4e8e\u200b cpu \u200b\u7528\u6237\u200b:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# \u200b\u5bf9\u4e8e\u200b gpu \u200b\u7528\u6237\u200b:\n# CUDA11.8 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA12.3 \u200b\u7528\u6237\u200b\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • \u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200b\u7684\u200b Docker \u200b\u7248\u672c\u200b <= 17.06\uff0c\u200b\u8bf7\u200b\u5347\u7ea7\u200b Docker \u200b\u7248\u672c\u200b\u3002

  • \u200b\u6ce8\u200b\uff1a\u200b\u66f4\u591a\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b docker \u200b\u955c\u50cf\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u3002

"},{"location":"installation/paddlepaddle_install.html#pip","title":"\u57fa\u4e8e\u200b pip \u200b\u5b89\u88c5\u200b\u98de\u6868","text":"

\u200b\u82e5\u200b\u60a8\u200b\u901a\u8fc7\u200b pip \u200b\u5b89\u88c5\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u4e0b\u8ff0\u200b\u547d\u4ee4\u200b\uff0c\u200b\u7528\u200b pip \u200b\u5728\u200b\u5f53\u524d\u200b\u73af\u5883\u200b\u4e2d\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b PaddlePaddle\uff1a

# cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u66f4\u591a\u200b\u98de\u6868\u200b Wheel \u200b\u7248\u672c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u3002

\u200b\u5173\u4e8e\u200b\u5176\u4ed6\u200b\u786c\u4ef6\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u53ef\u4ee5\u200b\u9a8c\u8bc1\u200b PaddlePaddle \u200b\u662f\u5426\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff1a

python -c \"import paddle; print(paddle.__version__)\"\n
\u200b\u5982\u679c\u200b\u5df2\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\uff0c\u200b\u5c06\u200b\u8f93\u51fa\u200b\u4ee5\u4e0b\u5185\u5bb9\u200b\uff1a

3.0.0-beta2\n

\u2757 \u200b\u6ce8\u200b\uff1a\u200b\u5982\u679c\u200b\u5728\u200b\u5b89\u88c5\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u51fa\u73b0\u200b\u4efb\u4f55\u200b\u95ee\u9898\u200b\uff0c\u200b\u6b22\u8fce\u200b\u5728\u200bPaddle\u200b\u4ed3\u5e93\u200b\u4e2d\u63d0\u200bIssue\u3002

"},{"location":"module_usage/instructions/benchmark.html","title":"\u6a21\u578b\u200b\u63a8\u7406\u200b Benchmark","text":"

PaddleX \u200b\u652f\u6301\u200b\u7edf\u8ba1\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff0c\u200b\u9700\u200b\u901a\u8fc7\u200b\u73af\u5883\u53d8\u91cf\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

  • PADDLE_PDX_INFER_BENCHMARK\uff1a\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b True \u200b\u65f6\u5219\u200b\u5f00\u542f\u200b Benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_WARMUP\uff1a\u200b\u8bbe\u7f6e\u200b warm up\uff0c\u200b\u5728\u200b\u5f00\u59cb\u200b\u6d4b\u8bd5\u200b\u524d\u200b\uff0c\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u5faa\u73af\u200b\u8fed\u4ee3\u200b n \u200b\u6b21\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 0\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_DATA_SIZE\uff1a \u200b\u8bbe\u7f6e\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u7684\u200b\u5c3a\u5bf8\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 224\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_ITER\uff1a\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b Benchmark \u200b\u6d4b\u8bd5\u200b\u7684\u200b\u5faa\u73af\u200b\u6b21\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u4e3a\u200b None \u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u968f\u673a\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff1b
  • PADDLE_PDX_INFER_BENCHMARK_OUTPUT\uff1a\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u4fdd\u5b58\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b ./benchmark\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b None\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4fdd\u5b58\u200b Benchmark \u200b\u6307\u6807\u200b\uff1b

\u200b\u4f7f\u7528\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

PADDLE_PDX_INFER_BENCHMARK=True \\\nPADDLE_PDX_INFER_BENCHMARK_WARMUP=5 \\\nPADDLE_PDX_INFER_BENCHMARK_DATA_SIZE=320 \\\nPADDLE_PDX_INFER_BENCHMARK_ITER=10 \\\nPADDLE_PDX_INFER_BENCHMARK_OUTPUT=./benchmark \\\npython main.py \\\n    -c ./paddlex/configs/object_detection/PicoDet-XS.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=None \\\n    -o Predict.batch_size=2 \\\n    -o Predict.input=None\n

\u200b\u5728\u200b\u5f00\u542f\u200b Benchmark \u200b\u540e\u200b\uff0c\u200b\u5c06\u200b\u81ea\u52a8\u200b\u6253\u5370\u200b benchmark \u200b\u6307\u6807\u200b\uff1a

+----------------+-----------------+-----------------+------------------------+\n|   Component    | Total Time (ms) | Number of Calls | Avg Time Per Call (ms) |\n+----------------+-----------------+-----------------+------------------------+\n|    ReadCmp     |   99.60412979   |        10       |       9.96041298       |\n|     Resize     |   17.01641083   |        20       |       0.85082054       |\n|   Normalize    |   44.61312294   |        20       |       2.23065615       |\n|   ToCHWImage   |    0.03385544   |        20       |       0.00169277       |\n|    Copy2GPU    |   13.46874237   |        10       |       1.34687424       |\n|     Infer      |   71.31743431   |        10       |       7.13174343       |\n|    Copy2CPU    |    0.39076805   |        10       |       0.03907681       |\n| DetPostProcess |    0.36168098   |        20       |       0.01808405       |\n+----------------+-----------------+-----------------+------------------------+\n+-------------+-----------------+---------------------+----------------------------+\n|    Stage    | Total Time (ms) | Number of Instances | Avg Time Per Instance (ms) |\n+-------------+-----------------+---------------------+----------------------------+\n|  PreProcess |   161.26751900  |          20         |         8.06337595         |\n|  Inference  |   85.17694473   |          20         |         4.25884724         |\n| PostProcess |    0.36168098   |          20         |         0.01808405         |\n|   End2End   |   256.90770149  |          20         |        12.84538507         |\n|    WarmUp   |  5412.37807274  |          10         |        541.23780727        |\n+-------------+-----------------+---------------------+----------------------------+\n

\u200b\u5728\u200b Benchmark \u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u7edf\u8ba1\u200b\u8be5\u200b\u6a21\u578b\u200b\u5168\u90e8\u200b\u7ec4\u4ef6\u200b\uff08Component\uff09\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001\u200b\u8c03\u7528\u200b\u6b21\u6570\u200b\uff08Number of Calls\uff09\u3001\u200b\u8c03\u7528\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Call\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u4ee5\u53ca\u200b\u6309\u200b\u9884\u70ed\u200b\uff08WarmUp\uff09\u3001\u200b\u9884\u5904\u7406\u200b\uff08PreProcess\uff09\u3001\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\uff08Inference\uff09\u3001\u200b\u540e\u5904\u7406\u200b\uff08PostProcess\uff09\u200b\u548c\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\uff08End2End\uff09\u200b\u8fdb\u884c\u200b\u5212\u5206\u200b\u7684\u200b\u8017\u65f6\u200b\u7edf\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u6bcf\u4e2a\u200b\u9636\u6bb5\u200b\u7684\u200b\u603b\u200b\u8017\u65f6\u200b\uff08Total Time\uff0c\u200b\u5355\u4f4d\u200b\u4e3a\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\u3001**\u200b\u6837\u672c\u6570\u200b\uff08Number of Instances\uff09\u200b\u548c\u200b**\u200b\u5355\u200b\u6837\u672c\u200b**\u200b\u5e73\u5747\u200b\u6267\u884c\u200b\u8017\u65f6\u200b\uff08Avg Time Per Instance\uff0c\u200b\u5355\u4f4d\u200b\u201c\u200b\u6beb\u79d2\u200b\u201d\uff09\uff0c\u200b\u540c\u65f6\u200b\uff0c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5230\u200b\u5230\u200b\u672c\u5730\u200b\uff1a ./benchmark/detail.csv \u200b\u548c\u200b ./benchmark/summary.csv\uff1a

Component,Total Time (ms),Number of Calls,Avg Time Per Call (ms)\nReadCmp,99.60412979125977,10,9.960412979125977\nResize,17.01641082763672,20,0.8508205413818359\nNormalize,44.61312294006348,20,2.230656147003174\nToCHWImage,0.033855438232421875,20,0.0016927719116210938\nCopy2GPU,13.468742370605469,10,1.3468742370605469\nInfer,71.31743431091309,10,7.131743431091309\nCopy2CPU,0.39076805114746094,10,0.039076805114746094\nDetPostProcess,0.3616809844970703,20,0.018084049224853516\n
Stage,Total Time (ms),Number of Instances,Avg Time Per Instance (ms)\nPreProcess,161.26751899719238,20,8.06337594985962\nInference,85.17694473266602,20,4.258847236633301\nPostProcess,0.3616809844970703,20,0.018084049224853516\nEnd2End,256.90770149230957,20,12.845385074615479\nWarmUp,5412.3780727386475,10,541.2378072738647\n
"},{"location":"module_usage/instructions/config_parameters_common.html","title":"PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e","text":""},{"location":"module_usage/instructions/config_parameters_common.html#global","title":"Global","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b model str \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mode str \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\uff08check_dataset/train/evaluate/export/predict\uff09 check_dataset dataset_dir str \u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b device str \u200b\u6307\u5b9a\u200b\u4f7f\u7528\u200b\u7684\u200b\u8bbe\u5907\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bbe\u5907\u200bid output str \u200b\u8f93\u51fa\u200b\u8def\u5f84\u200b \"output\""},{"location":"module_usage/instructions/config_parameters_common.html#checkdataset","title":"CheckDataset","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b convert.enable bool \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff1b\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3001\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u3001\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u3001\u200b\u6587\u6863\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u3001\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u3001\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u3001\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u3001\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u3001\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff1b\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u652f\u6301\u200bCOCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3001\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u652f\u6301\u200bLabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u548c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200bVOC\u3001LabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u652f\u6301\u200bPKL\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\uff1b\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u652f\u6301\u200bxlsx\u200b\u548c\u200bxls\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b False convert.src_dataset_type str \u200b\u9700\u8981\u200b\u8f6c\u6362\u200b\u7684\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b null split.enable bool \u200b\u662f\u5426\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b False split.train_percent int \u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200bval_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null split.val_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null split.gallery_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u4e2d\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u3001query_percent\uff0c\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b\u200b\u8be5\u200b\u53c2\u6570\u200b\u53ea\u6709\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u624d\u200b\u4f1a\u200b\u4f7f\u7528\u200b null split.query_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u4e2d\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u3001gallery_percent\uff0c\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b\u200b\u8be5\u200b\u53c2\u6570\u200b\u53ea\u6709\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u624d\u200b\u4f1a\u200b\u4f7f\u7528\u200b null"},{"location":"module_usage/instructions/config_parameters_common.html#train","title":"Train","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b num_classes int \u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u200b\uff1b\u200b\u5982\u679c\u200b\u60a8\u200b\u9700\u8981\u200b\u5728\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u9700\u8981\u200b\u5bf9\u200b\u8be5\u200b\u53c2\u6570\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1b\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u3001\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4e0d\u200b\u652f\u6301\u200b\u8be5\u200b\u53c2\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7c7b\u522b\u200b\u6570\u200b epochs_iters int \u200b\u6a21\u578b\u200b\u5bf9\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b batch_size int \u200b\u8bad\u7ec3\u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6279\u200b\u5927\u5c0f\u200b learning_rate float \u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b pretrain_weight_path str \u200b\u9884\u200b\u8bad\u7ec3\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b null warmup_steps int \u200b\u9884\u70ed\u200b\u6b65\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u70ed\u200b\u6b65\u6570\u200b resume_path str \u200b\u6a21\u578b\u200b\u4e2d\u65ad\u200b\u540e\u200b\u7684\u200b\u6062\u590d\u200b\u8def\u5f84\u200b null log_interval int \u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694\u200b eval_interval int \u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u95f4\u9694\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u95f4\u9694\u200b save_interval int \u200b\u6a21\u578b\u200b\u4fdd\u5b58\u200b\u95f4\u9694\u200b\uff1b\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3001\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u8be5\u200b\u53c2\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u4fdd\u5b58\u200b\u95f4\u9694"},{"location":"module_usage/instructions/config_parameters_common.html#evaluate","title":"Evaluate","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd\u200b log_interval int \u200b\u8bc4\u4f30\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bc4\u4f30\u200b\u65e5\u5fd7\u200b\u6253\u5370\u200b\u95f4\u9694"},{"location":"module_usage/instructions/config_parameters_common.html#export","title":"Export","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u5bfc\u51fa\u200b\u6a21\u578b\u200b\u7684\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd"},{"location":"module_usage/instructions/config_parameters_common.html#predict","title":"Predict","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b batch_size int \u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b model_dir str \u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u63a8\u7406\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd\u200b input str \u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84"},{"location":"module_usage/instructions/config_parameters_time_series.html","title":"PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e","text":""},{"location":"module_usage/instructions/config_parameters_time_series.html#global","title":"Global","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b model str \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mode str \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\uff08check_dataset/train/evaluate/export/predict\uff09 check_dataset dataset_dir str \u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b device str \u200b\u6307\u5b9a\u200b\u4f7f\u7528\u200b\u7684\u200b\u8bbe\u5907\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u8bbe\u5907\u200bid output str \u200b\u8f93\u51fa\u200b\u8def\u5f84\u200b \"output\""},{"location":"module_usage/instructions/config_parameters_time_series.html#checkdataset","title":"CheckDataset","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b convert.enable bool \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff1b\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u652f\u6301\u200bxlsx\u200b\u548c\u200bxls\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b False convert.src_dataset_type str \u200b\u9700\u8981\u200b\u8f6c\u6362\u200b\u7684\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b null split.enable bool \u200b\u662f\u5426\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b False split.train_percent int \u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200bval_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null split.val_percent int \u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200btrain_percent\u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b null"},{"location":"module_usage/instructions/config_parameters_time_series.html#train","title":"Train","text":""},{"location":"module_usage/instructions/config_parameters_time_series.html#_1","title":"\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u516c\u5171\u200b\u53c2\u6570","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b epochs_iters int \u200b\u6a21\u578b\u200b\u5bf9\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u91cd\u590d\u200b\u5b66\u4e60\u200b\u6b21\u6570\u200b batch_size int \u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u6279\u200b\u5927\u5c0f\u200b learning_rate float \u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u521d\u59cb\u200b\u5b66\u4e60\u200b\u7387\u200b time_col str \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\u3002 yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b freq str or int \u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\u3002 yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9891\u7387"},{"location":"module_usage/instructions/config_parameters_time_series.html#_2","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u53c2\u6570","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b target_cols str \u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b OT input_len int \u200b\u5bf9\u4e8e\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8be5\u200b\u53c2\u6570\u200b\u8868\u793a\u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u5386\u53f2\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u53ca\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u80fd\u591f\u200b\u53c2\u8003\u200b\u7684\u200b\u5386\u53f2\u200b\u4fe1\u606f\u200b\u8d8a\u200b\u591a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u9ad8\u200b\u3002 96 predict_len int \u200b\u5e0c\u671b\u200b\u6a21\u578b\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u5ea6\u200b\uff1b\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b\u7684\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u8d8a\u957f\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u4f4e\u200b\u3002 96 patience int early stop\u200b\u673a\u5236\u200b\u53c2\u6570\u200b\uff0c\u200b\u6307\u5728\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u5bb9\u5fcd\u200b\u6a21\u578b\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u7684\u200b\u6027\u80fd\u200b\u591a\u5c11\u200b\u6b21\u8fde\u7eed\u200b\u6ca1\u6709\u200b\u6539\u8fdb\u200b\uff1b\u200b\u8010\u5fc3\u200b\u503c\u8d8a\u200b\u5927\u200b\uff0c\u200b\u4e00\u822c\u200b\u8bad\u7ec3\u200b\u65f6\u95f4\u200b\u8d8a\u957f\u200b\u3002 10"},{"location":"module_usage/instructions/config_parameters_time_series.html#_3","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b input_len int \u200b\u5bf9\u4e8e\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8be5\u200b\u53c2\u6570\u200b\u8868\u793a\u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff0c\u200b\u4f1a\u200b\u6309\u7167\u200b\u8be5\u200b\u957f\u5ea6\u200b\u5bf9\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5207\u7247\u200b\uff0c\u200b\u9884\u6d4b\u200b\u8be5\u200b\u957f\u5ea6\u200b\u4e0b\u200b\u8fd9\u200b\u4e00\u6bb5\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u8003\u8651\u200b\u3002\u200b\u5982\u200b\uff1a\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\uff0c\u200b\u5219\u200b\u8868\u793a\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b 96 \u200b\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\u3002 96 feature_cols str \u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u8868\u793a\u200b\u80fd\u591f\u200b\u5224\u65ad\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u76f8\u5173\u200b\u53d8\u91cf\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\uff0c\u200b\u53ef\u80fd\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u8fd0\u8f6c\u200b\u65f6\u200b\u7684\u200b\u6563\u70ed\u91cf\u200b\u6709\u5173\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u8bbe\u7f6e\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\u3002 feature_0,feature_1 label_col str \u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u7f16\u53f7\u200b\uff0c\u200b\u5f02\u5e38\u200b\u70b9\u4e3a\u200b 1\uff0c\u200b\u6b63\u5e38\u200b\u70b9\u4e3a\u200b 0\u3002 label"},{"location":"module_usage/instructions/config_parameters_time_series.html#_4","title":"\u65f6\u5e8f\u200b\u5206\u7c7b","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b target_cols str \u200b\u7528\u4e8e\u200b\u5224\u522b\u200b\u7c7b\u522b\u200b\u7684\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b dim_0,dim_1,dim_2 freq str or int \u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\u3002 1 group_id str \u200b\u4e00\u4e2a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u8868\u793a\u200b\u7684\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65f6\u5e8f\u200b\u6837\u672c\u200b\uff0c\u200b\u76f8\u540c\u200b\u7f16\u53f7\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u7ec4\u6210\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u6307\u5b9a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b, \u200b\u5982\u200b\uff1agroup_id\u3002 group_id static_cov_cols str \u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u7684\u200b\u7c7b\u522b\u200b\u7f16\u53f7\u200b\u5217\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u6807\u7b7e\u200b\u76f8\u540c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u7c7b\u522b\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u5982\u200b\uff1alabel\u3002 label"},{"location":"module_usage/instructions/config_parameters_time_series.html#evaluate","title":"Evaluate","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd"},{"location":"module_usage/instructions/config_parameters_time_series.html#export","title":"Export","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b weight_path str \u200b\u5bfc\u51fa\u200b\u6a21\u578b\u200b\u7684\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd"},{"location":"module_usage/instructions/config_parameters_time_series.html#predict","title":"Predict","text":"\u53c2\u6570\u200b\u540d\u200b \u200b\u6570\u636e\u7c7b\u578b\u200b \u200b\u63cf\u8ff0\u200b \u200b\u9ed8\u8ba4\u503c\u200b batch_size int \u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u6279\u200b\u5927\u5c0f\u200b model_dir str \u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b \u200b\u9ed8\u8ba4\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u672c\u5730\u200b\u63a8\u7406\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u6307\u5b9a\u200b\u4e3a\u200bNone\u200b\u65f6\u200b\uff0c\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u5b98\u65b9\u200b\u6743\u91cd\u200b input str \u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84\u200b yaml\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6307\u5b9a\u200b\u7684\u200b\u9884\u6d4b\u200b\u8f93\u5165\u200b\u8def\u5f84"},{"location":"module_usage/instructions/model_python_API.html","title":"PaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200bPython\u200b\u811a\u672c\u200b\u8fdb\u884c\u200b\u5355\u200b\u6a21\u578b\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"module_usage/instructions/model_python_API.html#_1","title":"\u4e00\u200b\u3001\u200b\u4f7f\u7528\u200b\u793a\u4f8b","text":"

\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e09\u6b65\u200b\uff1a

  • \u200b\u8c03\u7528\u200bcreate_model()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u8c03\u7528\u200bprint()\u3001save_to_xxx()\u200b\u7b49\u200b\u76f8\u5173\u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316\u200b\u6216\u662f\u200b\u4fdd\u5b58\u200b\u3002
"},{"location":"module_usage/instructions/model_python_API.html#api","title":"\u4e8c\u200b\u3001API\u200b\u8bf4\u660e","text":""},{"location":"module_usage/instructions/model_python_API.html#1-create_model","title":"1. \u200b\u8c03\u7528\u200bcreate_model()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61","text":"
  • create_model\uff1a\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • model_name\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u6a21\u578b\u200b\u540d\u200b\u6216\u662f\u200b\u672c\u5730\u200binference\u200b\u6a21\u578b\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u201cPP-LCNet_x1_0\u201d\u3001\u201c/path/to/PP-LCNet_x1_0_infer/\u201d\uff1b
    • device\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff0c\u200b\u5982\u4e3a\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u53ef\u4ee5\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u201ccpu\u201d\u3001\u201cgpu:2\u201d\uff1b
    • pp_option\uff1aPaddlePredictorOption \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aBasePredictor\u200b\u7c7b\u578b\u200b\u3002
"},{"location":"module_usage/instructions/model_python_API.html#2-predict","title":"2. \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b","text":"
  • predict\uff1a\u200b\u4f7f\u7528\u200b\u5b9a\u4e49\u200b\u7684\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5bf9\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • input\uff1a\u200b\u4efb\u610f\u200b\u7c7b\u578b\u200b\uff0c\u200b\u652f\u6301\u200bstr\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6216\u662f\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6587\u4ef6\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u6216\u662f\u200b\u7f51\u7edc\u200bURL\uff1b\u200b\u5bf9\u4e8e\u200bCV\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\uff1b\u200b\u5bf9\u4e8e\u200bTS\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200bpandas.DataFrame\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff1b\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6240\u200b\u6784\u6210\u200b\u7684\u200blist\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1agenerator\uff0c\u200b\u6bcf\u6b21\u200b\u8c03\u7528\u200b\u8fd4\u56de\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
"},{"location":"module_usage/instructions/model_python_API.html#3","title":"3. \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316","text":"

\u200b\u6a21\u578b\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u652f\u6301\u200b\u8bbf\u95ee\u200b\u3001\u200b\u53ef\u89c6\u5316\u200b\u53ca\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u76f8\u5e94\u200b\u7684\u200b\u5c5e\u6027\u200b\u6216\u200b\u65b9\u6cd5\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"module_usage/instructions/model_python_API.html#_2","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • str\uff1astr \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bstr\u200b\u8868\u793a\u200b\uff1b
  • json\uff1ajson\u200b\u683c\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1adict \u200b\u7c7b\u578b\u200b\uff1b
  • img\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u56fe\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aPIL.Image \u200b\u7c7b\u578b\u200b\uff1b
  • html\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bHTML\u200b\u8868\u793a\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff1b
"},{"location":"module_usage/instructions/model_python_API.html#_3","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • print()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8f93\u51fa\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e0d\u200b\u4fbf\u4e8e\u200b\u76f4\u63a5\u200b\u8f93\u51fa\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u7701\u7565\u200b\u76f8\u5173\u200b\u5185\u5bb9\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • json_format\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4f7f\u7528\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u8f93\u51fa\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_json()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5305\u542b\u200b\u65e0\u6cd5\u200bjson\u200b\u5e8f\u5217\u5316\u200b\u7684\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u8fdb\u884c\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4ee5\u200b\u5b9e\u73b0\u200b\u5e8f\u5217\u5316\u200b\u4fdd\u5b58\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_img()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_csv()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bCSV\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_html()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bHTML\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_xlsx()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bXLSX\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
"},{"location":"module_usage/instructions/model_python_API.html#4","title":"4. \u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e","text":"

PaddleX \u200b\u652f\u6301\u200b\u901a\u8fc7\u200bPaddlePredictorOption\u200b\u8bbe\u7f6e\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u76f8\u5173\u200bAPI\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"module_usage/instructions/model_python_API.html#_4","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • deivce\uff1a\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u53ca\u200b\u5361\u53f7\u200b\uff0c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'gpu', 'cpu', 'npu', 'xpu', 'mlu'\uff0c\u200b\u5f53\u200b\u4f7f\u7528\u200b\u52a0\u901f\u5361\u200b\u65f6\u200b\uff0c\u200b\u652f\u6301\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u4f7f\u7528\u200b 0 \u200b\u53f7\u200b gpu\uff1a'gpu:0'\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'gpu:0'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002
  • run_mode\uff1a\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'paddle'\uff0c'trt_fp32'\uff0c'trt_fp16'\uff0c'trt_int8'\uff0c'mkldnn'\uff0c'mkldnn_bf16'\uff0c\u200b\u5176\u4e2d\u200b 'mkldnn' \u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u53ef\u9009\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'paddle'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u3002
  • cpu_threads\uff1acpu \u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b int \u200b\u7c7b\u578b\u200b\uff0ccpu \u200b\u63a8\u7406\u200b\u65f6\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aint \u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\u3002
"},{"location":"module_usage/instructions/model_python_API.html#_5","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • get_support_run_mode\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\u3002
  • get_support_device\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3002
  • get_device\uff1a\u200b\u83b7\u53d6\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html","title":"\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u662f\u200b\u4e00\u79cd\u200b\u5728\u200b\u6ca1\u6709\u200b\u6807\u7b7e\u200b\u6216\u200b\u5c11\u91cf\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u548c\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u4e0e\u200b\u5927\u591a\u6570\u200b\u6570\u636e\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u5f02\u5e38\u200b\u6216\u200b\u7f55\u89c1\u200b\u6837\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u8fd9\u79cd\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u8d28\u91cf\u200b\u63a7\u5236\u200b\u3001\u200b\u533b\u7597\u200b\u8bca\u65ad\u200b\u7b49\u200b\u591a\u4e2a\u200b\u9886\u57df\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ROCAUC\uff08Avg\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b STFPM\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.962 22.5 \u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u7531\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6559\u5e08\u200b\u7f51\u7edc\u200b\u548c\u200b\u7ed3\u6784\u200b\u76f8\u540c\u200b\u7684\u200b\u5b66\u751f\u200b\u7f51\u7edc\u200b\u7ec4\u6210\u200b\u3002\u200b\u5b66\u751f\u200b\u7f51\u7edc\u200b\u901a\u8fc7\u200b\u5c06\u200b\u81ea\u8eab\u200b\u7279\u5f81\u200b\u4e0e\u200b\u6559\u5e08\u200b\u7f51\u7edc\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u7279\u5f81\u200b\u76f8\u5339\u914d\u200b\u6765\u200b\u68c0\u6d4b\u200b\u5f02\u5e38\u200b\u3002

\u200b\u4ee5\u4e0a\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b MVTec_AD \u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002 \u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"STFPM\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"uad_grid.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleSeg\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bDemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mvtec_examples.tar -P ./dataset\ntar -xf ./dataset/mvtec_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"train_samples\": 264,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"val_samples\": 57,\n    \"num_classes\": 231\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mvtec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 264\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 57\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bSTFPM\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSTFPM.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSTFPM.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u8bb0\u5f55\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b IoU / Precision / Recall\uff1b

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff0c\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"uad_grid.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSTFPM.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/anomaly_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html","title":"\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u4e00\u9879\u200b\u57fa\u672c\u200b\u4efb\u52a1\u200b\uff0c\u200b\u65e8\u5728\u200b\u4ece\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u5e76\u200b\u5b9a\u4f4d\u200b\u4eba\u8138\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5927\u5c0f\u200b\u3002\u200b\u5b83\u200b\u662f\u200b\u4eba\u8138\u8bc6\u522b\u200b\u3001\u200b\u4eba\u8138\u200b\u5206\u6790\u200b\u7b49\u200b\u540e\u7eed\u200b\u4efb\u52a1\u200b\u7684\u200b\u524d\u63d0\u200b\u548c\u200b\u57fa\u7840\u200b\u3002\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u901a\u8fc7\u200b\u6784\u5efa\u200b\u6df1\u5ea6\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b66\u4e60\u200b\u4eba\u8138\u200b\u7684\u200b\u7279\u5f81\u200b\u8868\u793a\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u51c6\u786e\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AP (%)Easy/Medium/Hard GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b BlazeFace\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.7/73.4/49.5 0.447 \u200b\u8f7b\u91cf\u200b\u9ad8\u6548\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b BlazeFace-FPN-SSH\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.2/80.5/60.5 0.606 BlazeFace\u200b\u7684\u200b\u6539\u8fdb\u200b\u6a21\u578b\u200b\uff0c\u200b\u589e\u52a0\u200bFPN\u200b\u548c\u200bSSH\u200b\u7ed3\u6784\u200b PicoDet_LCNet_x2_5_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.7/90.7/68.1 28.9 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.9/91.8/79.8 26.5 \u200b\u57fa\u4e8e\u200bPP-YOLOE_plus-S\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5728\u200bWIDER-FACE\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\uff0c\u200b\u4ee5\u200b640*640\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u5c3a\u5bf8\u200b\u8bc4\u4f30\u200b\u5f97\u5230\u200b\u7684\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PicoDet_LCNet_x2_5_face\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_detection.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerface_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerface_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_849.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_Parade_0_904.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_799.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_384.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_538.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_429.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerface_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPicoDet_LCNet_x2_5_face\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet_LCNet_x2_5_face.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet_LCNet_x2_5_face.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff0c\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_detection.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet_LCNet_x2_5_face.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/face_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u4eba\u8138\u8bc6\u522b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html","title":"\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4ee5\u200b\u7ecf\u8fc7\u200b\u68c0\u6d4b\u200b\u63d0\u53d6\u200b\u548c\u200b\u5173\u952e\u70b9\u200b\u77eb\u6b63\u200b\u5904\u7406\u200b\u7684\u200b\u6807\u51c6\u5316\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u4ece\u200b\u8fd9\u4e9b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u5177\u6709\u200b\u9ad8\u5ea6\u200b\u8fa8\u8bc6\u200b\u6027\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4f9b\u200b\u540e\u7eed\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\uff0c\u200b\u5982\u200b\u4eba\u8138\u200b\u5339\u914d\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u7b49\u200b\u4efb\u52a1\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8f93\u51fa\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b AP (%)AgeDB-30/CFP-FP/LFW GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b MobileFaceNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 128 96.28/96.71/99.58 4.1 \u200b\u57fa\u4e8e\u200bMobileFaceNet\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b ResNet50_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 512 98.12/98.56/99.77 87.2 \u200b\u57fa\u4e8e\u200bResNet50\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5206\u522b\u200b\u5728\u200bAgeDB-30\u3001CFP-FP\u200b\u548c\u200bLFW\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u6d4b\u5f97\u200b\u7684\u200bAccuracy\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"MobileFaceNet\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_recognition_001.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleClas\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u91c7\u53d6\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7ec4\u7ec7\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u8bf7\u200b\u6ce8\u610f\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u4e0e\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65b9\u5f0f\u200b\u6709\u6240\u4e0d\u540c\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b4.1.4\u200b\u8282\u200b \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u96c6\u200b\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_rec_examples.tar -P ./dataset\ntar -xf ./dataset/face_rec_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_label_file\": \"../../dataset/face_rec_examples/train/label.txt\",\n    \"train_num_classes\": 995,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/01378592.jpg\",\n      \"check_dataset/demo_img/04331410.jpg\",\n      \"check_dataset/demo_img/03485713.jpg\",\n      \"check_dataset/demo_img/02382123.jpg\",\n      \"check_dataset/demo_img/01722397.jpg\",\n      \"check_dataset/demo_img/02682349.jpg\",\n      \"check_dataset/demo_img/00272794.jpg\",\n      \"check_dataset/demo_img/03151987.jpg\",\n      \"check_dataset/demo_img/01725764.jpg\",\n      \"check_dataset/demo_img/02580369.jpg\"\n    ],\n    \"val_label_file\": \"../../dataset/face_rec_examples/val/pair_label.txt\",\n    \"val_num_classes\": 2,\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/Don_Carcieri_0001.jpg\",\n      \"check_dataset/demo_img/Eric_Fehr_0001.jpg\",\n      \"check_dataset/demo_img/Harry_Kalas_0001.jpg\",\n      \"check_dataset/demo_img/Francis_Ford_Coppola_0001.jpg\",\n      \"check_dataset/demo_img/Amer_al-Saadi_0001.jpg\",\n      \"check_dataset/demo_img/Sergei_Ivanov_0001.jpg\",\n      \"check_dataset/demo_img/Erin_Runnion_0003.jpg\",\n      \"check_dataset/demo_img/Bill_Stapleton_0001.jpg\",\n      \"check_dataset/demo_img/Daniel_Bruehl_0001.jpg\",\n      \"check_dataset/demo_img/Clare_Short_0004.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/face_rec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 995\uff1b
  • attributes.val_num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 2\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e0e\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#414","title":"4.1.4 \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u96c6\u200b\u7ec4\u7ec7\u200b\u65b9\u5f0f","text":"

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u4e0e\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u4e0d\u540c\u200b\uff0c\u200b\u82e5\u200b\u9700\u8981\u200b\u5728\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u4e0a\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u548c\u200b\u8bc4\u4f30\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u7ec4\u7ec7\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff1a

face_rec_dataroot      # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 train              # \u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n   \u251c\u2500\u2500 images          # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200blabel.txt\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      ...\n   \u2514\u2500\u2500 label.txt       # \u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u56fe\u50cf\u200b\u76f8\u5bf9\u200b`train`\u200b\u7684\u200b\u8def\u5f84\u200b\u548c\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\uff08\u200b\u4eba\u8138\u200b\u8eab\u4efd\u200b\uff09id\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/image_06765.jpg 0\n\u251c\u2500\u2500 val                # \u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u4e0d\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n   \u251c\u2500\u2500 images          # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\uff0c\u200b\u4f46\u200b\u8981\u200b\u6ce8\u610f\u200b\u4e0e\u200bpari_label.txt\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u5bf9\u5e94\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      \u251c\u2500\u2500 xxx.jpg      # \u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\n      ...\n   \u2514\u2500\u2500 pair_label.txt  # \u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u4e24\u4e2a\u200b\u8981\u200b\u6bd4\u200b\u5bf9\u200b\u7684\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u4e00\u4e2a\u200b\u8868\u793a\u200b\u8be5\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u662f\u5426\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u4eba\u200b\u7684\u200b0\u30011\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\u3002\n

\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200bpair_label.txt\u200b\u7684\u200b\u5185\u5bb9\u200b\u793a\u4f8b\u200b:

# \u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b1.jpg \u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b2.jpg \u200b\u6807\u7b7e\u200b(0\u200b\u8868\u793a\u200b\u8be5\u884c\u200b\u7684\u200b\u4e24\u4e2a\u200b\u4eba\u8138\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u4e0d\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u4eba\u200b\uff0c1\u200b\u8868\u793a\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u4e2a\u200b\u4eba\u200b)\nimages/Angela_Merkel_0001.jpg images/Angela_Merkel_0002.jpg 1\nimages/Bruce_Gebhardt_0001.jpg images/Masao_Azuma_0001.jpg 0\nimages/Francis_Ford_Coppola_0001.jpg images/Francis_Ford_Coppola_0002.jpg 1\nimages/Jason_Kidd_0006.jpg images/Jason_Kidd_0008.jpg 1\nimages/Miyako_Miyazaki_0002.jpg images/Munir_Akram_0002.jpg 0\n
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bMobileFaceNet\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bMobileFaceNet.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bMobileFaceNet.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Accuracy\uff1b

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff0c\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_recognition_001.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bMobileFaceNet.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/face_feature.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u4eba\u8138\u8bc6\u522b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5206\u652f\u200b\u4efb\u52a1\u200b\uff0c\u200b\u6307\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\u6765\u200b\u5224\u65ad\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u662f\u5426\u200b\u5b58\u5728\u200b\u884c\u4eba\u200b\uff0c\u200b\u5e76\u200b\u7ed9\u51fa\u200b\u6bcf\u4e2a\u200b\u884c\u4eba\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u4fe1\u606f\u200b\u5bf9\u4e8e\u200b\u667a\u80fd\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u3001\u200b\u4eba\u4f53\u200b\u884c\u4e3a\u200b\u5206\u6790\u200b\u3001\u200b\u667a\u80fd\u200b\u9a7e\u9a76\u200b\u3001\u200b\u667a\u80fd\u200b\u673a\u5668\u4eba\u200b\u7b49\u200b\u591a\u79cd\u200b\u5e94\u7528\u200b\u81f3\u5173\u91cd\u8981\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-L_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 48.0 81.9 32.8 777.7 196.02 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-S_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.5 77.9 15.0 179.3 28.79

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCrowdHuman\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_human\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"human_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerperson_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerperson_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000041.jpg\",\n      \"check_dataset/demo_img/000042.jpg\",\n      \"check_dataset/demo_img/000044.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/001138.jpg\",\n      \"check_dataset/demo_img/001140.jpg\",\n      \"check_dataset/demo_img/001141.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerperson_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b500\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-YOLOE-S_human\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_human.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_human.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"human_detection.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_human.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/human_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5bf9\u200b\u8f93\u5165\u200b\u7684\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u63a5\u6536\u200b\u56fe\u50cf\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u7136\u540e\u200b\u901a\u8fc7\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6216\u200b\u5176\u4ed6\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u6839\u636e\u200b\u56fe\u50cf\u200b\u7684\u200b\u7279\u6027\u200b\u548c\u200b\u5185\u5bb9\u200b\uff0c\u200b\u5c06\u200b\u5176\u200b\u5206\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u4e00\u4e2a\u200b\u52a8\u7269\u200b\u8bc6\u522b\u7cfb\u7edf\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u5c06\u200b\u8f93\u5165\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u732b\u200b\u201d\u3001\u201c\u200b\u72d7\u200b\u201d\u3001\u201c\u200b\u9a6c\u200b\u201d\u200b\u7b49\u200b\u7c7b\u522b\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u5206\u7c7b\u200b\u7ed3\u679c\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u51fa\u200b\uff0c\u200b\u4f9b\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\u6216\u200b\u7cfb\u7edf\u200b\u4f7f\u7528\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b9\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b80\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M CLIP\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u89c6\u89c9\u200b\u548c\u200b\u8bed\u8a00\u200b\u76f8\u5173\u8054\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u91c7\u7528\u200b\u5bf9\u6bd4\u200b\u5b66\u4e60\u200b\u548c\u200b\u9884\u200b\u8bad\u7ec3\u65b9\u6cd5\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u65e0\u200b\u76d1\u7763\u200b\u6216\u5f31\u200b\u76d1\u7763\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u5c24\u5176\u200b\u9002\u7528\u200b\u4e8e\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u5c06\u200b\u56fe\u50cf\u200b\u548c\u200b\u6587\u672c\u200b\u6620\u5c04\u200b\u5230\u200b\u540c\u4e00\u200b\u8868\u793a\u200b\u7a7a\u95f4\u200b\uff0c\u200b\u5b66\u4e60\u200b\u5230\u200b\u901a\u7528\u200b\u7279\u5f81\u200b\uff0c\u200b\u5177\u6709\u200b\u826f\u597d\u200b\u7684\u200b\u6cdb\u5316\u200b\u80fd\u529b\u200b\u548c\u200b\u89e3\u91ca\u6027\u200b\u3002\u200b\u5176\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8bad\u7ec3\u200b\u8bef\u5dee\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 CLIP_vit_large_patch14_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.84 12.8473 1513.87 313.9 M ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200bMeta\u200b\u5728\u200b2022\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u57fa\u4e8e\u200bCNN\u200b\u67b6\u6784\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200bResNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u901a\u8fc7\u200b\u501f\u9274\u200bSwinTransformer\u200b\u7684\u200b\u4f18\u70b9\u200b\u8bbe\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u8bad\u7ec3\u200b\u7b56\u7565\u200b\u548c\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7684\u200b\u4f18\u5316\u200b\u601d\u8def\u200b\uff0c\u200b\u4ece\u800c\u200b\u6539\u8fdb\u200b\u7684\u200b\u7eaf\u200bCNN\u200b\u67b6\u6784\u200b\u7f51\u7edc\u200b\uff0c\u200b\u63a2\u7d22\u200b\u4e86\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u6027\u80fd\u200b\u4e0a\u9650\u200b\u3002ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u5177\u5907\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u8bf8\u591a\u200b\u4f18\u70b9\u200b\uff0c\u200b\u5305\u62ec\u200b\u63a8\u7406\u200b\u6548\u7387\u9ad8\u200b\u548c\u200b\u6613\u4e8e\u200b\u8fc1\u79fb\u200b\u5230\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u7b49\u200b\u3002 ConvNeXt_base_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.27 66.4058 6598.92 700.7 M ConvNeXt_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.13 9.74075 1127.6 178.0 M ConvNeXt_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.03 5.48923 672.559 104.1 M FasterNet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.5 23.4415 - 357.1 M FasterNet\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e8\u5728\u200b\u63d0\u9ad8\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u7684\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u6539\u8fdb\u200b\u70b9\u200b\u4e3b\u8981\u200b\u5982\u4e0b\u200b\uff1a 1.\u200b\u91cd\u65b0\u200b\u5ba1\u89c6\u200b\u4e86\u200b\u6d41\u884c\u200b\u7684\u200b\u8fd0\u7b97\u7b26\u200b\uff0c\u200b\u53d1\u73b0\u200b\u4f4e\u200bFLOPS\u200b\u4e3b\u8981\u200b\u6765\u81ea\u200b\u4e8e\u200b\u8fd0\u7b97\u200b\u9891\u7e41\u200b\u7684\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\uff0c\u200b\u7279\u522b\u200b\u662f\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff1b 2.\u200b\u63d0\u51fa\u200b\u4e86\u200b\u90e8\u5206\u200b\u5377\u79ef\u200b(PConv)\uff0c\u200b\u901a\u8fc7\u200b\u51cf\u5c11\u200b\u5197\u4f59\u200b\u8ba1\u7b97\u200b\u548c\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\u6765\u200b\u66f4\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff1b 3.\u200b\u57fa\u4e8e\u200bPConv\u200b\u63a8\u51fa\u200b\u4e86\u200bFasterNet\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u8bbe\u8ba1\u65b9\u6848\u200b\uff0c\u200b\u5728\u200b\u4e0d\u200b\u5f71\u54cd\u200b\u6a21\u578b\u200b\u4efb\u52a1\u200b\u6027\u80fd\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5728\u200b\u5404\u79cd\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u663e\u8457\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u3002 FasterNet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.0 21.8936 - 204.6 M FasterNet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.3 13.0409 - 119.3 M FasterNet-T0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.9 12.2432 - 15.1 M FasterNet-T1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.9 11.3562 - 29.2 M FasterNet-T2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.703 - 57.4 M MobileNetV1_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.5 1.86754 7.48297 4.8 M MobileNetV1\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2017\u200b\u5e74\u200b\u53d1\u5e03\u200b\u7684\u200b\u7528\u4e8e\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u200b\u6216\u200b\u5d4c\u5165\u5f0f\u200b\u8bbe\u5907\u200b\u4e2d\u200b\u7684\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5c06\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u64cd\u4f5c\u200b\u62c6\u89e3\u200b\u6210\u200b\u6df1\u5ea6\u200b\u53ef\u200b\u5206\u79bb\u200b\u5377\u79ef\u200b\uff0c\u200b\u5373\u200bDepthwise\u200b\u5377\u79ef\u200b\u548c\u200bPointwise\u200b\u5377\u79ef\u200b\u7684\u200b\u7ec4\u5408\u200b\u3002\u200b\u76f8\u6bd4\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7ec4\u5408\u200b\u53ef\u4ee5\u200b\u5927\u5927\u200b\u8282\u7701\u200b\u53c2\u200b\u6570\u91cf\u200b\u548c\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u3002\u200b\u540c\u65f6\u200b\u8be5\u200b\u7f51\u7edc\u200b\u53ef\u4ee5\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7b49\u200b\u5176\u4ed6\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u3002 MobileNetV1_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.0 4.94234 11.1629 7.1 M MobileNetV2\u200b\u662f\u200bGoogle\u200b\u7ee7\u200bMobileNetV1\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u76f8\u6bd4\u200bMobileNetV1\uff0cMobileNetV2\u200b\u63d0\u51fa\u200b\u4e86\u200bLinear bottlenecks\u200b\u4e0e\u200bInverted residual block\u200b\u4f5c\u4e3a\u200b\u7f51\u7edc\u200b\u57fa\u672c\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u91cf\u200b\u5730\u200b\u5806\u53e0\u200b\u8fd9\u4e9b\u200b\u57fa\u672c\u200b\u6a21\u5757\u200b\uff0c\u200b\u6784\u6210\u200b\u4e86\u200bMobileNetV2\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u3002\u200b\u6700\u540e\u200b\uff0c\u200b\u5728\u200bFLOPs\u200b\u53ea\u6709\u200bMobileNetV1\u200b\u7684\u200b\u4e00\u534a\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\u53d6\u5f97\u200b\u4e86\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u5206\u7c7b\u200b\u7cbe\u5ea6\u200b\u3002 MobileNetV2_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 69.2 6.31302 14.5588 9.6 M MobileNetV3\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2019\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bNAS\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u4e3a\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\uff0c\u200b\u5c06\u200brelu\u200b\u548c\u200bsigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\u5206\u522b\u200b\u66ff\u6362\u200b\u4e3a\u200bhard_swish\u200b\u4e0e\u200bhard_sigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\uff0c\u200b\u540c\u65f6\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u4e9b\u200b\u4e13\u95e8\u200b\u4e3a\u200b\u51cf\u5c11\u200b\u7f51\u7edc\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u7684\u200b\u6539\u8fdb\u200b\u7b56\u7565\u200b\u3002 MobileNetV3_large_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.4 12.5485 51.6453 125.2 M MobileNetV4\u200b\u662f\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u8bbe\u8ba1\u200b\u7684\u200b\u9ad8\u6548\u200b\u67b6\u6784\u200b\u3002\u200b\u5176\u200b\u6838\u5fc3\u200b\u5728\u4e8e\u200b\u5f15\u5165\u200b\u4e86\u200bUIB\uff08Universal Inverted Bottleneck\uff09\u200b\u6a21\u5757\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u7edf\u4e00\u200b\u4e14\u200b\u7075\u6d3b\u200b\u7684\u200b\u7ed3\u6784\u200b\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bIB\uff08Inverted Bottleneck\uff09\u3001ConvNeXt\u3001FFN\uff08Feed Forward Network\uff09\u200b\u4ee5\u53ca\u200b\u6700\u65b0\u200b\u7684\u200bExtraDW\uff08Extra Depthwise\uff09\u200b\u6a21\u5757\u200b\u3002\u200b\u4e0e\u200bUIB\u200b\u540c\u65f6\u200b\u63a8\u51fa\u200b\u7684\u200b\u8fd8\u6709\u200bMobile MQA\uff0c\u200b\u8fd9\u200b\u662f\u200b\u79cd\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u52a0\u901f\u5668\u200b\u5b9a\u5236\u200b\u7684\u200b\u6ce8\u610f\u529b\u200b\u5757\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b\u9ad8\u200b\u8fbe\u200b39%\u200b\u7684\u200b\u663e\u8457\u200b\u52a0\u901f\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cMobileNetV4\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u795e\u7ecf\u200b\u67b6\u6784\u200b\u641c\u7d22\u200b\uff08Neural Architecture Search, NAS\uff09\u200b\u65b9\u6848\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u641c\u7d22\u200b\u7684\u200b\u6709\u6548\u6027\u200b\u3002 MobileNetV4_conv_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.5 19.7543 62.2624 42.9 M PP-HGNet_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.0 14.2969 327.114 249.4 M PP-HGNet\uff08High Performance GPU Net\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u9002\u7528\u200b\u4e8e\u200bGPU\u200b\u5e73\u53f0\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u7ed3\u5408\u200bVOVNet\u200b\u7684\u200b\u57fa\u7840\u200b\u51fa\u200b\u4f7f\u7528\u200b\u4e86\u200b\u53ef\u200b\u5b66\u4e60\u200b\u7684\u200b\u4e0b\u200b\u91c7\u6837\u200b\u5c42\u200b\uff08LDS Layer\uff09\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bResNet_vd\u3001PPHGNet\u200b\u7b49\u200b\u6a21\u578b\u200b\u7684\u200b\u4f18\u70b9\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200bGPU\u200b\u5e73\u53f0\u200b\u4e0a\u200b\u4e0e\u200b\u5176\u4ed6\u200bSOTA\u200b\u6a21\u578b\u200b\u5728\u200b\u76f8\u540c\u200b\u7684\u200b\u901f\u5ea6\u200b\u4e0b\u200b\u6709\u7740\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u5728\u200b\u540c\u7b49\u200b\u901f\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u9ad8\u4e8e\u200bResNet34-0\u200b\u6a21\u578b\u200b3.8\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u9ad8\u4e8e\u200bResNet50-0\u200b\u6a21\u578b\u200b2.4\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u5728\u200b\u4f7f\u7528\u200b\u76f8\u540c\u200b\u7684\u200bSLSD\u200b\u6761\u6b3e\u200b\u4e0b\u200b\uff0c\u200b\u6700\u7ec8\u200b\u8d85\u8d8a\u200b\u4e86\u200bResNet50-D\u200b\u6a21\u578b\u200b4.7\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\u3002\u200b\u4e0e\u6b64\u540c\u65f6\u200b\uff0c\u200b\u5728\u200b\u76f8\u540c\u200b\u7cbe\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u5176\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e5f\u200b\u8fdc\u8d85\u200b\u4e3b\u6d41\u200bVisionTransformer\u200b\u7684\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNet_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2\uff08High Performance GPU Network V2\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7684\u200bPP-HGNet\u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPP-HGNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u5176\u200b\u5728\u200bNVIDIA\u200b\u53d1\u5e03\u200b\u7684\u200b\u201cAccuracy-Latency Balance\u201d\u200b\u505a\u5230\u200b\u4e86\u200b\u6781\u81f4\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u4e86\u200b\u5176\u4ed6\u200b\u540c\u6837\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u6bcf\u79cd\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8003\u6807\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u5f3a\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 PP-HGNetV2-B1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.14 3.67722 6.66857 6.7 M PP-LCNet\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u5b83\u200b\u80fd\u200b\u5728\u200b\u4e0d\u200b\u589e\u52a0\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\uff0c\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u5176\u4ed6\u200b\u8f7b\u91cf\u7ea7\u200bSOTA\u200b\u6a21\u578b\u200b\u3002 PP-LCNet_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.05 5.23428 19.6005 23.7 M PP-LCNetV2 \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b PP-LCNet \u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200b PP-LCNet \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u4e3b\u8981\u200b\u4f7f\u7528\u200b\u91cd\u200b\u53c2\u6570\u200b\u5316\u200b\u7b56\u7565\u200b\u7ec4\u5408\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5927\u5c0f\u200b\u5377\u79ef\u200b\u6838\u200b\u7684\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff0c\u200b\u5e76\u200b\u4f18\u5316\u200b\u4e86\u200b\u70b9\u200b\u5377\u79ef\u200b\u3001Shortcut\u200b\u7b49\u200b\u3002\u200b\u5728\u200b\u4e0d\u200b\u4f7f\u7528\u200b\u989d\u5916\u200b\u6570\u636e\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0cPPLCNetV2_base \u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b ImageNet \u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u80fd\u591f\u200b\u53d6\u5f97\u200b\u8d85\u8fc7\u200b 77% \u200b\u7684\u200b Top1 Acc\uff0c\u200b\u540c\u65f6\u200b\u5728\u200b Intel CPU \u200b\u5e73\u53f0\u200b\u7684\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u5728\u200b 4.4 ms \u200b\u4ee5\u4e0b\u200b PP-LCNetV2_large \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.97 3.89762 13.0273 14.6 M ResNet18_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.3 3.53048 31.3014 41.5 M ResNet \u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200b 2015 \u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\uff0c\u200b\u4e00\u4e3e\u200b\u5728\u200b ILSVRC2015 \u200b\u6bd4\u8d5b\u200b\u4e2d\u200b\u53d6\u5f97\u200b\u51a0\u519b\u200b\uff0ctop5 \u200b\u9519\u8bef\u7387\u200b\u4e3a\u200b 3.57%\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u521b\u65b0\u6027\u200b\u7684\u200b\u63d0\u51fa\u200b\u4e86\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5806\u53e0\u200b\u591a\u4e2a\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\u4ece\u800c\u200b\u6784\u5efa\u200b\u4e86\u200b ResNet \u200b\u7f51\u7edc\u200b\u3002\u200b\u5b9e\u9a8c\u200b\u8868\u660e\u200b\u4f7f\u7528\u200b\u6b8b\u5dee\u200b\u5757\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u5730\u200b\u63d0\u5347\u200b\u6536\u655b\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u3002 ResNet18 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.4868 27.4601 41.5 M ResNet34_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.0 5.60675 56.0653 77.3 M ResNet34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 4.16902 51.925 77.3 M ResNet50_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.1885 68.446 90.8 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M ResNet101_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.2 20.0563 124.85 158.4 M ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.6 19.2297 121.006 158.4 M ResNet152_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.6 29.6439 181.678 214.3 M ResNet152\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.3 30.0461 177.707 214.2 M ResNet200_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.9 39.1628 235.185 266.0 M StarNet-S1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.6 9.895 23.0465 11.2 M StarNet \u200b\u805a\u7126\u200b\u4e8e\u200b\u7814\u7a76\u200b\u7f51\u7edc\u200b\u8bbe\u8ba1\u200b\u4e2d\u200b\u201c\u200b\u661f\u200b\u64cd\u4f5c\u200b\u201d\uff08\u200b\u5373\u200b\u5143\u7d20\u200b\u7ea7\u200b\u4e58\u6cd5\u200b\uff09\u200b\u7684\u200b\u672a\u200b\u5f00\u53d1\u200b\u6f5c\u529b\u200b\u3002\u200b\u63ed\u793a\u200b\u661f\u200b\u64cd\u4f5c\u200b\u80fd\u591f\u200b\u5c06\u200b\u8f93\u5165\u200b\u6620\u5c04\u200b\u5230\u200b\u9ad8\u7ef4\u200b\u3001\u200b\u975e\u7ebf\u6027\u200b\u7279\u5f81\u200b\u7a7a\u95f4\u200b\u7684\u200b\u80fd\u529b\u200b\uff0c\u200b\u8fd9\u4e00\u200b\u8fc7\u7a0b\u200b\u7c7b\u4f3c\u200b\u4e8e\u200b\u6838\u200b\u6280\u5de7\u200b\uff0c\u200b\u4f46\u200b\u65e0\u9700\u200b\u6269\u5927\u200b\u7f51\u7edc\u200b\u89c4\u6a21\u200b\u3002\u200b\u56e0\u6b64\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u51fa\u200b\u4e86\u200b StarNet\uff0c\u200b\u4e00\u4e2a\u200b\u7b80\u5355\u200b\u800c\u200b\u5f3a\u5927\u200b\u7684\u200b\u539f\u578b\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5728\u200b\u7d27\u51d1\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u548c\u200b\u6709\u9650\u200b\u7684\u200b\u8ba1\u7b97\u8d44\u6e90\u200b\u4e0b\u200b\uff0c\u200b\u5c55\u73b0\u51fa\u200b\u4e86\u200b\u5353\u8d8a\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u4f4e\u200b\u5ef6\u8fdf\u200b\u3002 StarNet-S2 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.8 7.91279 21.9571 14.3 M StarNet-S3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.0 10.7531 30.7656 22.2 M StarNet-S4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.37 16.9848 383.83 310.5 M SwinTransformer \u200b\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u89c6\u89c9\u200b Transformer \u200b\u7f51\u7edc\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u7528\u4f5c\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u901a\u7528\u200b\u9aa8\u5e72\u7f51\u200b\u8def\u200b\u3002SwinTransformer \u200b\u7531\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\uff08shifted windows\uff09\u200b\u8868\u793a\u200b\u7684\u200b\u5c42\u6b21\u200b Transformer \u200b\u7ed3\u6784\u200b\u7ec4\u6210\u200b\u3002\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\u5c06\u200b\u81ea\u200b\u6ce8\u610f\u200b\u8ba1\u7b97\u200b\u9650\u5236\u200b\u5728\u200b\u975e\u200b\u91cd\u53e0\u200b\u7684\u200b\u5c40\u90e8\u200b\u7a97\u53e3\u200b\u4e0a\u200b\uff0c\u200b\u540c\u65f6\u200b\u5141\u8bb8\u200b\u8de8\u200b\u7a97\u53e3\u200b\u8fde\u63a5\u200b\uff0c\u200b\u4ece\u800c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u7f51\u7edc\u200b\u6027\u80fd\u200b\u3002 SwinTransformer_base_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset\ntar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"dataset/label.txt\",\n    \"num_classes\": 102,\n    \"train_samples\": 1020,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/image_01904.jpg\",\n      \"check_dataset/demo_img/image_06940.jpg\"\n    ],\n    \"val_samples\": 1020,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/image_01937.jpg\",\n      \"check_dataset/demo_img/image_06958.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/cls_flowers_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 102\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1020\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1020\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0.yaml,\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c  paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b val.top1\u3001val.top5\uff1b

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_classification_001.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/image_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u7684\u200b\u4e00\u9879\u200b\u91cd\u8981\u200b\u4efb\u52a1\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u4e3b\u8981\u200b\u6307\u200b\u7684\u200b\u662f\u200b\u901a\u8fc7\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u65b9\u6cd5\u200b\u81ea\u52a8\u200b\u4ece\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u6709\u7528\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e8e\u200b\u540e\u7eed\u200b\u7684\u200b\u56fe\u50cf\u200b\u68c0\u7d22\u200b\u4efb\u52a1\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u540e\u7eed\u200b\u4efb\u52a1\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u5728\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4e2d\u200b\uff0c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u4e00\u7ec4\u200b\u7279\u5f81\u5411\u91cf\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u5411\u91cf\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u5730\u200b\u8868\u793a\u200b\u56fe\u50cf\u200b\u7684\u200b\u5185\u5bb9\u200b\u3001\u200b\u7ed3\u6784\u200b\u3001\u200b\u7eb9\u7406\u200b\u7b49\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u540e\u7eed\u200b\u7684\u200b\u68c0\u7d22\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b recall@1 (%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2\u200b\u662f\u200b\u4e00\u4e2a\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7531\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u7279\u5f81\u63d0\u53d6\u200b\u3001\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\u6784\u6210\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u662f\u200b\u5176\u4e2d\u200b\u7684\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u7cfb\u7edf\u200b\u7684\u200b\u60c5\u51b5\u200b\u9009\u62e9\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u578b\u200b\u3002 PP-ShiTuV2_rec_CLIP_vit_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.03 51.1284 1131.28 1.05 G

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-ShiTuV2_rec\")\noutput = model.predict(\"general_image_recognition_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX\u200b\u7684\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/Inshop_examples.tar -P ./dataset\ntar -xf ./dataset/Inshop_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/05_1_front.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/04_2_side.jpg\",\n      \"check_dataset/demo_img/12_1_front.jpg\",\n      \"check_dataset/demo_img/07_2_side.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/01_1_front.jpg\"\n    ],\n    \"gallery_samples\": 110,\n    \"gallery_sample_paths\": [\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/01_4_full.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/03_4_full.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\",\n      \"check_dataset/demo_img/03_2_side.jpg\"\n    ],\n    \"query_samples\": 125,\n    \"query_sample_paths\": [\n      \"check_dataset/demo_img/08_7_additional.jpg\",\n      \"check_dataset/demo_img/01_7_additional.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/09_7_additional.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/02_7_additional.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/Inshop_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ShiTuRecDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1000\uff1b
  • attributes.gallery_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 110\uff1b
  • attributes.query_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 125\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.gallery_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.query_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u67e5\u8be2\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u56fe\u50cf\u200b\u6570\u91cf\u200b\u548c\u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u652f\u6301\u200b LabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ShiTuRecDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4efb\u52a1\u200b\u652f\u6301\u200b LabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ShiTuRecDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b LabelMe \uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200bLabelMe\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b ShiTuRecDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c  paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b gallery_percent \u3001query_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b70%\u3001\u200b\u88ab\u200b\u67e5\u8be2\u200b\u6570\u636e\u200b\u96c6\u5360\u200b\u6bd4\u200b20%\uff0c\u200b\u67e5\u8be2\u200b\u6570\u636e\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 70\n    gallery_percent: 20\n    query_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=70 \\\n    -o CheckDataset.split.gallery_percent=20 \\\n    -o CheckDataset.split.query_percent=10\n

\u2757\u200b\u6ce8\u610f\u200b \uff1a\u200b\u7531\u4e8e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7279\u6b8a\u6027\u200b\uff0c\u200b\u5f53\u4e14\u200b\u4ec5\u200b\u5f53\u200b train\u3001query\u3001gallery \u200b\u96c6\u5408\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\u4e0b\u200b\uff0c\u200b\u6570\u636e\u200b\u5207\u5206\u200b\u624d\u200b\u6709\u200b\u610f\u4e49\u200b\uff0c\u200b\u5728\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u200b\u7684\u200b\u8bc4\u4f30\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u5fc5\u987b\u200b\u6ee1\u8db3\u200b gallery \u200b\u96c6\u5408\u200b\u548c\u200b query \u200b\u96c6\u5408\u200b\u5c5e\u4e8e\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\uff0c\u200b\u5176\u200b\u5141\u8bb8\u200b\u548c\u200b train \u200b\u96c6\u5408\u200b\u4e0d\u200b\u5728\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\uff0c \u200b\u5982\u679c\u200b gallery \u200b\u96c6\u5408\u200b\u548c\u200b query \u200b\u96c6\u5408\u200b\u4e0e\u200b train \u200b\u96c6\u5408\u200b\u4e0d\u200b\u5728\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4f53\u7cfb\u200b\uff0c\u200b\u5219\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u540e\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6ca1\u6709\u200b\u610f\u4e49\u200b\uff0c\u200b\u5efa\u8bae\u200b\u8c28\u614e\u200b\u64cd\u4f5c\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_rec.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir. \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200b Python \u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_recognition_001.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\". \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u2757 \u200b\u6ce8\u610f\u200b\uff1a\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u4e3a\u200b\u4e00\u7ec4\u200b\u5411\u91cf\u200b\uff0c\u200b\u9700\u8981\u200b\u914d\u5408\u200b\u68c0\u7d22\u200b\u6a21\u5757\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u7684\u200b\u8bc6\u522b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_feature.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u4ea7\u7ebf\u200b(comming soon)\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u4ef6\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5bf9\u200b\u8f93\u5165\u200b\u7684\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u591a\u200b\u6807\u7b7e\u200b\u7684\u200b\u5206\u7c7b\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u53ea\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u200b\u5230\u200b\u4e00\u4e2a\u200b\u7c7b\u522b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u9700\u8981\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u200b\u5230\u200b\u591a\u4e2a\u200b\u76f8\u5173\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u63a5\u6536\u200b\u56fe\u50cf\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u7136\u540e\u200b\u901a\u8fc7\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6216\u200b\u5176\u4ed6\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u6839\u636e\u200b\u56fe\u50cf\u200b\u7684\u200b\u7279\u6027\u200b\u548c\u200b\u5185\u5bb9\u200b\uff0c\u200b\u5c06\u200b\u5176\u200b\u5206\u7c7b\u200b\u5230\u200b\u591a\u4e2a\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u4e00\u5f20\u200b\u5305\u542b\u200b\u732b\u200b\u548c\u200b\u72d7\u200b\u7684\u200b\u56fe\u50cf\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u5c06\u200b\u5176\u200b\u540c\u65f6\u200b\u6807\u8bb0\u200b\u4e3a\u200b\u201c\u200b\u732b\u200b\u201d\u200b\u548c\u200b\u201c\u200b\u72d7\u200b\u201d\u3002\u200b\u8fd9\u4e9b\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u51fa\u200b\uff0c\u200b\u4f9b\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\u6216\u200b\u7cfb\u7edf\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b CLIP_vit_base_patch16_448_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.15 325.6 M CLIP_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bCLIP\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 PP-HGNetV2-B0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.98 39.6 M PP-HGNetV2_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-HGNetV2\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 PP-HGNetV2-B4_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.96 88.5 M PP-HGNetV2-B6_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.25 286.5 M PP-LCNet_x1_0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.96 29.4 M PP-LCNet_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 ResNet50_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.50 108.9 M ResNet50_ML\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bResNet50\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200bML-Decoder\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u4e0a\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_ML\")\noutput = model.predict(\"multilabel_classification_005.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mlcls_nus_examples.tar -P ./dataset\ntar -xf ./dataset/mlcls_nus_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/mlcls_nus_examples/label.txt\",\n    \"num_classes\": 33,\n    \"train_samples\": 17463,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0543_4338693.jpg\",\n      \"check_dataset/demo_img/0272_347806939.jpg\",\n      \"check_dataset/demo_img/0069_2291994812.jpg\",\n      \"check_dataset/demo_img/0012_1222850604.jpg\",\n      \"check_dataset/demo_img/0238_53773041.jpg\",\n      \"check_dataset/demo_img/0373_541261977.jpg\",\n      \"check_dataset/demo_img/0567_519506868.jpg\",\n      \"check_dataset/demo_img/0023_289621557.jpg\",\n      \"check_dataset/demo_img/0581_484524659.jpg\",\n      \"check_dataset/demo_img/0325_120753036.jpg\"\n    ],\n    \"val_samples\": 17463,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0546_130758157.jpg\",\n      \"check_dataset/demo_img/0284_2230710138.jpg\",\n      \"check_dataset/demo_img/0090_1491261559.jpg\",\n      \"check_dataset/demo_img/0013_392798436.jpg\",\n      \"check_dataset/demo_img/0246_2248376356.jpg\",\n      \"check_dataset/demo_img/0377_1349296474.jpg\",\n      \"check_dataset/demo_img/0570_2457645006.jpg\",\n      \"check_dataset/demo_img/0027_309333946.jpg\",\n      \"check_dataset/demo_img/0584_132639537.jpg\",\n      \"check_dataset/demo_img/0329_206031527.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/mlcls_nus_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 33\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 17463\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 17463\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u652f\u6301\u200b COCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b MLClsDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u652f\u6301\u200b COCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b MLClsDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b COCO \uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200bCOCO\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b MLClsDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: COCO\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b 90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b 10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b PP-LCNet_x1_0_ML \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_ML.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_ML.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b MultiLabelMAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"multilabel_classification_005.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_ML.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/image_multilabel_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html","title":"\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u786e\u5b9a\u200b\u5e76\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u7279\u5b9a\u200b\u5bf9\u8c61\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6bcf\u4e2a\u200b\u76ee\u6807\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u7684\u200b\u63a9\u6a21\u200b\uff08masks\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u63a9\u6a21\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5bf9\u8c61\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b15\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Cascade-MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.3 - - 254.8 M Cascade-MaskRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bMask RCNN\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ea7\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIOU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u68c0\u6d4b\u200b\u4e0e\u200b\u63a8\u7406\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 - - 254.7 M Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 36.8329 - 66.6 M Mask-RT-DETR-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.0 33.5007 - 51.8 M Mask-RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.6 - - 157.5 M Mask R-CNN\u200b\u662f\u200b\u7531\u200b\u534e\u76db\u987f\u200b\u9996\u4f8b\u200b\u5373\u73b0\u200b\u6295\u5f71\u200b\u5361\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5168\u200b\u4efb\u52a1\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u6a21\u578b\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u56fe\u7247\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9a\u4f4d\u200b\uff0c\u200b\u5e76\u200b\u7ed3\u5408\u200b\u56fe\u50cf\u200b\u7ea7\u200b\u7684\u200b\u906e\u7f69\u200b\uff08Mask\uff09\u200b\u6765\u200b\u5b8c\u6210\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u3002 MaskRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.4 - - 157.5 M MaskRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.8 - - 128.7 M MaskRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 370.0 M PP-YOLOE_seg-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.5 - - 31.5 M PP-YOLOE_seg \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u6cbf\u7528\u200b\u4e86\u200bPP-YOLOE\u200b\u7684\u200bbackbone\u200b\u548c\u200bhead\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bPP-YOLOE\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u5934\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SOLOv2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.5 - - 179.1 M SOLOv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u6309\u200b\u4f4d\u7f6e\u200b\u5206\u5272\u200b\u7269\u4f53\u200b\u7684\u200b\u5b9e\u65f6\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7b97\u6cd5\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u662f\u200bSOLO\u200b\u7684\u200b\u6539\u8fdb\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u63a9\u7801\u200b\u5b66\u4e60\u200b\u548c\u200b\u63a9\u7801\u200bNMS\uff0c\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u901f\u5ea6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u826f\u597d\u200b\u5e73\u8861\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"Mask-RT-DETR-L\")\noutput = model.predict(\"general_instance_segmentation_004.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u5206\u5272\u200b \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_coco_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 2,\n    \"train_samples\": 79,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/pexels-photo-634007.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-59576.png\"\n    ],\n    \"val_samples\": 19,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/peasant-farmer-farmer-romania-botiza-47862.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-715546.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/instance_seg_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 2\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 79\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 19\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u652f\u6301\u200bLabelMe\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200bCOCO\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200bLabelMe\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200bLabelMe\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b Mask-RT-DETR-L \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b Mask-RT-DETR-L.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b Mask-RT-DETR-L.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_instance_segmentation_004.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b Mask-RT-DETR-L.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/instance_segmentation.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b \u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u4e00\u9879\u200b\u57fa\u672c\u200b\u4efb\u52a1\u200b\uff0c\u200b\u65e8\u5728\u200b\u4ece\u200b\u56fe\u50cf\u200b\u3001\u200b\u89c6\u9891\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u5e76\u200b\u63d0\u53d6\u200b\u51fa\u200b\u7279\u5b9a\u200b\u7684\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u3001\u200b\u4eba\u200b\u3001\u200b\u5b9e\u4f53\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5927\u5c0f\u200b\u3002\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u901a\u8fc7\u200b\u6784\u5efa\u200b\u6df1\u5ea6\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b66\u4e60\u200b\u56fe\u50cf\u200b\u4e3b\u4f53\u200b\u7684\u200b\u7279\u5f81\u200b\u8868\u793a\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u51c6\u786e\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.5 62.0 33.7 537.0 27.54 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6a21\u578b\u200b\u53ef\u80fd\u200b\u4f1a\u200b\u540c\u65f6\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u591a\u4e2a\u200b\u5e38\u89c1\u200b\u4e3b\u4f53\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-ShiTuV2_det\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mainbody_det_examples.tar -P ./dataset\ntar -xf ./dataset/mainbody_det_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mainbody_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 701\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 176\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-ShiTuV2_det\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_det.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-ShiTuV2_det.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/mainbody_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\uff08comming soon\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u7279\u5b9a\u200b\u76ee\u6807\u200b\u7684\u200b\u533a\u57df\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u76ee\u6807\u200b\u533a\u57df\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u76ee\u6807\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b6\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b37\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b Cascade-FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.1 - - 245.4 M Cascade-FasterRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bFaster R-CNN\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8026\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIoU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u8bad\u7ec3\u200b\u548c\u200b\u9884\u6d4b\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.0 - - 246.2 M CenterNet-DLA-34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.6 - - 75.4 M CenterNet\u200b\u662f\u200b\u4e00\u79cd\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u628a\u200b\u5f85\u200b\u68c0\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u5173\u952e\u70b9\u200b\u89c6\u4e3a\u200b\u5355\u200b\u4e00\u70b9\u200b-\u200b\u5373\u200b\u5176\u200b\u8fb9\u754c\u200b\u6846\u200b\u7684\u200b\u4e2d\u5fc3\u70b9\u200b\uff0c\u200b\u5e76\u200b\u901a\u8fc7\u200b\u5173\u952e\u70b9\u200b\u8fdb\u884c\u200b\u56de\u5f52\u200b\u3002 CenterNet-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.9 - - 319.7 M DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.3 59.2132 5334.52 159.3 M DETR \u200b\u662f\u200bFacebook\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200btransformer\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200b\u4e0d\u200b\u9700\u8981\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u5148\u9a8c\u200b\u6846\u200banchor\u200b\u548c\u200bNMS\u200b\u7684\u200b\u540e\u5904\u7406\u200b\u7b56\u7565\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002 FasterRCNN-ResNet34-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.8 - - 137.5 M Faster R-CNN\u200b\u662f\u200b\u5178\u578b\u200b\u7684\u200btwo-stage\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5373\u200b\u5148\u751f\u200b\u6210\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff08Region Proposal\uff09\uff0c\u200b\u7136\u540e\u200b\u5728\u200b\u751f\u6210\u200b\u7684\u200bRegion Proposal\u200b\u4e0a\u200b\u505a\u200b\u5206\u7c7b\u200b\u548c\u200b\u56de\u5f52\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200b\u524d\u4ee3\u200bR-CNN\u200b\u548c\u200bFast R-CNN\uff0cFaster R-CNN\u200b\u7684\u200b\u6539\u8fdb\u200b\u4e3b\u8981\u200b\u5728\u4e8e\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u65b9\u9762\u200b\uff0c\u200b\u4f7f\u7528\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7f51\u7edc\u200b\uff08Region Proposal Network, RPN\uff09\u200b\u63d0\u4f9b\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff0c\u200b\u4ee5\u200b\u53d6\u4ee3\u200b\u4f20\u7edf\u200b\u9009\u62e9\u6027\u200b\u641c\u7d22\u200b\u3002RPN\u200b\u662f\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5e76\u200b\u4e0e\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u5171\u4eab\u200b\u56fe\u50cf\u200b\u7684\u200b\u5377\u79ef\u200b\u7279\u5f81\u200b\uff0c\u200b\u51cf\u5c11\u200b\u4e86\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7684\u200b\u8ba1\u7b97\u200b\u5f00\u9500\u200b\u3002 FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 148.1 M FasterRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.7 - - 120.2 M FasterRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 216.3 M FasterRCNN-ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 - - 159.8 M FCOS-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.6 103.367 3424.91 124.2 M FCOS\u200b\u662f\u200b\u4e00\u79cd\u200b\u5bc6\u96c6\u200b\u9884\u6d4b\u200b\u7684\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u4f7f\u7528\u200bRetinaNet\u200b\u7684\u200b\u9aa8\u67b6\u200b\uff0c\u200b\u76f4\u63a5\u200b\u5728\u200bfeature map\u200b\u4e0a\u200b\u56de\u5f52\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u957f\u5bbd\u200b\uff0c\u200b\u5e76\u200b\u9884\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u7c7b\u522b\u200b\u4ee5\u53ca\u200bcenterness\uff08feature map\u200b\u4e0a\u200b\u50cf\u7d20\u70b9\u200b\u79bb\u200b\u7269\u4f53\u200b\u4e2d\u5fc3\u200b\u7684\u200b\u504f\u79fb\u200b\u7a0b\u5ea6\u200b\uff09\uff0ccenterness\u200b\u6700\u7ec8\u200b\u4f1a\u200b\u4f5c\u4e3a\u200b\u6743\u91cd\u200b\u6765\u200b\u8c03\u6574\u200b\u7269\u4f53\u200b\u5f97\u5206\u200b\u3002 PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.5 16.2311 71.7257 16.8 M PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PicoDet-XS\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.7 57.8995 1439.93 349.4 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M RT-DETR-R18\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.5 19.89 784.824 70.7 M RT-DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.1 41.9327 1625.95 149.1 M RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 40.1055 883.041 219.7 M YOLOv3\u200b\u662f\u200b\u4e00\u79cd\u200b\u5b9e\u65f6\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u5b83\u200b\u4f7f\u7528\u200b\u4e00\u4e2a\u200b\u72ec\u7279\u200b\u7684\u200b\u5355\u4e2a\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c06\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u95ee\u9898\u200b\u5206\u89e3\u200b\u4e3a\u200b\u4e00\u4e2a\u200b\u56de\u5f52\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5b9e\u65f6\u200b\u7684\u200b\u68c0\u6d4b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u91c7\u7528\u200b\u4e86\u200b\u591a\u4e2a\u200b\u5c3a\u5ea6\u200b\u7684\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5c3a\u5ea6\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOv3-MobileNetV3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.6 31.6276 856.047 163.0 M YOLOX-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.1 185.691 1250.58 192.5 M YOLOX\u200b\u6a21\u578b\u200b\u4ee5\u200bYOLOv3\u200b\u4f5c\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u200b\u7684\u200b\u6846\u67b6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bDecoupled Head\u3001Data Aug\u3001Anchor Free\u200b\u4ee5\u53ca\u200bSimOTA\u200b\u7ec4\u4ef6\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u5404\u79cd\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOX-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.9 123.324 688.071 90.0 M YOLOX-N\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.1 79.1665 155.59 3.4 M YOLOX-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.4 184.828 474.446 32.0 M YOLOX-T\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.9 102.748 212.52 18.1 M YOLOX-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.8 227.361 2067.84 351.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PicoDet-S\")\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\",\n      \"check_dataset/demo_img/road237.png\",\n      \"check_dataset/demo_img/road733.png\",\n      \"check_dataset/demo_img/road861.png\",\n      \"check_dataset/demo_img/road762.png\",\n      \"check_dataset/demo_img/road515.png\",\n      \"check_dataset/demo_img/road754.png\",\n      \"check_dataset/demo_img/road173.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\",\n      \"check_dataset/demo_img/road544.png\",\n      \"check_dataset/demo_img/road596.png\",\n      \"check_dataset/demo_img/road857.png\",\n      \"check_dataset/demo_img/road203.png\",\n      \"check_dataset/demo_img/road589.png\",\n      \"check_dataset/demo_img/road655.png\",\n      \"check_dataset/demo_img/road245.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 704\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 176\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b VOC\u3001LabelMe \u200b\u548c\u200b VOCWithUnlabeled\u3001LabelMeWithUnlabeled \uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u8f6c\u6362\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u4ee5\u200b\u4e0b\u9762\u200b\u7684\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples\n

\u200b\u5f53\u7136\u200b\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ee5\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PicoDet-S \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-S.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-S.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-S.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/object_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html","title":"\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u884c\u200b\u4eba\u200b\u7684\u200b\u7279\u5b9a\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5982\u200b\u6027\u522b\u200b\u3001\u200b\u5e74\u9f84\u200b\u3001\u200b\u8863\u7269\u200b\u989c\u8272\u200b\u548c\u200b\u7c7b\u578b\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6bcf\u4e2a\u200b\u884c\u4eba\u200b\u7684\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u4fe1\u606f\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\uff08\u200b\u5982\u200b\u884c\u4eba\u200b\u8ddf\u8e2a\u200b\u3001\u200b\u884c\u4eba\u200b\u91cd\u200b\u8bc6\u522b\u200b\u7b49\u200b\uff09\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_pedestrian_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b26\u200b\u4e2a\u200b\u7c7b\u522b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b mA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_pedestrian_attribute\")\noutput = model.predict(\"pedestrian_attribute_006.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

\u200b\u5907\u6ce8\u200b\uff1a\u200b\u5176\u4e2d\u200b output \u200b\u7684\u200b\u503c\u200b\u7d22\u5f15\u200b\u4e3a\u200b0\u200b\u8868\u793a\u200b\u662f\u5426\u200b\u4f69\u6234\u200b\u5e3d\u5b50\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u4e3a\u200b1\u200b\u8868\u793a\u200b\u662f\u5426\u200b\u4f69\u6234\u200b\u773c\u955c\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b2-7\u200b\u8868\u793a\u200b\u4e0a\u8863\u200b\u98ce\u683c\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b8-13\u200b\u8868\u793a\u200b\u4e0b\u88c5\u200b\u98ce\u683c\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b14\u200b\u8868\u793a\u200b\u662f\u5426\u200b\u7a7f\u200b\u9774\u5b50\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b15-17\u200b\u8868\u793a\u200b\u80cc\u200b\u7684\u200b\u5305\u200b\u7684\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b18\u200b\u8868\u793a\u200b\u6b63\u9762\u200b\u662f\u5426\u200b\u6301\u7269\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b19-21\u200b\u8868\u793a\u200b\u5e74\u9f84\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b22\u200b\u8868\u793a\u200b\u6027\u522b\u200b\uff0c\u200b\u7d22\u5f15\u200b\u503c\u200b23-25\u200b\u8868\u793a\u200b\u671d\u5411\u200b\u3002\u200b\u5177\u4f53\u200b\u5730\u200b\uff0c\u200b\u5c5e\u6027\u200b\u5305\u542b\u200b\u4ee5\u4e0b\u200b\u7c7b\u578b\u200b\uff1a

- \u200b\u6027\u522b\u200b\uff1a\u200b\u7537\u200b\u3001\u200b\u5973\u200b\n- \u200b\u5e74\u9f84\u200b\uff1a\u200b\u5c0f\u4e8e\u200b18\u300118-60\u3001\u200b\u5927\u4e8e\u200b60\n- \u200b\u671d\u5411\u200b\uff1a\u200b\u671d\u524d\u200b\u3001\u200b\u671d\u540e\u200b\u3001\u200b\u4fa7\u9762\u200b\n- \u200b\u914d\u9970\u200b\uff1a\u200b\u773c\u955c\u200b\u3001\u200b\u5e3d\u5b50\u200b\u3001\u200b\u65e0\u200b\n- \u200b\u6b63\u9762\u200b\u6301\u7269\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u5305\u200b\uff1a\u200b\u53cc\u80a9\u5305\u200b\u3001\u200b\u5355\u80a9\u200b\u5305\u200b\u3001\u200b\u624b\u63d0\u5305\u200b\n- \u200b\u4e0a\u8863\u200b\u98ce\u683c\u200b\uff1a\u200b\u5e26\u200b\u6761\u7eb9\u200b\u3001\u200b\u5e26\u200blogo\u3001\u200b\u5e26\u200b\u683c\u5b50\u200b\u3001\u200b\u62fc\u63a5\u200b\u98ce\u683c\u200b\n- \u200b\u4e0b\u88c5\u200b\u98ce\u683c\u200b\uff1a\u200b\u5e26\u200b\u6761\u7eb9\u200b\u3001\u200b\u5e26\u200b\u56fe\u6848\u200b\n- \u200b\u77ed\u8896\u200b\u4e0a\u8863\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u957f\u8896\u200b\u4e0a\u8863\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u957f\u200b\u5916\u5957\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u957f\u88e4\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u77ed\u88e4\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u77ed\u88d9\u200b&\u200b\u88d9\u5b50\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n- \u200b\u7a7f\u9774\u200b\uff1a\u200b\u662f\u200b\u3001\u200b\u5426\u200b\n
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/pedestrian_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/pedestrian_attribute_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/pedestrian_attribute_examples/label.txt\",\n    \"num_classes\": 26,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/020907.jpg\",\n      \"check_dataset/demo_img/004274.jpg\",\n      \"check_dataset/demo_img/009412.jpg\",\n      \"check_dataset/demo_img/026873.jpg\",\n      \"check_dataset/demo_img/030560.jpg\",\n      \"check_dataset/demo_img/022846.jpg\",\n      \"check_dataset/demo_img/009055.jpg\",\n      \"check_dataset/demo_img/015399.jpg\",\n      \"check_dataset/demo_img/006435.jpg\",\n      \"check_dataset/demo_img/055307.jpg\"\n    ],\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/080381.jpg\",\n      \"check_dataset/demo_img/080469.jpg\",\n      \"check_dataset/demo_img/080146.jpg\",\n      \"check_dataset/demo_img/080003.jpg\",\n      \"check_dataset/demo_img/080283.jpg\",\n      \"check_dataset/demo_img/080104.jpg\",\n      \"check_dataset/demo_img/080149.jpg\",\n      \"check_dataset/demo_img/080313.jpg\",\n      \"check_dataset/demo_img/080131.jpg\",\n      \"check_dataset/demo_img/080412.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/pedestrian_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 26\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u56fe\u7247\u200b\u7684\u200b\u957f\u5bbd\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-LCNet\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08PP-LCNet_x1_0_pedestrian_attribute\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_pedestrian_attribute.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_pedestrian_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b MultiLabelMAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"pedestrian_attribute_006.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_pedestrian_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u7684\u200b\u4e00\u79cd\u200b\u6280\u672f\u200b\uff0c\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5212\u5206\u200b\u4e3a\u200b\u4e0d\u540c\u200b\u7684\u200b\u8bed\u4e49\u200b\u533a\u57df\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u533a\u57df\u200b\u5bf9\u5e94\u200b\u4e00\u4e2a\u200b\u5177\u4f53\u200b\u7684\u200b\u7c7b\u522b\u200b\u3002\u200b\u8fd9\u79cd\u200b\u6280\u672f\u200b\u80fd\u591f\u200b\u751f\u6210\u200b\u7cbe\u7ec6\u200b\u7684\u200b\u5206\u5272\u200b\u56fe\u200b\uff0c\u200b\u6e05\u6670\u200b\u5730\u200b\u5c55\u73b0\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u8c61\u200b\u53ca\u5176\u200b\u8fb9\u754c\u200b\uff0c\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u6709\u529b\u200b\u652f\u6301\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b18\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

\u200b\u4ee5\u4e0a\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

SeaFormer\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bADE20k\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LiteSeg-T\")\noutput = model.predict(\"general_semantic_segmentation_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset\ntar -xf ./dataset/seg_optic_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/P0005.jpg\",\n      \"check_dataset/demo_img/P0050.jpg\"\n    ],\n    \"train_samples\": 267,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/N0139.jpg\",\n      \"check_dataset/demo_img/P0137.jpg\"\n    ],\n    \"val_samples\": 76,\n    \"num_classes\": 2\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/seg_optic_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 2\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 267\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 76\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09","text":"\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u652f\u6301\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u8981\u6c42\u200b\u7684\u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u652f\u6301\u200b\u7684\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u662f\u200bLabelMe\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u8f6c\u6362\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e00\u4e2a\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5982\u4e0b\u200b\uff1a
wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n

\u200b\u4e0b\u8f7d\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u4fee\u6539\u200b paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert\n

\u200b\u5f53\u7136\u200b\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ee5\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200bPP-LiteSeg-T\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200b PP-LiteSeg-T.yam\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LiteSeg-T.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Top1 Acc

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model\" \\\n    -o Predict.input=\"general_semantic_segmentation_002.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LiteSeg-T.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/semantic_segmentation.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u901a\u5e38\u200b\u6307\u200b\u7684\u200b\u662f\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u7cbe\u786e\u200b\u5730\u200b\u68c0\u6d4b\u200b\u548c\u200b\u5b9a\u4f4d\u200b\u5c3a\u5bf8\u200b\u8f83\u200b\u5c0f\u200b\u3001\u200b\u9762\u79ef\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u76ee\u6807\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u50cf\u7d20\u200b\u5c3a\u5bf8\u200b\u901a\u5e38\u200b\u8f83\u200b\u5c0f\u200b\uff0c\u200b\u53ef\u80fd\u200b\u5c0f\u4e8e\u200b32\u200b\u50cf\u7d20\u200b\u00d732\u200b\u50cf\u7d20\u200b\uff08\u200b\u6839\u636e\u200bMS COCO\u200b\u7b49\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u5b9a\u4e49\u200b\uff09\uff0c\u200b\u4e14\u200b\u53ef\u80fd\u200b\u88ab\u200b\u80cc\u666f\u200b\u6216\u200b\u5176\u4ed6\u200b\u7269\u4f53\u200b\u6240\u200b\u63a9\u76d6\u200b\uff0c\u200b\u96be\u4ee5\u200b\u88ab\u200b\u8089\u773c\u200b\u76f4\u63a5\u200b\u89c2\u5bdf\u51fa\u6765\u200b\u3002\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u4e2d\u200b\u7684\u200b\u4e00\u4e2a\u200b\u91cd\u8981\u200b\u7814\u7a76\u200b\u65b9\u5411\u200b\uff0c\u200b\u65e8\u5728\u200b\u7cbe\u51c6\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u53ef\u89c6\u5316\u200b\u7279\u5f81\u200b\u6781\u5c11\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE_plus_SOD-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.9 52.1 57.1 1007.0 324.93 \u200b\u57fa\u4e8e\u200bVisDrone\u200b\u8bad\u7ec3\u200b\u7684\u200bPP-YOLOE_plus\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002VisDrone\u200b\u662f\u200b\u9488\u5bf9\u200b\u65e0\u4eba\u673a\u200b\u89c6\u89c9\u200b\u6570\u636e\u200b\u7684\u200b\u57fa\u51c6\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u7531\u4e8e\u200b\u76ee\u6807\u200b\u8f83\u200b\u5c0f\u200b\u540c\u65f6\u200b\u5177\u6709\u200b\u4e00\u5b9a\u200b\u7684\u200b\u6311\u6218\u6027\u200b\u800c\u200b\u88ab\u200b\u7528\u4e8e\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u6d4b\u200b PP-YOLOE_plus_SOD-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 25.1 42.8 65.5 324.4 77.29 PP-YOLOE_plus_SOD-largesize-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 65.9 458.5 11172.7 340.42

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE_plus_SOD-S\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"small_object_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bDetection\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/small_det_examples.tar -P ./dataset\ntar -xf ./dataset/small_det_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 1610,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/9999938_00000_d_0000352.jpg\",\n      \"check_dataset/demo_img/9999941_00000_d_0000014.jpg\",\n      \"check_dataset/demo_img/9999973_00000_d_0000043.jpg\"\n    ],\n    \"val_samples\": 548,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0000330_00801_d_0000804.jpg\",\n      \"check_dataset/demo_img/0000103_00180_d_0000026.jpg\",\n      \"check_dataset/demo_img/0000291_04001_d_0000888.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/small_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 10\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1610\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 548\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b VOC\u3001LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\u200b\u53ef\u9009\u503c\u200b\u4e3a\u200b VOC\u3001LabelMe \u200b\u548c\u200b VOCWithUnlabeled\u3001LabelMeWithUnlabeled \uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u8f6c\u6362\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b COCO \u200b\u683c\u5f0f\u200b\uff0c\u200b\u4ee5\u200b\u4e0b\u9762\u200b\u7684\u200bLabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset\n

\u200b\u5f53\u7136\u200b\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ee5\u200b LabelMe \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-YOLOE_plus_SOD-S\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o Train.num_classes=10\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE_plus_SOD-S.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE_plus_SOD-S.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"small_object_detection.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE_plus_SOD-S.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/small_object_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html","title":"\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u5176\u200b\u4e3b\u8981\u200b\u4efb\u52a1\u200b\u662f\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u6807\u8bb0\u200b\u51fa\u200b\u8f66\u8f86\u200b\u7684\u200b\u7279\u5b9a\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5982\u200b\u8f66\u8f86\u200b\u7c7b\u578b\u200b\u3001\u200b\u989c\u8272\u200b\u3001\u200b\u8f66\u724c\u53f7\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u5305\u542b\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\uff08\u200b\u5982\u200b\u8f66\u8f86\u200b\u8ddf\u8e2a\u200b\u3001\u200b\u8f66\u8f86\u200b\u91cd\u200b\u8bc6\u522b\u200b\u7b49\u200b\uff09\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_vehicle_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VeRi \u200b\u6570\u636e\u200b\u96c6\u200bmA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_vehicle_attribute\")\noutput = model.predict(\"vehicle_attribute_007.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

\u200b\u5907\u6ce8\u200b\uff1a\u200b\u5176\u4e2d\u200b output \u200b\u7684\u200b\u503c\u200b\u7d22\u5f15\u200b\u4e3a\u200b0-9\u200b\u8868\u793a\u200b\u989c\u8272\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u989c\u8272\u200b\u5206\u522b\u200b\u662f\u200b\uff1ayellow(\u200b\u9ec4\u8272\u200b), orange(\u200b\u6a59\u8272\u200b), green(\u200b\u7eff\u8272\u200b), gray(\u200b\u7070\u8272\u200b), red(\u200b\u7ea2\u8272\u200b), blue(\u200b\u84dd\u8272\u200b), white(\u200b\u767d\u8272\u200b), golden(\u200b\u91d1\u8272\u200b), brown(\u200b\u68d5\u8272\u200b), black(\u200b\u9ed1\u8272\u200b)\uff1b\u200b\u7d22\u5f15\u200b\u4e3a\u200b10-18\u200b\u8868\u793a\u200b\u8f66\u578b\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u8f66\u578b\u200b\u5206\u522b\u200b\u662f\u200bsedan(\u200b\u8f7f\u8f66\u200b), suv(\u200b\u8d8a\u91ce\u8f66\u200b), van(\u200b\u9762\u5305\u8f66\u200b), hatchback(\u200b\u6380\u200b\u80cc\u8f66\u200b), mpv(\u200b\u591a\u7528\u9014\u200b\u6c7d\u8f66\u200b), pickup(\u200b\u76ae\u5361\u8f66\u200b), bus(\u200b\u516c\u5171\u6c7d\u8f66\u200b), truck(\u200b\u5361\u8f66\u200b), estate(\u200b\u65c5\u884c\u8f66\u200b)\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b \u200b\u5206\u7c7b\u200b \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_attribute_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/vehicle_attribute_examples/label.txt\",\n    \"num_classes\": 19,\n    \"train_samples\": 1200,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0018_c017_00033140_0.jpg\",\n      \"check_dataset/demo_img/0010_c019_00034275_0.jpg\",\n      \"check_dataset/demo_img/0015_c019_00068660_0.jpg\",\n      \"check_dataset/demo_img/0016_c017_00049590_1.jpg\",\n      \"check_dataset/demo_img/0018_c016_00052280_0.jpg\",\n      \"check_dataset/demo_img/0023_c001_00006995_0.jpg\",\n      \"check_dataset/demo_img/0022_c004_00065910_0.jpg\",\n      \"check_dataset/demo_img/0007_c019_00048655_1.jpg\",\n      \"check_dataset/demo_img/0022_c007_00072970_0.jpg\",\n      \"check_dataset/demo_img/0022_c008_00065785_0.jpg\"\n    ],\n    \"val_samples\": 300,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0025_c003_00054095_0.jpg\",\n      \"check_dataset/demo_img/0023_c013_00006350_1.jpg\",\n      \"check_dataset/demo_img/0024_c003_00046320_0.jpg\",\n      \"check_dataset/demo_img/0025_c005_00054795_2.jpg\",\n      \"check_dataset/demo_img/0024_c012_00041770_0.jpg\",\n      \"check_dataset/demo_img/0024_c007_00060845_1.jpg\",\n      \"check_dataset/demo_img/0023_c017_00013150_0.jpg\",\n      \"check_dataset/demo_img/0024_c014_00040410_0.jpg\",\n      \"check_dataset/demo_img/0025_c002_00050685_1.jpg\",\n      \"check_dataset/demo_img/0025_c005_00032645_0.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/vehicle_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 19\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1200\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 300\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u56fe\u7247\u200b\u7684\u200b\u957f\u5bbd\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b PP-LCNet \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08PP-LCNet_x1_0_vehicle_attribute\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_vehicle_attribute.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_vehicle_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b MultiLabelMAP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_attribute_007.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_vehicle_attribute.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442_1","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5b50\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5177\u4f53\u200b\u6307\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\u6765\u200b\u5224\u65ad\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u662f\u5426\u200b\u5b58\u5728\u200b\u8f66\u8f86\u200b\uff0c\u200b\u5e76\u200b\u7ed9\u51fa\u200b\u6bcf\u4e2a\u200b\u8f66\u8f86\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\uff08\u200b\u5982\u200b\u8fb9\u754c\u200b\u6846\u200b\u7684\u200b\u5750\u6807\u200b\uff09\u3002\u200b\u8fd9\u4e9b\u200b\u4fe1\u606f\u200b\u5bf9\u4e8e\u200b\u667a\u80fd\u200b\u4ea4\u901a\u7cfb\u7edf\u200b\u3001\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u7b49\u200b\u591a\u4e2a\u200b\u9886\u57df\u200b\u5177\u6709\u200b\u91cd\u8981\u200b\u610f\u4e49\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP 0.5:0.95 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-S_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 61.3 15.4 178.4 28.79 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-L_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.9 32.6 775.6 196.02

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bPPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_vehicle\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"vehicle_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bPaddleDetection\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bdemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_coco_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_coco_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20011__img00001.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00005.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00009.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20032__img00401.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00405.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00409.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/vehicle_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b4\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 500\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-YOLOE-S_vehicle\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_vehicle.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_vehicle.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_detection.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-YOLOE-S_vehicle.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/cv_modules/vehicle_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html","title":"\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e3b\u8981\u200b\u662f\u200b\u5c06\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u7684\u200b\u65b9\u5411\u200b\u533a\u5206\u200b\u51fa\u6765\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u540e\u5904\u7406\u200b\u5c06\u200b\u5176\u200b\u77eb\u6b63\u200b\u3002\u200b\u5728\u200b\u8bf8\u5982\u200b\u6587\u6863\u200b\u626b\u63cf\u200b\u3001\u200b\u8bc1\u7167\u200b\u62cd\u6444\u200b\u7b49\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u6709\u65f6\u200b\u4e3a\u4e86\u200b\u62cd\u6444\u200b\u66f4\u200b\u6e05\u6670\u200b\uff0c\u200b\u4f1a\u200b\u5c06\u200b\u62cd\u6444\u200b\u8bbe\u5907\u200b\u8fdb\u884c\u200b\u65cb\u8f6c\u200b\uff0c\u200b\u5bfc\u81f4\u200b\u5f97\u5230\u200b\u7684\u200b\u56fe\u7247\u200b\u4e5f\u200b\u662f\u200b\u4e0d\u540c\u200b\u65b9\u5411\u200b\u7684\u200b\u3002\u200b\u6b64\u65f6\u200b\uff0c\u200b\u6807\u51c6\u200b\u7684\u200bOCR\u200b\u6d41\u7a0b\u200b\u65e0\u6cd5\u200b\u5f88\u200b\u597d\u200b\u5730\u200b\u5e94\u5bf9\u200b\u8fd9\u4e9b\u200b\u6570\u636e\u200b\u3002\u200b\u5229\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6280\u672f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9884\u5148\u5224\u65ad\u200b\u542b\u200b\u6587\u5b57\u200b\u533a\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u6216\u200b\u8bc1\u4ef6\u200b\u7684\u200b\u65b9\u5411\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5176\u200b\u8fdb\u884c\u200b\u65b9\u5411\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ece\u800c\u200b\u63d0\u9ad8\u200bOCR\u200b\u5904\u7406\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200bModel Download Link Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 \u200b\u57fa\u4e8e\u200bPP-LCNet_x1_0\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u542b\u6709\u200b\u56db\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5373\u200b0\u200b\u5ea6\u200b\uff0c90\u200b\u5ea6\u200b\uff0c180\u200b\u5ea6\u200b\uff0c270\u200b\u5ea6\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8bc1\u4ef6\u200b\u548c\u200b\u6587\u6863\u200b\u7b49\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5305\u542b\u200b 1000 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_doc_ori\")\noutput = model.predict(\"img_rot180_demo.jpg\",  batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/demo.png\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u5206\u7c7b\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/text_image_orientation.tar -P ./dataset\ntar -xf ./dataset/text_image_orientation.tar  -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"..\\/..\\/text_image_orientation\\/label.txt\",\n    \"num_classes\": 4,\n    \"train_samples\": 1553,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_10351.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_3908.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_7712.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_7480.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot270_9599.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_10323.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4885.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_3939.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7153.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1747.jpg\"\n    ],\n    \"val_samples\": 2593,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_3190.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_10272.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_9930.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_918.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_2079.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_8574.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7595.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_1751.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1573.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4401.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/text_image_orientation\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1552\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2593\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff08PP-LCNet_x1_0_doc_ori\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_doc_ori.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_doc_ori.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Top1 Acc\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"img_rot180_demo.jpg\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-LCNet_x1_0_doc_ori.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=``\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html","title":"\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6570\u5b66\u516c\u5f0f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u6587\u672c\u200b\u6216\u200b\u8ba1\u7b97\u673a\u200b\u53ef\u200b\u8bc6\u522b\u200b\u7684\u200b\u683c\u5f0f\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6570\u5b66\u516c\u5f0f\u200b\u7684\u200b LaTeX \u200b\u6216\u200b MathML \u200b\u4ee3\u7801\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u4ee3\u7801\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u6587\u672c\u200b\u7406\u89e3\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b normed edit distance BLEU score ExpRate \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b LaTeX_OCR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.8821 0.0823 40.01 89.7 M LaTeX-OCR\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u81ea\u200b\u56de\u5f52\u200b\u5927\u200b\u6a21\u578b\u200b\u7684\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b Hybrid ViT \u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0ctransformer\u200b\u4f5c\u4e3a\u200b\u89e3\u7801\u5668\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7684\u200b\u51c6\u786e\u6027\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"LaTeX_OCR_rec\")\noutput = model.predict(\"general_formula_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b PaddleOCR \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bLaTeX-OCR \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u9879\u76ee\u200b

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_latexocr_dataset_example.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_latexocr_dataset_example.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 9452,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0109284.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0217434.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0166758.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0022294.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0071799.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0017043.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0026204.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0209202.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0157332.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0232582.png\"\n    ],\n    \"val_samples\": 1050,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0070221.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0157901.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0085392.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0196480.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0096180.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0136149.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0143310.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0004560.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0115191.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0015323.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_latexocr_dataset_example\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"LaTeXOCRDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 9452\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1050\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u652f\u6301\u200b MSTextRecDataset\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b LaTeXOCRDataset\u200b\u683c\u5f0f\u200b(PKL\u200b\u683c\u5f0f\u200b)\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u652f\u6301\u200b MSTextRecDataset\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b LaTeXOCRDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b True;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b MSTextRecDataset\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b MSTextRecDataset\u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b LaTeXOCRDataset\u200b\u683c\u5f0f\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: MSTextRecDataset\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=MSTextRecDataset\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b LaTeX_OCR_rec \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bLaTeX_OCR_rec.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bLaTeX_OCR_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b exp_rate \uff1b

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_formula_rec_001.png\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bLaTeX_OCR_rec.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/formula_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html","title":"\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u6838\u5fc3\u200b\u662f\u200b\u5bf9\u200b\u8f93\u5165\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5185\u5bb9\u200b\u89e3\u6790\u200b\u548c\u200b\u533a\u57df\u200b\u5212\u5206\u200b\u3002\u200b\u901a\u8fc7\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u4e0d\u540c\u200b\u5143\u7d20\u200b\uff08\u200b\u5982\u200b\u6587\u5b57\u200b\u3001\u200b\u56fe\u8868\u200b\u3001\u200b\u56fe\u7247\u200b\u7b49\u200b\uff09\uff0c\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u4e3a\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u7c7b\u522b\u200b\uff08\u200b\u5982\u7eaf\u200b\u6587\u672c\u200b\u533a\u200b\u3001\u200b\u6807\u9898\u200b\u533a\u200b\u3001\u200b\u8868\u683c\u200b\u533a\u200b\u3001\u200b\u56fe\u7247\u200b\u533a\u200b\u3001\u200b\u5217\u8868\u200b\u533a\u200b\u7b49\u200b\uff09\uff0c\u200b\u5e76\u200b\u786e\u5b9a\u200b\u8fd9\u4e9b\u200b\u533a\u57df\u200b\u5728\u200b\u6587\u6863\u200b\u4e2d\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5927\u5c0f\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200bwhl\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\n\nmodel_name = \"PicoDet-L_layout_3cls\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"layout.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bDetection\u200b\u76f8\u5173\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200bDemo\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_layout_examples.tar -P ./dataset\ntar -xf ./dataset/det_layout_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 11,\n    \"train_samples\": 90,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/train_0077.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0028.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0012.jpg\"\n    ],\n    \"val_samples\": 20,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/val_0007.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0019.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0010.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/det_layout_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b11\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b90\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 20\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPicoDet-L_layout_3cls\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-L_layout_3cls.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-L_layout_3cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=``./output/best_model/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b AP\uff1b

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u3002\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5b9e\u73b0\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u547d\u4ee4\u884c\u200b\u548c\u200bwheel \u200b\u5305\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"layout.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPicoDet-L_layout_3cls.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_model/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

  • \u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u7528\u200bPaddleX \u200b\u7684\u200b whl \u200b\u5305\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5730\u200b\u5c06\u200b\u6a21\u578b\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u96c6\u6210\u200b\u65b9\u5f0f\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u7b2c\u4e09\u6b65\u200b\u7684\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200bcreate_model(model_name=model_name, , kernel_option=kernel_option)\u200b\u589e\u52a0\u200b\u53c2\u6570\u200bmodel_dir=\"/output/best_model/inference\"\u3002

"},{"location":"module_usage/tutorials/ocr_modules/layout_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

  1. \u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

  2. \u200b\u6a21\u5757\u200b\u96c6\u6210\u200b \u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html","title":"\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u7684\u200b\u591a\u70b9\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u5f2f\u66f2\u200b\u77eb\u6b63\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u5370\u7ae0\u200b\u7684\u200b\u6587\u5b57\u200b\u5185\u5bb9\u200b\u3002\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u8bc6\u522b\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u4e2d\u200b\u7684\u200b\u5b50\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u533a\u57df\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u5370\u7ae0\u200b\u6587\u672c\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_server_seal_det\")\noutput = model.predict(\"seal_text_det.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleOCR \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_curve_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_curve_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 606,\n    \"train_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07834.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09943.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04079.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05701.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08324.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07451.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09562.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08237.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug01788.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06481.png\"\n    ],\n    \"val_samples\": 152,\n    \"val_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03724.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06456.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04029.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03603.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05454.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06269.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00624.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug02818.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00538.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04935.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/ocr_curve_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 606\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 152\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c55\u5f00\u200b\u67e5\u770b\u200b\u8be6\u60c5\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200bPP-OCRv4\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08PP-OCRv4_server_seal_det\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_server_seal_det.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_server_seal_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200bprecision\uff0crecall\u200b\u548c\u200bhmean.

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"seal_text_det.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_server_seal_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/seal_text_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html","title":"\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u662f\u200b\u8868\u683c\u200b\u8bc6\u522b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u80fd\u591f\u200b\u5c06\u200b\u4e0d\u53ef\u200b\u7f16\u8f91\u8868\u683c\u200b\u56fe\u7247\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u8868\u683c\u200b\u5f62\u5f0f\u200b\uff08\u200b\u4f8b\u5982\u200bhtml\uff09\u3002\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u76ee\u6807\u200b\u662f\u200b\u5bf9\u200b\u8868\u683c\u200b\u7684\u200b\u884c\u200b\u3001\u200b\u5217\u200b\u548c\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200b\u8868\u683c\u200b\u8bc6\u522b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u8868\u683c\u200b\u533a\u57df\u200b\u7684\u200bhtml\u200b\u4ee3\u7801\u200b\u6216\u200bLatex\u200b\u4ee3\u7801\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u4ee3\u7801\u200b\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M SLANet_plus \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bSLANet\u200b\u7684\u200b\u589e\u5f3a\u7248\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200bSLANet\uff0cSLANet_plus \u200b\u5bf9\u200b\u65e0\u7ebf\u200b\u8868\u200b\u3001\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\u5f97\u5230\u200b\u4e86\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\uff0c\u200b\u5e76\u200b\u964d\u4f4e\u200b\u4e86\u200b\u6a21\u578b\u200b\u5bf9\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51c6\u786e\u6027\u200b\u7684\u200b\u654f\u611f\u5ea6\u200b\uff0c\u200b\u5373\u4f7f\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51fa\u73b0\u200b\u504f\u79fb\u200b\uff0c\u200b\u4e5f\u200b\u80fd\u591f\u200b\u8f83\u200b\u51c6\u786e\u200b\u5730\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"SLANet\")\noutput = model.predict(\"table_recognition.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b PaddleOCR\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/table_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/table_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 2000,\n    \"train_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_right_7384_X9UFEPKVMLALY7DDB11A.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_13708_VE2DGBD4DCQU2ITLBTEA.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_6490_14Z6ZN6G52GG4XA0K4XU.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_14236_DG96EX0EDKIIDK8P6ENG.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_19648_SV8B7X34RTYRAT2T5CPI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_7186_HODBC25HISMCSVKY0HJ9.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_5773_4K4H9OVK9X9YVHE4Y1BQ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_7760_8C62CCH5T57QUGE0NTHZ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_15707_B1YVOU3X4NHHB6TL269O.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_5223_HLG406UK35UD5EUYC2AV.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_2945_L7MSRHBZRW6Y347G39O6.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_4825_LH9WI6X104CP3VFXPSON.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_16837_79KHWU9WDM9ZQHNBGQAL.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_10107_9ENLLC29SQ6XI8WZY53E.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_16668_JIS0YFDZKTKETZIEKCKX.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_18653_J9SSKHLFTRJD4J8W17OW.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_8396_VJ3QJ3I0DP63P4JR77FE.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_9017_K2V7QBWSU2BA4R3AJSO7.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_19494_SDFMWP92NOB2OT7109FI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_288_6LK683JUCMOQ38V5BV29.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/table_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"PubTabTableRecDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 100\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b 90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b 10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b SLANet \u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSLANet.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSLANet.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u62ec\u200b acc \uff1b

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"
  • \u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

    python main.py -c paddlex/configs/table_recognition/SLANet.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"table_recognition.jpg\"\n
    \u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bSLANet.yaml\uff09

  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
  • \u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u7528\u200bPaddleX \u200b\u7684\u200b whl \u200b\u5305\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5730\u200b\u5c06\u200b\u6a21\u578b\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/table_structure_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u548c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u5305\u542b\u200b\u6587\u672c\u200b\u7684\u200b\u533a\u57df\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u4f1a\u200b\u8f93\u51fa\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u8fb9\u754c\u200b\u6846\u5c06\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u4f20\u9012\u200b\u7ed9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u5904\u7406\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_det\")\noutput = model.predict(\"general_ocr_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b PaddleOCR \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002 \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 200,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/train_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/train_img_289.jpg\"\n    ],\n    \"val_samples\": 50,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/val_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/val_img_137.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 200\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 50\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u56fe\u7247\u200b\u7684\u200b\u957f\u5bbd\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b PP-OCRv4 \u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08PP-OCRv4_mobile_det\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_det.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200b PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b precision\u3001recall\u3001hmean\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_001.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_det.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

  • \u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u7528\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u5730\u200b\u5c06\u200b\u6a21\u578b\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html","title":"\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u7684\u200b\u4e3b\u8981\u200b\u76ee\u7684\u200b\u662f\u200b\u9488\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u51e0\u4f55\u53d8\u6362\u200b\uff0c\u200b\u4ee5\u200b\u7ea0\u6b63\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u6863\u200b\u626d\u66f2\u200b\u3001\u200b\u503e\u659c\u200b\u3001\u200b\u900f\u89c6\u200b\u53d8\u5f62\u200b\u7b49\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ee5\u4f9b\u200b\u540e\u7eed\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u66f4\u200b\u51c6\u786e\u200b\u7684\u200b\u8bc6\u522b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MS-SSIM \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b UVDoc\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.40 30.3 M \u200b\u9ad8\u7cbe\u5ea6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u578b\u200b

\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b DocUNet benchmark\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\uff0cwheel\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u5b8c\u6210\u200bwheel\u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"UVDoc\")\noutput = model.predict(\"doc_test.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_image_unwarping.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5f53\u524d\u200b\u6a21\u5757\u200b\u6682\u65f6\u200b\u4e0d\u200b\u652f\u6301\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ec5\u200b\u652f\u6301\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u3002\u200b\u5173\u4e8e\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8ba1\u5212\u200b\u5728\u200b\u672a\u6765\u200b\u652f\u6301\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u662f\u200bOCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff09\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u6838\u5fc3\u200b\u90e8\u5206\u200b\uff0c\u200b\u8d1f\u8d23\u200b\u4ece\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u63d0\u53d6\u200b\u51fa\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u8be5\u200b\u6a21\u5757\u200b\u7684\u200b\u6027\u80fd\u200b\u76f4\u63a5\u200b\u5f71\u54cd\u200b\u5230\u200b\u6574\u4e2a\u200bOCR\u200b\u7cfb\u7edf\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u548c\u200b\u6548\u7387\u200b\u3002\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u901a\u5e38\u200b\u63a5\u6536\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u8f93\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u533a\u57df\u200b\u7684\u200b\u8fb9\u754c\u200b\u6846\u200b\uff08Bounding Boxes\uff09\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\uff0c\u200b\u7136\u540e\u200b\u901a\u8fc7\u200b\u590d\u6742\u200b\u7684\u200b\u56fe\u50cf\u5904\u7406\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u548c\u200b\u53ef\u200b\u641c\u7d22\u200b\u7684\u200b\u7535\u5b50\u6587\u672c\u200b\u3002\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u540e\u7eed\u200b\u7684\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u6316\u6398\u200b\u7b49\u200b\u5e94\u7528\u200b\u81f3\u5173\u91cd\u8981\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b4\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0cwheel\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_rec\")\noutput = model.predict(\"general_ocr_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b PaddleX \u200b\u5f00\u53d1\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b OCR \u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u90e8\u5206\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 4468,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_10.png\"\n    ],\n    \"val_samples\": 2077,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_10.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b true \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 4468\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2077\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u5b57\u7b26\u200b\u957f\u5ea6\u200b\u5360\u200b\u6bd4\u200b\u7684\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u3002

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b PP-OCRv4 \u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08PP-OCRv4_mobile_rec\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_rec.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1aevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b acc\u3001norm_edit_dis\uff1b

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u56fe\u7247\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_rec_001.png\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPP-OCRv4_mobile_rec.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/best_accuracy/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/ocr_modules/text_recognition.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u3001\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv3\uff09\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4e13\u6ce8\u200b\u4e8e\u200b\u8bc6\u522b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u4e2d\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\u6a21\u5f0f\u200b\u3001\u200b\u8d8b\u52bf\u200b\u6216\u200b\u5468\u671f\u6027\u200b\u89c4\u5f8b\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\u6216\u200b\u5f02\u5e38\u200b\u65f6\u6bb5\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u5f02\u5e38\u200b\u53ef\u80fd\u200b\u7531\u200b\u7cfb\u7edf\u6545\u969c\u200b\u3001\u200b\u5916\u90e8\u200b\u51b2\u51fb\u200b\u3001\u200b\u6570\u636e\u5f55\u5165\u200b\u9519\u8bef\u200b\u6216\u200b\u7f55\u89c1\u200b\u4e8b\u4ef6\u200b\u7b49\u200b\u591a\u79cd\u200b\u56e0\u7d20\u200b\u5f15\u8d77\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u53ca\u65f6\u200b\u54cd\u5e94\u200b\u3001\u200b\u98ce\u9669\u200b\u8bc4\u4f30\u200b\u53ca\u200b\u4e1a\u52a1\u200b\u51b3\u7b56\u200b\u5177\u6709\u200b\u91cd\u5927\u610f\u4e49\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9898 0.9396 0.9641 72.8K DLinear_ad\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b Nonstationary_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9855 0.8895 0.9351 1.5MB \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b AutoEncoder_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9936 0.8436 0.9125 32K AutoEncoder_ad\u200b\u662f\u200b\u7ecf\u5178\u200b\u7684\u200b\u81ea\u200b\u7f16\u7801\u200b\u7ed3\u6784\u200b\u7684\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PatchTST_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9878 0.9070 0.9457 164K PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b TimesNet_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.9837 0.9480 0.9656 732K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPSM\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u957f\u5ea6\u200b\u4e3a\u200b100\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u662f\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"AutoEncoder_ad\")\noutput = model.predict(\"ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleTS \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_anomaly_examples.tar -P ./dataset\ntar -xf ./dataset/ts_anomaly_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22032,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        0.0,\n        0.7326893750079723,\n        \"...\",\n        0.1382488479262673,\n        0.0\n      ]\n    ],\n    \"val_samples\": 198290,\n    \"val_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        22032.0,\n        0.8604795809835284,\n        \"...\",\n        0.1428571428571428,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_anomaly_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 22032\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 198290\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b csv \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b CSV \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b \u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.convert.enable=True\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5c06\u200bxlsx\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8f6c\u6362\u200b\u4e3a\u200bcsv\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08AutoEncoder_ad\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bAutoEncoder_ad.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bAutoEncoder_ad.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b f1\u3001recall \u200b\u548c\u200b precision\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_ad.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bAutoEncoder_ad.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u8d8b\u52bf\u200b\u3001\u200b\u5468\u671f\u6027\u200b\u3001\u200b\u5b63\u8282\u6027\u200b\u7b49\u200b\u56e0\u7d20\u200b\uff0c\u200b\u6765\u200b\u8bc6\u522b\u200b\u5e76\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u4e13\u95e8\u200b\u7528\u4e8e\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u3002\u200b\u8fd9\u79cd\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u533b\u7597\u200b\u8bca\u65ad\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u5206\u7c7b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\uff0c\u200b\u4e3a\u200b\u51b3\u7b56\u200b\u63d0\u4f9b\u200b\u6709\u529b\u200b\u652f\u6301\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b TimesNet_cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.5 792K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b UWaveGestureLibrary\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u662f\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleTS \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u7c7b\u522b\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.000949,\n        ...,\n        0.12107,\n        1.0,\n        0.0\n      ]\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.004578,\n        ...,\n        0.15728,\n        1.0,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass\u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 82620\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 83025\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b \u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u2757\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b csv \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200b xlsx\u200b\u548c\u200bxls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b CSV \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b \u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.convert.enable=True\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5c06\u200bxlsx\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8f6c\u6362\u200b\u4e3a\u200bcsv\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u6b64\u5904\u200b\u4ee5\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff08TimesNet_cls\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b Acc \u200b\u548c\u200b F1 score\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_cls.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_classification.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_2","title":"\u4e00\u200b\u3001\u200b\u6982\u8ff0","text":"

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u65e8\u5728\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6a21\u5f0f\u200b\u3001\u200b\u8d8b\u52bf\u200b\u548c\u200b\u5468\u671f\u6027\u200b\u7b49\u200b\u7279\u5f81\u200b\uff0c\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u67d0\u4e00\u65f6\u95f4\u200b\u70b9\u200b\u6216\u200b\u65f6\u95f4\u6bb5\u200b\u5185\u200b\u53ef\u80fd\u200b\u53d1\u751f\u200b\u7684\u200b\u503c\u200b\u6216\u200b\u72b6\u6001\u200b\u3002\u200b\u8fd9\u200b\u6709\u52a9\u4e8e\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u505a\u51fa\u200b\u66f4\u52a0\u200b\u7cbe\u51c6\u200b\u7684\u200b\u51b3\u7b56\u200b\uff0c\u200b\u4f18\u5316\u200b\u8d44\u6e90\u914d\u7f6e\u200b\uff0c\u200b\u51cf\u5c11\u200b\u98ce\u9669\u200b\uff0c\u200b\u5e76\u200b\u6293\u4f4f\u200b\u6f5c\u5728\u200b\u7684\u200b\u5e02\u573a\u200b\u673a\u4f1a\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u901a\u5e38\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u5404\u79cd\u200b\u4f20\u611f\u5668\u200b\u3001\u200b\u7ecf\u6d4e\u200b\u6d3b\u52a8\u200b\u3001\u200b\u793e\u4f1a\u200b\u884c\u4e3a\u200b\u7b49\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u80a1\u7968\u4ef7\u683c\u200b\u3001\u200b\u6c14\u6e29\u200b\u53d8\u5316\u200b\u3001\u200b\u7f51\u7ad9\u200b\u8bbf\u95ee\u91cf\u200b\u3001\u200b\u9500\u552e\u200b\u6570\u636e\u200b\u7b49\u200b\u90fd\u200b\u662f\u200b\u5178\u578b\u200b\u7684\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_3","title":"\u4e8c\u200b\u3001\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.382 0.394 76k DLinear\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b Nonstationary\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.600 0.515 60.3M \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b PatchTST\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.385 0.397 2.2M PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b TiDE\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.405 0.412 34.9M TiDE\u200b\u662f\u200b\u9002\u7528\u200b\u4e8e\u200b\u5904\u7406\u200b\u591a\u200b\u53d8\u91cf\u200b\u3001\u200b\u957f\u671f\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u9884\u6d4b\u200b\u95ee\u9898\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200b TimesNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.417 0.431 5.2M \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5206\u6790\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6d4b\u8bd5\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u4e3a\u200b96\uff0c\u200b\u9884\u6d4b\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u9664\u200b TiDE \u200b\u5916\u4e3a\u200b96\uff0cTiDE\u200b\u4e3a\u200b720 \u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_4","title":"\u4e09\u200b\u3001\u200b\u5feb\u901f\u200b\u96c6\u6210","text":"

\u2757 \u200b\u5728\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u5b89\u88c5\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5b8c\u6210\u200b wheel \u200b\u5305\u200b\u7684\u200b\u5b89\u88c5\u200b\u540e\u200b\uff0c\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u662f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4efb\u610f\u200b\u5207\u6362\u200b\u8be5\u200b\u6a21\u5757\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u5757\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
\u200b\u5173\u4e8e\u200b\u66f4\u200b\u591a\u200b PaddleX \u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u7684\u200b API \u200b\u7684\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u5355\u200b\u6a21\u578b\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#_5","title":"\u56db\u200b\u3001\u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u4f60\u200b\u8ffd\u6c42\u200b\u66f4\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff0c\u200b\u5f00\u53d1\u200b\u66f4\u597d\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200bPaddleX\u200b\u5f00\u53d1\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u5b89\u88c5\u200b PaddleTS \u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u8fc7\u7a0b\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u51c6\u5907\u200b\u76f8\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u3002PaddleX \u200b\u9488\u5bf9\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cPaddleX\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u6570\u636e\u200b\u5b8c\u6210\u200b\u540e\u7eed\u200b\u7684\u200b\u5f00\u53d1\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#411-demo","title":"4.1.1 Demo \u200b\u6570\u636e\u200b\u4e0b\u8f7d","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ts_dataset_examples.tar -C ./dataset/\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#412","title":"4.1.2 \u200b\u6570\u636e\u200b\u6821\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200blog\u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200bCheck dataset passed !\u200b\u4fe1\u606f\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b./output/check_dataset_result.json\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b./output/check_dataset\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u3002

\ud83d\udc49 \u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 12194,\n    \"train_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2016-07-01 00:00:00\",\n        5.827000141143799,\n        2.009000062942505,\n        1.5989999771118164,\n        0.4620000123977661,\n        4.203000068664552,\n        1.3400000333786009,\n        30.5310001373291\n      ],\n      [\n        \"2016-07-01 01:00:00\",\n        5.692999839782715,\n        2.075999975204468,\n        1.4919999837875366,\n        0.4259999990463257,\n        4.142000198364259,\n        1.371000051498413,\n        27.78700065612793\n      ]\n    ],\n    \"val_samples\": 3484,\n    \"val_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2017-11-21 02:00:00\",\n        12.994000434875488,\n        4.889999866485597,\n        10.055999755859377,\n        2.878000020980835,\n        2.559000015258789,\n        1.2489999532699585,\n        4.7129998207092285\n      ],\n      [\n        \"2017-11-21 03:00:00\",\n        11.92199993133545,\n        4.554999828338623,\n        9.097000122070312,\n        3.0920000076293945,\n        2.559000015258789,\n        1.2790000438690186,\n        4.8540000915527335\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_dataset_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 12194\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 3484\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u524d\u200b10\u200b\u884c\u200b\u4fe1\u606f\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#413","title":"4.1.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u60a8\u200b\u5b8c\u6210\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u200b/\u200b\u9a8c\u8bc1\u200b\u6bd4\u4f8b\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u3002

\ud83d\udc49 \u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\u8be6\u60c5\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\uff081\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u652f\u6301\u200b xlsx \u200b\u548c\u200b xls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b csv \u200b\u683c\u5f0f\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u652f\u6301\u200b xlsx\u200b\u548c\u200bxls \u200b\u683c\u5f0f\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u6362\u200b\u4e3a\u200b CSV \u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff0c\uff1b \u200b\u5219\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.convert.enable=True\n

\uff082\uff09\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
  • convert:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
  • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5c06\u200bxlsx\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8f6c\u6362\u200b\u4e3a\u200bcsv\uff0c\u200b\u65e0\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b null\uff1b
  • split:
  • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
  • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b val_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b
  • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b0-100\u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u4e0e\u200b train_percent \u200b\u7684\u200b\u503c\u200b\u4e4b\u200b\u548c\u200b\u4e3a\u200b100\uff1b \u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u60f3\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b \u200b\u8bad\u7ec3\u200b\u96c6\u5360\u200b\u6bd4\u200b90%\u3001\u200b\u9a8c\u8bc1\u200b\u96c6\u5360\u200b\u6bd4\u200b10%\uff0c\u200b\u5219\u200b\u9700\u200b\u5c06\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fee\u6539\u200b\u4e3a\u200b\uff1a
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

\u200b\u968f\u540e\u200b\u6267\u884c\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u6267\u884c\u200b\u4e4b\u540e\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\u3002

\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6b64\u5904\u200b\u9ad8\u6548\u7387\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\uff08DLinear\uff09\u200b\u7684\u200b\u8bad\u7ec3\u200b\u4e3a\u4f8b\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n
\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff0c\u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train
  • \u200b\u6307\u5b9a\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bTrain\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u5728\u200b\u547d\u4ee4\u884c\u200b\u4e2d\u200b\u8ffd\u52a0\u200b\u53c2\u6570\u200b\u6765\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\u3002\u200b\u5982\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002\u200b\u66f4\u200b\u591a\u200b\u53ef\u200b\u4fee\u6539\u200b\u7684\u200b\u53c2\u6570\u200b\u53ca\u5176\u200b\u8be6\u7ec6\u200b\u89e3\u91ca\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5bf9\u5e94\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8bf4\u660e\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b

  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#43","title":"4.3 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
\ud83d\udc49 \u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09

\u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b mse \u200b\u548c\u200b mae\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#44","title":"4.4 \u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u548c\u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6216\u8005\u200b\u8fdb\u884c\u200bPython\u200b\u96c6\u6210\u200b\u3002

"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#441","title":"4.4.1 \u200b\u6a21\u578b\u200b\u63a8\u7406","text":"

\u200b\u901a\u8fc7\u200b\u547d\u4ee4\u884c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\u3002\u200b\u8fd0\u884c\u200b\u4ee5\u4e0b\u200b\u4ee3\u7801\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u4e0b\u8f7d\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u5230\u200b\u672c\u5730\u200b\u3002

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_fc.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"module_usage/tutorials/time_series_modules/time_series_forecasting.html#442","title":"4.4.2 \u200b\u6a21\u578b\u200b\u96c6\u6210","text":"

\u200b\u6a21\u578b\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u60a8\u200b\u81ea\u5df1\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

1.\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u53ef\u4ee5\u200b\u96c6\u6210\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u6709\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b\u66f4\u65b0\u200b\u3002\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u4e2d\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6765\u200b\u90e8\u7f72\u200b\u4f60\u200b\u5f97\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

2.\u200b\u6a21\u5757\u200b\u96c6\u6210\u200b

\u200b\u60a8\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u5230\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b\u7684\u200b Python \u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u5c06\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u4f60\u200b\u8bad\u7ec3\u200b\u7684\u200b\u5230\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

"},{"location":"other_devices_support/how_to_contribute_device.html","title":"1. \u200b\u66f4\u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

\u200b\u98de\u6868\u200b\u751f\u6001\u200b\u7684\u200b\u7e41\u8363\u200b\u79bb\u4e0d\u5f00\u200b\u5f00\u53d1\u8005\u200b\u548c\u200b\u7528\u6237\u200b\u7684\u200b\u8d21\u732e\u200b\uff0c\u200b\u6211\u4eec\u200b\u975e\u5e38\u200b\u6b22\u8fce\u60a8\u200b\u4e3a\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u786c\u4ef6\u200b\u9002\u914d\u200b\uff0c\u200b\u4e5f\u200b\u5341\u5206\u200b\u611f\u8c22\u60a8\u200b\u7684\u200b\u53cd\u9988\u200b\u3002

\u200b\u5f53\u524d\u200b\u652f\u6301\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e3a\u200b Intel/\u200b\u82f9\u679c\u200bM\u200b\u7cfb\u5217\u200b CPU\u3001\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u3001\u200b\u6d77\u5149\u200b DCU \u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200bMLU\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u8981\u200b\u652f\u6301\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0d\u200b\u5728\u200b\u5df2\u7ecf\u200b\u652f\u6301\u200b\u7684\u200b\u8303\u56f4\u200b\u5185\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8d21\u732e\u200b\u3002

"},{"location":"other_devices_support/how_to_contribute_device.html#11","title":"1.1 \u200b\u786c\u4ef6\u200b\u63a5\u5165\u200b\u98de\u6868\u200b\u540e\u200b\u7aef","text":"

\u200b\u98de\u6868\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6846\u67b6\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u591a\u79cd\u200b\u786c\u4ef6\u200b\u63a5\u5165\u200b\u7684\u200b\u65b9\u6848\u200b\uff0c\u200b\u5305\u62ec\u200b\u7b97\u5b50\u200b\u5f00\u53d1\u200b\u4e0e\u200b\u6620\u5c04\u200b\u3001\u200b\u5b50\u56fe\u200b\u4e0e\u200b\u6574\u56fe\u200b\u63a5\u5165\u200b\u3001\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7f16\u8bd1\u5668\u200b\u540e\u200b\u7aef\u200b\u63a5\u5165\u200b\u4ee5\u53ca\u200b\u5f00\u6e90\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u683c\u5f0f\u200b\u8f6c\u5316\u200b\u56db\u79cd\u200b\u786c\u4ef6\u200b\u63a5\u5165\u200b\u65b9\u6848\u200b\uff0c\u200b\u4f9b\u200b\u786c\u4ef6\u200b\u5382\u5546\u200b\u6839\u636e\u200b\u81ea\u8eab\u200b\u82af\u7247\u200b\u67b6\u6784\u8bbe\u8ba1\u200b\u4e0e\u200b\u8f6f\u4ef6\u200b\u6808\u200b\u7684\u200b\u5efa\u8bbe\u200b\u6210\u719f\u5ea6\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u9009\u62e9\u200b\uff0c\u200b\u5177\u4f53\u200b\u7ec6\u8282\u200b\u8bf7\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u786c\u4ef6\u200b\u63a5\u5165\u200b\u65b9\u6848\u200b\u3002

"},{"location":"other_devices_support/how_to_contribute_device.html#12","title":"1.2 \u200b\u5404\u4e2a\u200b\u5957\u4ef6\u200b\u652f\u6301","text":"

\u200b\u7531\u4e8e\u200bPaddleX\u200b\u57fa\u4e8e\u200b\u98de\u6868\u200b\u6a21\u578b\u5e93\u200b\u5b9e\u73b0\u200b\u3002\u200b\u5f53\u200b\u786c\u4ef6\u200b\u5b8c\u6210\u200b\u98de\u6868\u200b\u540e\u200b\u7aef\u200b\u63a5\u5165\u200b\u540e\u200b\uff0c\u200b\u6309\u7167\u200b\u786c\u4ef6\u200b\u5df2\u7ecf\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u60c5\u51b5\u200b\uff0c\u200b\u9009\u62e9\u200b\u76f8\u5e94\u200b\u7684\u200b\u5957\u4ef6\u200b\u53bb\u200b\u63d0\u4ea4\u200b\u4ee3\u7801\u200b\uff0c\u200b\u786e\u4fdd\u200b\u76f8\u5173\u200b\u5957\u4ef6\u200b\u9002\u914d\u200b\u4e86\u200b\u5bf9\u5e94\u200b\u786c\u4ef6\u200b\uff0c\u200b\u53c2\u8003\u200b\u5404\u200b\u5957\u4ef6\u200b\u8d21\u732e\u200b\u6307\u5357\u200b\uff1a

  1. PaddleClas

  2. PaddleDetection

  3. PaddleSeg

  4. PaddleOCR

  5. PaddleTS

"},{"location":"other_devices_support/how_to_contribute_device.html#2-paddlex","title":"2. \u200b\u66f4\u65b0\u200bPaddleX","text":"

\u200b\u5f53\u200b\u5b8c\u6210\u200b\u786c\u4ef6\u200b\u63a5\u5165\u200b\u98de\u6868\u200b\u548c\u200b\u5404\u4e2a\u200b\u5957\u4ef6\u200b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u66f4\u65b0\u200bPaddleX\u200b\u4e2d\u200b\u786c\u4ef6\u200b\u8bc6\u522b\u200b\u76f8\u5173\u200b\u7684\u200b\u4ee3\u7801\u200b\u548c\u200b\u8bf4\u660e\u200b\u6587\u6863\u200b

"},{"location":"other_devices_support/how_to_contribute_device.html#21","title":"2.1 \u200b\u63a8\u7406\u200b\u80fd\u529b\u200b\u652f\u6301","text":""},{"location":"other_devices_support/how_to_contribute_device.html#211","title":"2.1.1 \u200b\u7248\u672c\u200b\u652f\u6301\u200b\uff08\u200b\u53ef\u200b\u5ffd\u7565\u200b\uff09","text":"

\u200b\u5982\u679c\u200b\u76f8\u5173\u200b\u786c\u4ef6\u200b\u5bf9\u4e8e\u200b\u98de\u6868\u200b\u7248\u672c\u200b\u6709\u200b\u7279\u5b9a\u200b\u8981\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u521d\u59cb\u5316\u200b\u65f6\u200b\u6839\u636e\u200b\u8bbe\u5907\u200b\u4fe1\u606f\u200b\u548c\u200b\u7248\u672c\u4fe1\u606f\u200b\u8fdb\u884c\u200b\u5224\u65ad\u200b\uff0c\u200b\u76f8\u5173\u200b\u4ee3\u7801\u200b\u4f4d\u4e8e\u200b PaddleX\u200b\u521d\u59cb\u5316\u200b\u4e2d\u200b\u7684\u200b _check_paddle_version

"},{"location":"other_devices_support/how_to_contribute_device.html#212","title":"2.1.2 \u200b\u8bbe\u7f6e\u200b\u73af\u5883\u53d8\u91cf\u200b\uff08\u200b\u53ef\u200b\u5ffd\u7565\u200b\uff09","text":"

\u200b\u5982\u679c\u200b\u76f8\u5173\u200b\u786c\u4ef6\u200b\u5728\u200b\u4f7f\u7528\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u8bbe\u5b9a\u200b\u7279\u6b8a\u200b\u7684\u200b\u73af\u5883\u53d8\u91cf\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4fee\u6539\u200b\u8bbe\u5907\u200b\u73af\u5883\u200b\u8bbe\u7f6e\u200b\u4ee3\u7801\u200b\uff0c\u200b\u76f8\u5173\u200b\u4ee3\u7801\u200b\u4f4d\u4e8e\u200b PaddleX\u200b\u73af\u5883\u53d8\u91cf\u200b\u8bbe\u7f6e\u200b\u4e2d\u200b\u7684\u200b set_env_for_device

"},{"location":"other_devices_support/how_to_contribute_device.html#213-predictor","title":"2.1.3 \u200b\u521b\u5efa\u200bPredictor","text":"

PaddleX\u200b\u7684\u200b\u63a8\u7406\u200b\u80fd\u529b\u200b\u57fa\u4e8e\u200b\u98de\u6868\u200bPaddle Inference Predictor\u200b\u63d0\u4f9b\u200b\uff0c\u200b\u521b\u5efa\u200bPredictor\u200b\u65f6\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u8bbe\u5907\u200b\u4fe1\u606f\u200b\u9009\u62e9\u200b\u4e0d\u540c\u200b\u7684\u200b\u786c\u4ef6\u200b\u5e76\u200b\u521b\u5efa\u200bpass\uff0c\u200b\u76f8\u5173\u200b\u4ee3\u7801\u200b\u4f4d\u4e8e\u200bPaddleX Predictor\u200b\u521b\u5efa\u200b\u7684\u200b _create

"},{"location":"other_devices_support/how_to_contribute_device.html#214","title":"2.1.4 \u200b\u66f4\u65b0\u200b\u786c\u4ef6\u200b\u652f\u6301\u200b\u5217\u8868","text":"

\u200b\u521b\u5efa\u200bPredictor\u200b\u65f6\u4f1a\u200b\u5224\u65ad\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5df2\u200b\u652f\u6301\u200b\uff0c\u200b\u76f8\u5173\u200b\u4ee3\u7801\u200b\u4f4d\u4e8e\u200bPaddleX Predictor Option\u200b\u4e2d\u200b\u7684\u200b SUPPORT_DEVICE

"},{"location":"other_devices_support/how_to_contribute_device.html#215","title":"2.1.5 \u200b\u66f4\u65b0\u200b\u591a\u200b\u786c\u4ef6\u200b\u8bf4\u660e\u200b\u6307\u5357","text":"

\u200b\u8bf7\u200b\u66f4\u65b0\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u8bf4\u660e\u200b\u6307\u5357\u200b\uff0c\u200b\u5c06\u200b\u65b0\u200b\u652f\u6301\u200b\u7684\u200b\u786c\u4ef6\u200b\u4fe1\u606f\u200b\u66f4\u65b0\u200b\u5230\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u9700\u8981\u200b\u540c\u65f6\u200b\u66f4\u65b0\u200b\u4e2d\u82f1\u6587\u200b\u7248\u672c\u200b\uff0c\u200b\u4e2d\u6587\u200b\u7248\u672c\u200b PaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b \uff0c\u200b\u82f1\u6587\u200b\u7248\u672c\u200b PaddleX Multi-Hardware Usage Guide

"},{"location":"other_devices_support/how_to_contribute_device.html#216","title":"2.1.6 \u200b\u66f4\u65b0\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u8bf7\u200b\u63d0\u4f9b\u200b\u786c\u4ef6\u200b\u76f8\u5173\u200b\u7684\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\uff0c\u200b\u9700\u8981\u200b\u63d0\u4f9b\u200b\u4e2d\u82f1\u6587\u200b\u7248\u672c\u200b\uff0c\u200b\u4e2d\u6587\u200b\u7248\u672c\u200b\u53c2\u8003\u200b \u200b\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b \uff0c\u200b\u82f1\u6587\u200b\u7248\u672c\u200b\u53c2\u8003\u200b Ascend NPU PaddlePaddle Installation Tutorial

"},{"location":"other_devices_support/how_to_contribute_device.html#217","title":"2.1.7 \u200b\u66f4\u65b0\u200b\u6a21\u578b\u200b\u5217\u8868","text":"

\u200b\u8bf7\u200b\u63d0\u4f9b\u200b\u786c\u4ef6\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u9700\u8981\u200b\u63d0\u4f9b\u200b\u4e2d\u82f1\u6587\u200b\u7248\u672c\u200b\uff0c\u200b\u4e2d\u6587\u200b\u7248\u672c\u200b\u53c2\u8003\u200b PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6607\u200b\u817e\u200b NPU\uff09 \uff0c\u200b\u82f1\u6587\u200b\u7248\u672c\u200b\u53c2\u8003\u200b PaddleX Model List (Huawei Ascend NPU)

"},{"location":"other_devices_support/how_to_contribute_device.html#22","title":"2.2 \u200b\u8bad\u7ec3\u200b\u80fd\u529b\u200b\u652f\u6301","text":"

TODO

"},{"location":"other_devices_support/how_to_contribute_device.html#3-pr","title":"3. \u200b\u63d0\u4ea4\u200bPR","text":"

\u200b\u5f53\u200b\u60a8\u200b\u5b8c\u6210\u200b\u7279\u5b9a\u200b\u786c\u4ef6\u200b\u7684\u200b\u9002\u914d\u200b\u5de5\u4f5c\u200b\u540e\u200b\uff0c\u200b\u8bf7\u200b\u7ed9\u200bPaddleX\u200b\u63d0\u4ea4\u200b\u4e00\u4e2a\u200b Pull Request \u200b\u8bf4\u660e\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u4f1a\u200b\u5bf9\u6a21\u578b\u200b\u8fdb\u884c\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u786e\u8ba4\u200b\u65e0\u200b\u95ee\u9898\u200b\u540e\u200b\u5c06\u200b\u5408\u5165\u200b\u76f8\u5173\u200b\u4ee3\u7801\u200b

\u200b\u76f8\u5173\u200bPR\u200b\u9700\u8981\u200b\u63d0\u4f9b\u200b\u590d\u73b0\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u4fe1\u606f\u200b\uff0c\u200b\u81f3\u5c11\u200b\u5305\u542b\u200b\u4ee5\u4e0b\u5185\u5bb9\u200b\uff1a

  • \u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6240\u7528\u200b\u5230\u200b\u7684\u200b\u8f6f\u4ef6\u200b\u7248\u672c\u200b\uff0c\u200b\u5305\u62ec\u200b\u4f46\u200b\u4e0d\u200b\u9650\u4e8e\u200b\uff1a

  • Paddle\u200b\u7248\u672c\u200b

  • PaddleCustomDevice\u200b\u7248\u672c\u200b\uff08\u200b\u5982\u679c\u200b\u6709\u200b\uff09

  • PaddleX\u200b\u6216\u8005\u200b\u5bf9\u5e94\u200b\u5957\u4ef6\u200b\u7684\u200b\u5206\u652f\u200b

  • \u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6240\u7528\u200b\u5230\u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\uff0c\u200b\u5305\u62ec\u200b\u4f46\u200b\u4e0d\u200b\u9650\u4e8e\u200b\uff1a

  • \u200b\u82af\u7247\u578b\u53f7\u200b

  • \u200b\u7cfb\u7edf\u200b\u7248\u672c\u200b

  • \u200b\u786c\u4ef6\u200b\u9a71\u52a8\u200b\u7248\u672c\u200b

  • \u200b\u7b97\u5b50\u200b\u5e93\u200b\u7248\u672c\u200b\u7b49\u200b

"},{"location":"other_devices_support/how_to_contribute_model.html","title":"1. \u200b\u8d21\u732e\u200b\u6a21\u578b","text":"

\u200b\u98de\u6868\u200b\u751f\u6001\u200b\u7684\u200b\u7e41\u8363\u200b\u79bb\u4e0d\u5f00\u200b\u5f00\u53d1\u8005\u200b\u548c\u200b\u7528\u6237\u200b\u7684\u200b\u8d21\u732e\u200b\uff0c\u200b\u6211\u4eec\u200b\u975e\u5e38\u200b\u6b22\u8fce\u60a8\u200b\u4e3a\u200b\u98de\u6868\u200b\u7684\u200b\u591a\u200b\u786c\u4ef6\u200b\u9002\u914d\u200b\u8d21\u732e\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u4e5f\u200b\u5341\u5206\u200b\u611f\u8c22\u60a8\u200b\u7684\u200b\u53cd\u9988\u200b\u3002

\u200b\u5f53\u524d\u200bPaddleX\u200b\u4e2d\u200b\u5bf9\u4e8e\u200b\u5404\u200b\u786c\u4ef6\u200b\u9002\u914d\u200b\u6a21\u578b\u200b\u7684\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u786e\u8ba4\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u5df2\u7ecf\u200b\u5728\u200b\u5bf9\u5e94\u200b\u786c\u4ef6\u200b\u4e2d\u200b\u8fdb\u884c\u200b\u8fc7\u200b\u9002\u914d\u200b\uff1a

  • \u200b\u6607\u200b\u817e\u200b\u6a21\u578b\u200b\u5217\u8868\u200b

  • \u200b\u6606\u4ed1\u200b\u6a21\u578b\u200b\u5217\u8868\u200b

  • \u200b\u6d77\u5149\u200b\u6a21\u578b\u200b\u5217\u8868\u200b

  • \u200b\u5bd2\u6b66\u7eaa\u200b\u6a21\u578b\u200b\u5217\u8868\u200b

\u200b\u5f53\u524d\u200bPaddleX\u200b\u76f8\u5173\u200b\u6a21\u578b\u200b\u7684\u200b\u6e90\u7801\u200b\u653e\u7f6e\u200b\u5728\u200b\u5404\u4e2a\u200b\u5957\u4ef6\u200b\u4e2d\u200b\uff0c\u200b\u90e8\u5206\u200b\u5957\u4ef6\u200b\u548c\u200b\u6a21\u578b\u200b\u5e76\u672a\u200b\u63a5\u5165\u200bPaddleX\u200b\u4e2d\u200b\uff0c\u200b\u56e0\u6b64\u200b\u5bf9\u6a21\u578b\u200b\u8fdb\u884c\u200b\u9002\u914d\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u52a1\u5fc5\u200b\u4fdd\u8bc1\u200b\u60a8\u200b\u7684\u200b\u6a21\u578b\u200b\u5728\u200bPaddleX\u200b\u4e2d\u200b\u5df2\u7ecf\u200b\u63a5\u5165\u200b\uff0c\u200b\u5f53\u524d\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u89c1\u200b PaddleX\u200b\u6a21\u578b\u5e93\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u6709\u200b\u7279\u6b8a\u200b\u7684\u200b\u6a21\u578b\u200b\u9700\u6c42\u200b\uff0c\u200b\u8bf7\u200b\u63d0\u4ea4\u200b issue \u200b\u544a\u77e5\u200b\u6211\u4eec\u200b\u3002

\u200b\u5982\u679c\u200b\u60a8\u200b\u9002\u914d\u200b\u7684\u200b\u6a21\u578b\u200b\u5728\u200b\u76f8\u5173\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u6d89\u53ca\u200b\u5230\u200b\u6a21\u578b\u200b\u7ec4\u7f51\u200b\u4ee3\u7801\u200b\u7684\u200b\u4fee\u6539\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u63d0\u4ea4\u200b\u4ee3\u7801\u200b\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5957\u4ef6\u200b\u4e2d\u200b\uff0c\u200b\u53c2\u8003\u200b\u5404\u200b\u5957\u4ef6\u200b\u8d21\u732e\u200b\u6307\u5357\u200b\uff1a

  1. PaddleClas

  2. PaddleDetection

  3. PaddleSeg

  4. PaddleOCR

  5. PaddleTS

"},{"location":"other_devices_support/how_to_contribute_model.html#2-issue","title":"2. \u200b\u63d0\u4ea4\u200b\u8bf4\u660e\u200bissue","text":"

\u200b\u5f53\u200b\u60a8\u200b\u5b8c\u6210\u200b\u7279\u5b9a\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u67d0\u6b3e\u200b\u6a21\u578b\u200b\u7684\u200b\u9002\u914d\u200b\u5de5\u4f5c\u200b\u540e\u200b\uff0c\u200b\u8bf7\u200b\u7ed9\u200bPaddleX\u200b\u63d0\u4ea4\u200b\u4e00\u4e2a\u200b issue \u200b\u8bf4\u660e\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u4f1a\u200b\u5bf9\u6a21\u578b\u200b\u8fdb\u884c\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u786e\u8ba4\u200b\u65e0\u200b\u95ee\u9898\u200b\u540e\u200b\u5c06\u200b\u5408\u5165\u200b\u76f8\u5173\u200b\u4ee3\u7801\u200b\u5e76\u200b\u5728\u200b\u6587\u6863\u200b\u4e2d\u200b\u5bf9\u6a21\u578b\u200b\u5217\u8868\u200b\u8fdb\u884c\u200b\u66f4\u65b0\u200b

\u200b\u76f8\u5173\u200bissue\u200b\u9700\u8981\u200b\u63d0\u4f9b\u200b\u590d\u73b0\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u4fe1\u606f\u200b\uff0c\u200b\u81f3\u5c11\u200b\u5305\u542b\u200b\u4ee5\u4e0b\u5185\u5bb9\u200b\uff1a

  • \u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6240\u7528\u200b\u5230\u200b\u7684\u200b\u8f6f\u4ef6\u200b\u7248\u672c\u200b\uff0c\u200b\u5305\u62ec\u200b\u4f46\u200b\u4e0d\u200b\u9650\u4e8e\u200b\uff1a

  • Paddle\u200b\u7248\u672c\u200b

  • PaddleCustomDevice\u200b\u7248\u672c\u200b\uff08\u200b\u5982\u679c\u200b\u6709\u200b\uff09

  • PaddleX\u200b\u6216\u8005\u200b\u5bf9\u5e94\u200b\u5957\u4ef6\u200b\u7684\u200b\u5206\u652f\u200b

  • \u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6240\u7528\u200b\u5230\u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\uff0c\u200b\u5305\u62ec\u200b\u4f46\u200b\u4e0d\u200b\u9650\u4e8e\u200b\uff1a

  • \u200b\u82af\u7247\u578b\u53f7\u200b

  • \u200b\u7cfb\u7edf\u200b\u7248\u672c\u200b

  • \u200b\u786c\u4ef6\u200b\u9a71\u52a8\u200b\u7248\u672c\u200b

  • \u200b\u7b97\u5b50\u200b\u5e93\u200b\u7248\u672c\u200b\u7b49\u200b

"},{"location":"other_devices_support/how_to_contribute_model.html#3","title":"3. \u200b\u66f4\u200b\u591a\u200b\u6587\u6863","text":"

\u200b\u66f4\u200b\u591a\u200b\u5173\u4e8e\u200b\u98de\u6868\u200b\u591a\u200b\u786c\u4ef6\u200b\u9002\u914d\u200b\u548c\u200b\u4f7f\u7528\u200b\u7684\u200b\u76f8\u5173\u200b\u6587\u6863\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b

  • \u200b\u98de\u6868\u200b\u4f7f\u7528\u6307\u5357\u200b

  • \u200b\u98de\u6868\u200b\u786c\u4ef6\u200b\u652f\u6301\u200b

  • PaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b

  • PaddleCustomDevice\u200b\u4ed3\u5e93\u200b

"},{"location":"other_devices_support/multi_devices_use_guide.html","title":"PaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357","text":"

\u200b\u672c\u200b\u6587\u6863\u200b\u4e3b\u8981\u200b\u9488\u5bf9\u200b\u6607\u200b\u817e\u200b NPU\u3001\u200b\u6606\u4ed1\u200b XPU\u3001\u200b\u5bd2\u6b66\u7eaa\u200b MLU\u3001\u200b\u6d77\u5149\u200bDCU \u200b\u786c\u4ef6\u5e73\u53f0\u200b\uff0c\u200b\u4ecb\u7ecd\u200b PaddleX \u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"other_devices_support/multi_devices_use_guide.html#1","title":"1\u3001\u200b\u5b89\u88c5","text":""},{"location":"other_devices_support/multi_devices_use_guide.html#11-paddlepaddle","title":"1.1 PaddlePaddle\u200b\u5b89\u88c5","text":"

\u200b\u9996\u5148\u200b\u8bf7\u200b\u60a8\u200b\u6839\u636e\u200b\u6240\u5c5e\u200b\u786c\u4ef6\u5e73\u53f0\u200b\uff0c\u200b\u5b8c\u6210\u200b\u98de\u6868\u200b PaddlePaddle \u200b\u7684\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5404\u200b\u786c\u4ef6\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6607\u200b\u817e\u200b NPU\uff1a\u200b\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u6606\u4ed1\u200b XPU\uff1a\u200b\u6606\u4ed1\u200b XPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u5bd2\u6b66\u7eaa\u200b MLU\uff1a\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

\u200b\u6d77\u5149\u200b DCU\uff1a\u200b\u6d77\u5149\u200b DCU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b

"},{"location":"other_devices_support/multi_devices_use_guide.html#12-paddlex","title":"1.2 PaddleX\u200b\u5b89\u88c5","text":"

\u200b\u6b22\u8fce\u60a8\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u4f4e\u200b\u4ee3\u7801\u200b\u5f00\u53d1\u5de5\u5177\u200bPaddleX\uff0c\u200b\u5728\u200b\u6211\u4eec\u200b\u6b63\u5f0f\u200b\u5f00\u59cb\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u5148\u200b\u660e\u786e\u200b\u60a8\u200b\u7684\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u9700\u6c42\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

PaddleX\u200b\u4e3a\u200b\u60a8\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\uff1aWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u548c\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\uff0c\u200b\u4e0b\u9762\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u8fd9\u200b\u4e24\u79cd\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u548c\u200b\u5b89\u88c5\u200b\u65b9\u6cd5\u200b\u3002

"},{"location":"other_devices_support/multi_devices_use_guide.html#121-wheel","title":"1.2.1 Wheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b \uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u66f4\u200b\u4fbf\u6377\u200b\u3001\u200b\u66f4\u200b\u8f7b\u91cf\u200b\u7684\u200bWheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200b\u8f7b\u91cf\u7ea7\u200b\u7684\u200bWheel\u200b\u5305\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u5373\u53ef\u200b\u57fa\u4e8e\u200bPaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u6240\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff0c\u200b\u5e76\u200b\u80fd\u200b\u76f4\u63a5\u200b\u96c6\u6210\u200b\u8fdb\u200b\u60a8\u200b\u7684\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002

\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200bWheel\u200b\u5305\u200b\uff1a

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b1-py3-none-any.whl\n
"},{"location":"other_devices_support/multi_devices_use_guide.html#122","title":"1.2.2 \u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f","text":"

\u200b\u82e5\u200b\u60a8\u200b\u4f7f\u7528\u200bPaddleX\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e3a\u200b\u4e8c\u6b21\u5f00\u53d1\u200b \uff0c\u200b\u90a3\u4e48\u200b\u63a8\u8350\u200b\u60a8\u200b\u4f7f\u7528\u200b\u529f\u80fd\u200b\u66f4\u52a0\u200b\u5f3a\u5927\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5b89\u88c5\u200b\u6a21\u5f0f\u200b\u3002

\u200b\u5b89\u88c5\u200b\u60a8\u200b\u9700\u8981\u200b\u7684\u200bPaddleX\u200b\u63d2\u4ef6\u200b\u4e4b\u540e\u200b\uff0c\u200b\u60a8\u200b\u4e0d\u4ec5\u200b\u540c\u6837\u200b\u80fd\u591f\u200b\u5bf9\u200b\u63d2\u4ef6\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u4e0e\u200b\u96c6\u6210\u200b\uff0c\u200b\u8fd8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u5176\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u66f4\u200b\u9ad8\u7ea7\u200b\u7684\u200b\u64cd\u4f5c\u200b\u3002

PaddleX\u200b\u652f\u6301\u200b\u7684\u200b\u63d2\u4ef6\u200b\u5982\u4e0b\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u6839\u636e\u200b\u5f00\u53d1\u200b\u9700\u6c42\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6240\u200b\u9700\u200b\u7684\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff1a

\ud83d\udc49 \u200b\u63d2\u4ef6\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09 \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u6a21\u5757\u200b \u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b PaddleSeg \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b PaddleDetection \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCR \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PaddleOCRPaddleDetection \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b PaddleOCRPaddleDetectionPaddleClas \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b PaddleTS \u200b\u901a\u7528\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b PaddleClas \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PaddleDetection \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b PaddleSeg

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u7684\u200b\u63d2\u4ef6\u200b\u4e3a\u200bPaddleXXX\uff08\u200b\u53ef\u4ee5\u200b\u6709\u200b\u591a\u4e2a\u200b\uff09\uff0c\u200b\u5728\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u5feb\u901f\u200b\u5b89\u88c5\u200bPaddleX\u200b\u7684\u200b\u5bf9\u5e94\u200b\u63d2\u4ef6\u200b\uff1a

# \u200b\u4e0b\u8f7d\u200b PaddleX \u200b\u6e90\u7801\u200b\ngit clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\n\n# \u200b\u5b89\u88c5\u200b PaddleX whl\n# -e\uff1a\u200b\u4ee5\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6a21\u5f0f\u200b\u5b89\u88c5\u200b\uff0c\u200b\u5f53\u524d\u200b\u9879\u76ee\u200b\u7684\u200b\u4ee3\u7801\u200b\u66f4\u6539\u200b\uff0c\u200b\u90fd\u200b\u4f1a\u200b\u76f4\u63a5\u200b\u4f5c\u7528\u200b\u5230\u200b\u5df2\u7ecf\u200b\u5b89\u88c5\u200b\u7684\u200b PaddleX Wheel\npip install -e .\n\n# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleXXX\n
\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200bPaddleOCR\u3001PaddleClas\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u5b89\u88c5\u200b\u63d2\u4ef6\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleOCR\u3001PaddleClas \u200b\u63d2\u4ef6\u200b\npaddlex --install PaddleOCR PaddleClas\n
\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u65e0\u9700\u200b\u586b\u5199\u200b\u5177\u4f53\u200b\u63d2\u4ef6\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u5168\u90e8\u200b\u63d2\u4ef6\u200b\npaddlex --install\n
\u200b\u63d2\u4ef6\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u514b\u9686\u200b\u6e90\u4e3a\u200b github.com\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u652f\u6301\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b--platform \u200b\u6307\u5b9a\u200b\u514b\u9686\u200b\u6e90\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b gitee.com \u200b\u514b\u9686\u200b\u6e90\u200b\u5b89\u88c5\u200b\u5168\u90e8\u200bPaddleX\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff1a

# \u200b\u5b89\u88c5\u200b PaddleX \u200b\u63d2\u4ef6\u200b\npaddlex --install --platform gitee.com\n
\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u5c06\u4f1a\u200b\u6709\u200b\u5982\u4e0b\u200b\u63d0\u793a\u200b\uff1a

All packages are installed.\n
"},{"location":"other_devices_support/multi_devices_use_guide.html#2","title":"2\u3001\u200b\u4f7f\u7528","text":"

\u200b\u57fa\u4e8e\u200b\u6607\u200b\u817e\u200b NPU\u3001\u200b\u5bd2\u6b66\u7eaa\u200b MLU\u3001\u200b\u6606\u4ed1\u200b XPU\u3001\u200b\u6d77\u5149\u200bDCU \u200b\u786c\u4ef6\u5e73\u53f0\u200b\u7684\u200b PaddleX \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u5de5\u5177\u200b\u4f7f\u7528\u200b\u65b9\u6cd5\u200b\u4e0e\u200b GPU \u200b\u76f8\u540c\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u6839\u636e\u200b\u6240\u5c5e\u200b\u786c\u4ef6\u5e73\u53f0\u200b\uff0c\u200b\u4fee\u6539\u200b\u914d\u7f6e\u200b\u8bbe\u5907\u200b\u7684\u200b\u53c2\u6570\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u5de5\u5177\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

"},{"location":"other_devices_support/paddlepaddle_install_DCU.html","title":"\u6d77\u5149\u200b DCU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u6d77\u5149\u200b Z100 \u200b\u7cfb\u5217\u200b\u82af\u7247\u200b\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u53d1\u5e03\u200b\u7684\u200b\u6d77\u5149\u200b DCU \u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\uff0c\u200b\u8be5\u200b\u955c\u50cf\u200b\u9884\u88c5\u200b\u6709\u200b\u6d77\u5149\u200b DCU \u200b\u57fa\u7840\u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\u5e93\u200b\uff08DTK\uff09\u3002

"},{"location":"other_devices_support/paddlepaddle_install_DCU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"

\u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b

docker pull registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310\n
\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b

docker run -it --name paddle-dcu-dev -v `pwd`:/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310 /bin/bash\n
"},{"location":"other_devices_support/paddlepaddle_install_DCU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5728\u200b\u542f\u52a8\u200b\u7684\u200b docker \u200b\u5bb9\u5668\u200b\u4e2d\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u53d1\u5e03\u200b\u7684\u200b wheel \u200b\u5305\u200b\u3002\u200b\u6ce8\u610f\u200b\uff1a\u200b\u98de\u6868\u200b\u6846\u67b6\u200b DCU \u200b\u7248\u4ec5\u200b\u652f\u6301\u200b\u6d77\u5149\u200b C86 \u200b\u67b6\u6784\u200b\u3002

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b wheel \u200b\u5305\u200b\npip install paddlepaddle-rocm -i https://www.paddlepaddle.org.cn/packages/nightly/dcu\n
\u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b \u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b

python -c \"import paddle; paddle.utils.run_check()\"\n
\u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"other_devices_support/paddlepaddle_install_MLU.html","title":"\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u5bd2\u6b66\u7eaa\u200b MLU370X8 \u200b\u82af\u7247\u200b\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\u5b8c\u6210\u200b\u73af\u5883\u200b\u51c6\u5907\u200b\u3002

"},{"location":"other_devices_support/paddlepaddle_install_MLU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"

\u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b

# \u200b\u9002\u7528\u200b\u4e8e\u200b X86 \u200b\u67b6\u6784\u200b\uff0c\u200b\u6682\u65f6\u200b\u4e0d\u200b\u63d0\u4f9b\u200b Arch64 \u200b\u67b6\u6784\u200b\u955c\u50cf\u200b\ndocker pull registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310\n
\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b

docker run -it --name paddle-mlu-dev -v $(pwd):/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v /usr/bin/cnmon:/usr/bin/cnmon \\\n  registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310 /bin/bash\n
"},{"location":"other_devices_support/paddlepaddle_install_MLU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5728\u200b\u542f\u52a8\u200b\u7684\u200b docker \u200b\u5bb9\u5668\u200b\u4e2d\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b\u5b98\u7f51\u200b\u53d1\u5e03\u200b\u7684\u200b wheel \u200b\u5305\u200b\u3002\u200b\u5f53\u524d\u200b\u63d0\u4f9b\u200b Python3.10 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b\u3002\u200b\u5982\u200b\u6709\u200b\u5176\u4ed6\u200b Python \u200b\u7248\u672c\u200b\u9700\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u81ea\u884c\u200b\u7f16\u8bd1\u200b\u5b89\u88c5\u200b\u3002

# \u200b\u4e0b\u8f7d\u200b\u5e76\u200b\u5b89\u88c5\u200b wheel \u200b\u5305\u200b\n# \u200b\u6ce8\u610f\u200b\u9700\u8981\u200b\u5148\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b cpu \u200b\u7248\u672c\u200b\npython -m pip install paddlepaddle==3.0.0.dev20240624 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython -m pip install paddle-custom-mlu==3.0.0.dev20240806 -i https://www.paddlepaddle.org.cn/packages/nightly/mlu/\n
\u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b \u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b

python -c \"import paddle; paddle.utils.run_check()\"\n
\u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b

Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 mlu.\nPaddlePaddle works well on 16 mlus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"other_devices_support/paddlepaddle_install_NPU.html","title":"\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u6607\u200b\u817e\u200b 910B \u200b\u82af\u7247\u200b\uff08\u200b\u66f4\u200b\u591a\u200b\u578b\u53f7\u200b\u8fd8\u200b\u5728\u200b\u652f\u6301\u200b\u4e2d\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u6709\u200b\u5176\u4ed6\u200b\u578b\u53f7\u200b\u7684\u200b\u76f8\u5173\u200b\u9700\u6c42\u200b\uff0c\u200b\u8bf7\u200b\u63d0\u4ea4\u200bissue\u200b\u544a\u77e5\u200b\u6211\u4eec\u200b\uff09\uff0c\u200b\u6607\u200b\u817e\u200b\u9a71\u52a8\u200b\u7248\u672c\u200b\u4e3a\u200b 23.0.3\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6607\u200b\u817e\u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\u5b8c\u6210\u200b\u73af\u5883\u200b\u51c6\u5907\u200b\u3002

"},{"location":"other_devices_support/paddlepaddle_install_NPU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"
  • \u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u5df2\u7ecf\u200b\u9ed8\u8ba4\u200b\u5b89\u88c5\u200b\u4e86\u200b\u6607\u200b\u817e\u200b\u7b97\u5b50\u200b\u5e93\u200b CANN-8.0.T13\u3002
    # \u200b\u9002\u7528\u200b\u4e8e\u200b X86 \u200b\u67b6\u6784\u200b\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-x86_64-gcc84-py39\n# \u200b\u9002\u7528\u200b\u4e8e\u200b Aarch64 \u200b\u67b6\u6784\u200b\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-aarch64-gcc84-py39\n
  • \u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b\uff0cASCEND_RT_VISIBLE_DEVICES \u200b\u6307\u5b9a\u200b\u53ef\u89c1\u200b\u7684\u200b NPU \u200b\u5361\u53f7\u200b
    docker run -it --name paddle-npu-dev -v $(pwd):/work \\\n    --privileged --network=host --shm-size=128G -w=/work \\\n    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \\\n    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\\n    -v /usr/local/dcmi:/usr/local/dcmi \\\n    -e ASCEND_RT_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" \\\n    registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-$(uname -m)-gcc84-py39 /bin/bash\n
"},{"location":"other_devices_support/paddlepaddle_install_NPU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5f53\u524d\u200b\u63d0\u4f9b\u200b Python3.9 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b\u3002\u200b\u5982\u200b\u6709\u200b\u5176\u4ed6\u200b Python \u200b\u7248\u672c\u200b\u9700\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u81ea\u884c\u200b\u7f16\u8bd1\u200b\u5b89\u88c5\u200b\u3002

  • \u200b\u4e0b\u8f7d\u5b89\u88c5\u200b Python3.9 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b
    # \u200b\u6ce8\u610f\u200b\u9700\u8981\u200b\u5148\u200b\u5b89\u88c5\u200b\u98de\u6868\u200b cpu \u200b\u7248\u672c\u200b\npython3.9 -m pip install paddlepaddle==3.0.0.dev20240520 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython3.9 -m pip install paddle_custom_npu==3.0.0.dev20240719 -i https://www.paddlepaddle.org.cn/packages/nightly/npu/\n
  • \u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b
    python -c \"import paddle; paddle.utils.run_check()\"\n
    \u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b
Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 npu.\nPaddlePaddle works well on 8 npus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"other_devices_support/paddlepaddle_install_XPU.html","title":"\u6606\u4ed1\u200b XPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b","text":"

\u200b\u5f53\u524d\u200b PaddleX \u200b\u652f\u6301\u200b\u6606\u4ed1\u200b R200/R300 \u200b\u7b49\u200b\u82af\u7247\u200b\u3002\u200b\u8003\u8651\u200b\u5230\u200b\u73af\u5883\u200b\u5dee\u5f02\u6027\u200b\uff0c\u200b\u6211\u4eec\u200b\u63a8\u8350\u200b\u4f7f\u7528\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u53d1\u5e03\u200b\u7684\u200b\u6606\u4ed1\u200b XPU \u200b\u5f00\u53d1\u200b\u955c\u50cf\u200b\uff0c\u200b\u8be5\u200b\u955c\u50cf\u200b\u9884\u88c5\u200b\u6709\u200b\u6606\u4ed1\u200b\u57fa\u7840\u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\u5e93\u200b\uff08XRE\uff09\u3002

"},{"location":"other_devices_support/paddlepaddle_install_XPU.html#1docker","title":"1\u3001docker\u200b\u73af\u5883\u200b\u51c6\u5907","text":"

\u200b\u62c9\u53d6\u200b\u955c\u50cf\u200b\uff0c\u200b\u6b64\u200b\u955c\u50cf\u200b\u4ec5\u4e3a\u200b\u5f00\u53d1\u200b\u73af\u5883\u200b\uff0c\u200b\u955c\u50cf\u200b\u4e2d\u200b\u4e0d\u200b\u5305\u542b\u200b\u9884\u200b\u7f16\u8bd1\u200b\u7684\u200b\u98de\u6868\u200b\u5b89\u88c5\u5305\u200b

docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # X86 \u200b\u67b6\u6784\u200b\ndocker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # ARM \u200b\u67b6\u6784\u200b\n
\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u542f\u52a8\u200b\u5bb9\u5668\u200b

docker run -it --name=xxx -m 81920M --memory-swap=81920M \\\n    --shm-size=128G --privileged --net=host \\\n    -v $(pwd):/workspace -w /workspace \\\n    registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash\n
"},{"location":"other_devices_support/paddlepaddle_install_XPU.html#2paddle","title":"2\u3001\u200b\u5b89\u88c5\u200bpaddle\u200b\u5305","text":"

\u200b\u5f53\u524d\u200b\u63d0\u4f9b\u200b Python3.10 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b\u3002\u200b\u5982\u200b\u6709\u200b\u5176\u4ed6\u200b Python \u200b\u7248\u672c\u200b\u9700\u6c42\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u98de\u6868\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u81ea\u884c\u200b\u7f16\u8bd1\u200b\u5b89\u88c5\u200b\u3002

\u200b\u5b89\u88c5\u200b Python3.10 \u200b\u7684\u200b wheel \u200b\u5b89\u88c5\u5305\u200b

pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # X86 \u200b\u67b6\u6784\u200b\npip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # ARM \u200b\u67b6\u6784\u200b\n
\u200b\u9a8c\u8bc1\u200b\u5b89\u88c5\u5305\u200b \u200b\u5b89\u88c5\u200b\u5b8c\u6210\u200b\u4e4b\u540e\u200b\uff0c\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b

python -c \"import paddle; paddle.utils.run_check()\"\n
\u200b\u9884\u671f\u200b\u5f97\u5230\u200b\u5982\u4e0b\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"pipeline_deploy/edge_deploy.html","title":"PaddleX \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u4f7f\u7528\u6307\u5357","text":"
  • PaddleX \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u4f7f\u7528\u6307\u5357\u200b
  • \u200b\u5b89\u88c5\u200b\u6d41\u7a0b\u200b\u4e0e\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b
    • \u200b\u73af\u5883\u200b\u51c6\u5907\u200b
    • \u200b\u7269\u6599\u200b\u51c6\u5907\u200b
    • \u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b
  • \u200b\u53c2\u8003\u8d44\u6599\u200b
  • \u200b\u53cd\u9988\u200b\u4e13\u533a\u200b

\u200b\u672c\u200b\u6307\u5357\u200b\u4e3b\u8981\u200b\u4ecb\u7ecd\u200b PaddleX \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u5728\u200b Android shell \u200b\u4e0a\u200b\u7684\u200b\u8fd0\u884c\u200b\u65b9\u6cd5\u200b\u3002 \u200b\u672c\u200b\u6307\u5357\u200b\u9002\u7528\u200b\u4e8e\u200b\u4e0b\u5217\u200b 6 \u200b\u79cd\u200b\u6a21\u5757\u200b\u7684\u200b 8 \u200b\u4e2a\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u5757\u200b \u200b\u5177\u4f53\u200b\u6a21\u578b\u200b CPU GPU \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b PicoDet-S \u2705 \u2705 PicoDet-L \u2705 \u2705 \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b PicoDet_layout_1x \u2705 \u2705 \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b PP-LiteSeg-T \u2705 \u2705 \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b PP-LCNet_x1_0 \u2705 \u2705 MobileNetV3_small_x1_0 \u2705 \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b PP-OCRv4_mobile_det \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PP-OCRv4_mobile_rec \u2705

\u200b\u5907\u6ce8\u200b - GPU \u200b\u6307\u200b\u7684\u200b\u662f\u200b \u200b\u4f7f\u7528\u200b OpenCL \u200b\u5c06\u200b\u8ba1\u7b97\u200b\u6620\u5c04\u200b\u5230\u200b GPU \u200b\u4e0a\u200b\u6267\u884c\u200b \uff0c\u200b\u4ee5\u200b\u5145\u5206\u5229\u7528\u200b GPU \u200b\u786c\u4ef6\u200b\u7b97\u529b\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u63a8\u7406\u200b\u6027\u80fd\u200b\u3002

"},{"location":"pipeline_deploy/edge_deploy.html#_1","title":"\u5b89\u88c5\u200b\u6d41\u7a0b\u200b\u4e0e\u200b\u4f7f\u7528\u200b\u65b9\u5f0f","text":""},{"location":"pipeline_deploy/edge_deploy.html#_2","title":"\u73af\u5883\u200b\u51c6\u5907","text":"
  1. \u200b\u5728\u200b\u672c\u5730\u200b\u73af\u5883\u200b\u5b89\u88c5\u200b\u597d\u200b CMake \u200b\u7f16\u8bd1\u200b\u5de5\u5177\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b\u5f53\u524d\u200b\u7cfb\u7edf\u200b\u7b26\u5408\u8981\u6c42\u200b\u7684\u200b\u7248\u672c\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b Mac \u200b\u4e0a\u200b\u5f00\u53d1\u200b\uff0c\u200b\u9700\u8981\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b Mac \u200b\u5e73\u53f0\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002

    \u200b\u73af\u5883\u200b\u8981\u6c42\u200b - CMake >= 3.10\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b 3.20 \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09 - Android NDK >= r17c\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b r20b \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09

    \u200b\u672c\u200b\u6307\u5357\u200b\u6240\u200b\u4f7f\u7528\u200b\u7684\u200b\u6d4b\u8bd5\u73af\u5883\u200b\uff1a - cmake == 3.20.0 - android-ndk == r20b

  2. \u200b\u51c6\u5907\u200b\u4e00\u90e8\u200b Android \u200b\u624b\u673a\u200b\uff0c\u200b\u5e76\u200b\u5f00\u542f\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002\u200b\u5f00\u542f\u200b\u65b9\u6cd5\u200b: \u200b\u624b\u673a\u200b\u8bbe\u7f6e\u200b -> \u200b\u67e5\u627e\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b -> \u200b\u6253\u5f00\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b\u548c\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002

  3. \u200b\u7535\u8111\u200b\u4e0a\u200b\u5b89\u88c5\u200b ADB \u200b\u5de5\u5177\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8c03\u8bd5\u200b\u3002ADB \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

    3.1. Mac \u200b\u7535\u8111\u200b\u5b89\u88c5\u200b ADB

     brew cask install android-platform-tools\n

    3.2. Linux \u200b\u5b89\u88c5\u200b ADB

     # debian\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo apt update\n sudo apt install -y wget adb\n\n # redhat\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo yum install adb\n

    3.3. Windows \u200b\u5b89\u88c5\u200b ADB

    win \u200b\u4e0a\u200b\u5b89\u88c5\u200b\u9700\u8981\u200b\u53bb\u200b\u8c37\u6b4c\u200b\u7684\u200b\u5b89\u5353\u200b\u5e73\u53f0\u200b\u4e0b\u8f7d\u200b ADB \u200b\u8f6f\u4ef6\u5305\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\uff1a\u200b\u94fe\u63a5\u200b

    \u200b\u6253\u5f00\u200b\u7ec8\u7aef\u200b\uff0c\u200b\u624b\u673a\u200b\u8fde\u63a5\u200b\u7535\u8111\u200b\uff0c\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4e2d\u200b\u8f93\u5165\u200b

     adb devices\n

    \u200b\u5982\u679c\u200b\u6709\u200b device \u200b\u8f93\u51fa\u200b\uff0c\u200b\u5219\u200b\u8868\u793a\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u3002

     List of devices attached\n 744be294    device\n
"},{"location":"pipeline_deploy/edge_deploy.html#_3","title":"\u7269\u6599\u200b\u51c6\u5907","text":"
  1. \u200b\u514b\u9686\u200b Paddle-Lite-Demo \u200b\u4ed3\u5e93\u200b\u7684\u200b feature/paddle-x \u200b\u5206\u652f\u200b\u5230\u200b PaddleX-Lite-Deploy \u200b\u76ee\u5f55\u200b\u3002

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. \u200b\u586b\u5199\u200b \u200b\u95ee\u5377\u200b \u200b\u4e0b\u8f7d\u200b\u538b\u7f29\u5305\u200b\uff0c\u200b\u5c06\u200b\u538b\u7f29\u5305\u200b\u653e\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\u540e\u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\u3002

    • object_detection\uff08\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff09\u200b\u95ee\u5377\u200b
    • semantic_segmentation\uff08\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\uff09\u200b\u95ee\u5377\u200b
    • image_classification\uff08\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff09\u200b\u95ee\u5377\u200b
    • ocr\uff08\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\uff09\u200b\u95ee\u5377\u200b

    \u200b\u4e0b\u9762\u200b\u662f\u200b object_detection \u200b\u89e3\u538b\u200b\u64cd\u4f5c\u200b\u793a\u4f8b\u200b\uff0c\u200b\u5176\u4ed6\u200b\u4efb\u52a1\u200b\u53ef\u200b\u53c2\u8003\u200b\u540e\u9762\u200b\u7684\u200b\u8868\u683c\u200b\u3002

    # 1. \u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\ncd PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection\n\n# 2. \u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\nunzip object_detection.zip\n

    \u200b\u4efb\u52a1\u200b\u540d\u200b \u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b \u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b object_detection PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection unzip object_detection.zip semantic_segmentation PaddleX-Lite-Deploy/semantic_segmentation/android/shell/cxx/semantic_segmentation unzip semantic_segmentation.zip image_classification PaddleX-Lite-Deploy/image_classification/android/shell/cxx/image_classification unzip image_classification.zip ocr PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo unzip ocr.zip

"},{"location":"pipeline_deploy/edge_deploy.html#_4","title":"\u90e8\u7f72\u200b\u6b65\u9aa4","text":"
  1. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX_Lite_Deploy/libs\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u6240\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\u3002\u200b\u6b64\u200b\u6b65\u9aa4\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u4e00\u6b21\u200b\uff0c\u200b\u5373\u53ef\u200b\u652f\u6301\u200b\u6bcf\u4e2a\u200b demo \u200b\u4f7f\u7528\u200b\u3002

  2. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX_Lite_Deploy/{Task_Name}/assets\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b \u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u3001\u200b\u6d4b\u8bd5\u200b\u56fe\u7247\u200b\u548c\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\u7b49\u200b\u3002

  3. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX_Lite_Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}\uff0c\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\u548c\u200b\u8fd0\u884c\u200b\u3002

  4. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}\uff0c\u200b\u8fd0\u884c\u200b run.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u5728\u200b\u7aef\u4fa7\u200b\u7684\u200b\u9884\u6d4b\u200b\u3002

    \u200b\u6ce8\u610f\u200b\uff1a - Pipeline_Name \u200b\u548c\u200b Demo_Name \u200b\u4e3a\u200b\u5360\u4f4d\u200b\u7b26\u200b\uff0c\u200b\u5177\u4f53\u200b\u503c\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u7684\u200b\u8868\u683c\u200b\u3002 - download.sh \u200b\u548c\u200b run.sh \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u6a21\u578b\u200b\u540d\u6765\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u200b\u4e0d\u200b\u6307\u5b9a\u200b\u5219\u200b\u4f7f\u7528\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u3002\u200b\u76ee\u524d\u200b\u9002\u914d\u200b\u7684\u200b\u6a21\u578b\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u8868\u683c\u200b\u7684\u200b Model_Name \u200b\u5217\u200b\u3002 - \u200b\u82e5\u60f3\u200b\u4f7f\u7528\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u8f6c\u6362\u65b9\u6cd5\u200b \u200b\u5f97\u5230\u200b .nb \u200b\u6a21\u578b\u200b\uff0c\u200b\u653e\u5230\u200bPaddleX_Lite_Deploy/{Pipeline_Name}/assets/{Model_Name}\u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c Model_Name\u200b\u4e3a\u200b\u6a21\u578b\u200b\u540d\u200b\uff0c\u200b\u4f8b\u5982\u200b PaddleX_Lite_Deploy/object_detection/assets/PicoDet-L\u3002 - \u200b\u5728\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b NDK_ROOT \u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e3a\u200b\u5b9e\u9645\u200b\u5b89\u88c5\u200b\u7684\u200b NDK \u200b\u8def\u5f84\u200b\u3002 - \u200b\u5728\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\u65f6\u9700\u200b\u4fdd\u6301\u200b ADB \u200b\u8fde\u63a5\u200b\u3002 - \u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b Git Bash \u200b\u6267\u884c\u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b\u3002 - \u200b\u82e5\u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b windows\u3002 - \u200b\u82e5\u200b\u5728\u200b Mac \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b darwin\u3002

\u200b\u4ee5\u4e0b\u200b\u4e3a\u200b object_detection \u200b\u7684\u200b\u793a\u4f8b\u200b\uff0c\u200b\u5176\u4ed6\u200b demo \u200b\u9700\u200b\u6309\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u7684\u200b\u8868\u683c\u200b\u6539\u53d8\u200b\u7b2c\u4e8c\u6b65\u200b\u548c\u200b\u7b2c\u4e09\u6b65\u200b\u6240\u200b\u5207\u6362\u200b\u7684\u200b\u76ee\u5f55\u200b\u3002

 # 1. \u200b\u4e0b\u8f7d\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\n cd PaddleX_Lite_Deploy/libs\n sh download.sh\n\n # 2. \u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u3001\u200b\u6d4b\u8bd5\u200b\u56fe\u7247\u200b\u3001\u200b\u6807\u7b7e\u200b\u6587\u4ef6\u200b\n cd ../object_detection/assets\n sh download.sh\n # \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u6a21\u578b\u200b\u540d\u6765\u200b\u6307\u5b9a\u200b\u4e0b\u8f7d\u200b\u7684\u200b\u6a21\u578b\u200b \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u8868\u683c\u200b\u7684\u200b Model_Name \u200b\u5217\u200b\n # sh download.sh PicoDet-L\n\n # 3. \u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\n cd ../android/app/shell/cxx/picodet_detection\n sh build.sh\n\n # 4. \u200b\u9884\u6d4b\u200b\n sh run.sh\n # \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u6a21\u578b\u200b\u540d\u6765\u200b\u6307\u5b9a\u200b\u9884\u6d4b\u200b\u7684\u200b\u6a21\u578b\u200b \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u53ef\u200b\u53c2\u8003\u200b\u672c\u200b\u8282\u200b\u6700\u540e\u200b\u8868\u683c\u200b\u7684\u200b Model_Name \u200b\u5217\u200b\n # sh run.sh PicoDet-L\n

\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\u6240\u793a\u200b\uff0c\u200b\u5e76\u200b\u751f\u6210\u200b\u4e00\u5f20\u200b\u540d\u53eb\u200b dog_picodet_detection_result.jpg \u200b\u7684\u200b\u7ed3\u679c\u200b\u56fe\u200b\uff1a

======= benchmark summary =======\ninput_shape(s) (NCHW): {1, 3, 320, 320}\nmodel_dir:./models/PicoDet-S/model.nb\nwarmup:1\nrepeats:10\npower_mode:1\nthread_num:0\n<b>* time info(ms) </b>*\n1st_duration:320.086\nmax_duration:277.331\nmin_duration:272.67\navg_duration:274.91\n\n====== output summary ======\ndetection, image size: 768, 576, detect object: bicycle, score: 0.905929, location: x=125, y=120, width=441, height=304\ndetection, image size: 768, 576, detect object: truck, score: 0.653789, location: x=465, y=72, width=230, height=98\ndetection, image size: 768, 576, detect object: dog, score: 0.731584, location: x=128, y=222, width=182, height=319\n

\u200b\u672c\u200b\u8282\u200b\u63cf\u8ff0\u200b\u7684\u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b\u9002\u7528\u200b\u4e8e\u200b\u4e0b\u8868\u4e2d\u200b\u5217\u4e3e\u200b\u7684\u200b demo\uff1a

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b Pipeline_Name \u200b\u6a21\u5757\u200b Demo_Name \u200b\u5177\u4f53\u200b\u6a21\u578b\u200b Model_Name \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b object_detection \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b picodet_detection PicoDet-S PicoDet-S\uff08default\uff09PicoDet-S_gpu PicoDet-L PicoDet-LPicoDet-L_gpu PicoDet_layout_1x PicoDet_layout_1xPicoDet_layout_1x_gpu \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b semantic_segmentation \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b semantic_segmentation PP-LiteSeg-T PP-LiteSeg-T\uff08default\uff09PP-LiteSeg-T_gpu \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b image_classification \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b image_classification PP-LCNet_x1_0 PP-LCNet_x1_0\uff08default\uff09PP-LCNet_x1_0_gpu MobileNetV3_small_x1_0 MobileNetV3_small_x1_0MobileNetV3_small_x1_0_gpu \u200b\u901a\u7528\u200bOCR ocr \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b ppocr_demo PP-OCRv4_mobile_det PP-OCRv4_mobile_det \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b PP-OCRv4_mobile_rec PP-OCRv4_mobile_rec

\u200b\u5907\u6ce8\u200b - \u200b\u76ee\u524d\u200b\u6ca1\u6709\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo\uff0c\u200b\u56e0\u6b64\u200b\u590d\u7528\u200b picodet_detectiondemo \u200b\u6765\u200b\u90e8\u7f72\u200bPicoDet_layout_1x\u200b\u6a21\u578b\u200b\u3002

"},{"location":"pipeline_deploy/edge_deploy.html#_5","title":"\u53c2\u8003\u8d44\u6599","text":"

\u200b\u672c\u200b\u6307\u5357\u200b\u4ec5\u200b\u4ecb\u7ecd\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b demo \u200b\u7684\u200b\u57fa\u672c\u200b\u5b89\u88c5\u200b\u3001\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u82e5\u200b\u60f3\u8981\u200b\u4e86\u89e3\u200b\u66f4\u200b\u7ec6\u81f4\u200b\u7684\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5982\u200b\u4ee3\u7801\u200b\u4ecb\u7ecd\u200b\u3001\u200b\u4ee3\u7801\u200b\u8bb2\u89e3\u200b\u3001\u200b\u66f4\u65b0\u200b\u6a21\u578b\u200b\u3001\u200b\u66f4\u65b0\u200b\u8f93\u5165\u200b\u548c\u200b\u8f93\u51fa\u200b\u9884\u5904\u7406\u200b\u3001\u200b\u66f4\u65b0\u200b\u9884\u6d4b\u200b\u5e93\u200b\u7b49\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b\u4e0b\u5217\u200b\u6587\u6863\u200b\uff1a

  • object_detection\uff08\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\uff09
  • semantic_segmentation\uff08\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\uff09
  • image_classification\uff08\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff09
  • ocr\uff08\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\uff09
"},{"location":"pipeline_deploy/edge_deploy.html#_6","title":"\u53cd\u9988\u200b\u4e13\u533a","text":"

\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b\u6301\u7eed\u200b\u4f18\u5316\u200b\u4e2d\u200b\uff0c\u200b\u6b22\u8fce\u200b\u63d0\u200b issue \u200b\u53cd\u9988\u200b\u95ee\u9898\u200b\u4e0e\u200b\u9700\u6c42\u200b\uff0c\u200b\u6211\u4eec\u200b\u4f1a\u200b\u53ca\u65f6\u200b\u8ddf\u8fdb\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html","title":"PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357","text":"

\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\u3002\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u9996\u5148\u200b\u4ecb\u7ecd\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u5b89\u88c5\u200b\u548c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u7136\u540e\u200b\u5217\u4e3e\u200b\u76ee\u524d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e0e\u200b\u6a21\u578b\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#1","title":"1.\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u5b89\u88c5\u200b\u4e0e\u200b\u4f7f\u7528","text":"

\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b \u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\uff0c\u200b\u4e14\u200b\u6309\u7167\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u6216\u200bPaddleX\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u8dd1\u901a\u200b\u4e86\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#11","title":"1.1 \u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u4e0b\u8868\u4e2d\u200b\u6839\u636e\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b\u3001\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3001Python \u200b\u7248\u672c\u200b\u7b49\u200b\u4fe1\u606f\u200b\uff0c\u200b\u627e\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u5e76\u200b\u5728\u200b\u90e8\u7f72\u200b\u73af\u5883\u200b\u4e2d\u200b\u6267\u884c\u200b\u3002\u200b\u8bf7\u200b\u5c06\u200b {paddlex \u200b\u7248\u672c\u53f7\u200b} \u200b\u66ff\u6362\u200b\u4e3a\u200b\u5b9e\u9645\u200b\u7684\u200b paddlex \u200b\u7684\u200b\u7248\u672c\u53f7\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5f53\u524d\u200b\u6700\u65b0\u200b\u7684\u200b\u7a33\u5b9a\u200b\u7248\u672c\u200b 3.0.0b2\u3002\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5f00\u53d1\u200b\u5206\u652f\u200b\u5bf9\u5e94\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u8bf7\u200b\u5c06\u200b {paddlex \u200b\u7248\u672c\u53f7\u200b} \u200b\u66ff\u6362\u200b\u4e3a\u200b 0.0.0.dev0\u3002

\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b \u200b\u64cd\u4f5c\u7cfb\u7edf\u200b \u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b Python \u200b\u7248\u672c\u200b \u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0\uff08CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6\uff09 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex \u200b\u7248\u672c\u53f7\u200b}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • \u200b\u5bf9\u4e8e\u200b Linux \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u4f7f\u7528\u200b Bash \u200b\u6267\u884c\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u3002
  • \u200b\u5f53\u200b\u4f7f\u7528\u200b NVIDIA GPU \u200b\u65f6\u200b\uff0c\u200b\u8bf7\u200b\u4f7f\u7528\u200b\u4e0e\u200b\u73af\u5883\u200b\u5339\u914d\u200b\u7684\u200b CUDA \u200b\u548c\u200b cuDNN \u200b\u7248\u672c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5426\u5219\u200b\uff0c\u200b\u5c06\u200b\u65e0\u6cd5\u200b\u6b63\u5e38\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002
  • \u200b\u5f53\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200b CPU \u200b\u65f6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4ec5\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff1b\u200b\u5bf9\u4e8e\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5219\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u6216\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u3002
"},{"location":"pipeline_deploy/high_performance_inference.html#12","title":"1.2 \u200b\u83b7\u53d6\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u6fc0\u6d3b","text":"

\u200b\u5728\u200b \u200b\u98de\u6868\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b-\u200b\u4eba\u5de5\u667a\u80fd\u200b\u5b66\u4e60\u200b\u4e0e\u200b\u5b9e\u8bad\u200b\u793e\u533a\u200b \u200b\u9875\u9762\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u5e8f\u5217\u53f7\u200b\u54a8\u8be2\u200b\u4e0e\u200b\u83b7\u53d6\u200b\u201d\u200b\u90e8\u5206\u200b\u9009\u62e9\u200b\u201c\u200b\u7acb\u5373\u200b\u83b7\u53d6\u200b\u201d\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u90e8\u7f72\u200b\u7684\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5e76\u200b\u70b9\u51fb\u200b\u201c\u200b\u83b7\u53d6\u200b\u201d\u3002\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u9875\u9762\u200b\u4e0b\u65b9\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200bSDK\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u201d\u200b\u90e8\u5206\u200b\u627e\u5230\u200b\u83b7\u53d6\u200b\u5230\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\uff1a

\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002PaddleX \u200b\u63d0\u4f9b\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u548c\u200b\u5728\u7ebf\u200b\u6fc0\u6d3b\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff08\u200b\u5747\u200b\u53ea\u200b\u652f\u6301\u200b Linux \u200b\u7cfb\u7edf\u200b\uff09\uff1a

  • \u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u53ca\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u4f7f\u200b\u7a0b\u5e8f\u200b\u81ea\u52a8\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002
  • \u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u6309\u7167\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u754c\u9762\u200b\u4e2d\u200b\u7684\u200b\u6307\u5f15\u200b\uff08\u200b\u70b9\u51fb\u200b\u201c\u200b\u64cd\u4f5c\u200b\u201d\u200b\u4e2d\u200b\u7684\u200b\u201c\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u201d\uff09\uff0c\u200b\u83b7\u53d6\u200b\u673a\u5668\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\u7ed1\u5b9a\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u8bc1\u4e66\u200b\uff0c\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u4f7f\u7528\u200b\u8fd9\u79cd\u200b\u6fc0\u6d3b\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u5c06\u200b\u8bc1\u4e66\u200b\u5b58\u653e\u200b\u5728\u200b\u673a\u5668\u200b\u7684\u200b ${HOME}/.baidu/paddlex/licenses \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff08\u200b\u5982\u679c\u200b\u76ee\u5f55\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u521b\u5efa\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u5e8f\u5217\u53f7\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u5230\u200b\u552f\u4e00\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u4e14\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u4e00\u6b21\u200b\u3002\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u7528\u6237\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u673a\u5668\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b\u6bcf\u53f0\u200b\u673a\u5668\u200b\u51c6\u5907\u200b\u5355\u72ec\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002
"},{"location":"pipeline_deploy/high_performance_inference.html#13","title":"1.3 \u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5bf9\u4e8e\u200b Linux \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b Docker \u200b\u5bb9\u5668\u200b\u4e2d\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8bf7\u200b\u4e3a\u200b\u5bb9\u5668\u200b\u6302\u8f7d\u200b\u5bbf\u4e3b\u673a\u200b\u7684\u200b /dev/disk/by-uuid \u200b\u4e0e\u200b ${HOME}/.baidu/paddlex/licenses \u200b\u76ee\u5f55\u200b\u3002

\u200b\u5bf9\u4e8e\u200b PaddleX CLI\uff0c\u200b\u6307\u5b9a\u200b --use_hpip\uff0c\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u5e8f\u5217\u53f7\u200b\uff0c\u200b\u5373\u53ef\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002\u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u65f6\u200b\uff0c\u200b\u9700\u200b\u6307\u5b9a\u200b --update_license\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n\n# \u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\npaddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n    --update_license\n

\u200b\u5bf9\u4e8e\u200b PaddleX Python API\uff0c\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u65b9\u6cd5\u200b\u7c7b\u4f3c\u200b\u3002\u200b\u4ecd\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"image_classification\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": \"{\u200b\u5e8f\u5217\u53f7\u200b}\"},\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\n

\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5f97\u5230\u200b\u7684\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u672a\u200b\u542f\u7528\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u4e00\u81f4\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u9996\u6b21\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\uff0c\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u82b1\u8d39\u200b\u8f83\u957f\u65f6\u95f4\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u6784\u5efa\u200b\u3002PaddleX \u200b\u5c06\u200b\u5728\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u7b2c\u4e00\u6b21\u200b\u6784\u5efa\u200b\u5b8c\u6210\u200b\u540e\u200b\u5c06\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7f13\u5b58\u200b\u5728\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u540e\u7eed\u200b\u590d\u7528\u200b\u7f13\u5b58\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u4ee5\u200b\u63d0\u5347\u200b\u521d\u59cb\u5316\u200b\u901f\u5ea6\u200b\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#14","title":"1.4 \u200b\u4fee\u6539\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u914d\u7f6e","text":"

PaddleX \u200b\u7ed3\u5408\u200b\u6a21\u578b\u200b\u4fe1\u606f\u200b\u4e0e\u200b\u8fd0\u884c\u200b\u73af\u5883\u200b\u4fe1\u606f\u200b\u4e3a\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u914d\u7f6e\u200b\u3002\u200b\u8fd9\u4e9b\u200b\u9ed8\u8ba4\u200b\u914d\u7f6e\u200b\u7ecf\u8fc7\u200b\u7cbe\u5fc3\u200b\u51c6\u5907\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u5728\u200b\u6570\u4e2a\u200b\u5e38\u89c1\u200b\u573a\u666f\u200b\u4e2d\u200b\u53ef\u7528\u200b\uff0c\u200b\u4e14\u200b\u80fd\u591f\u200b\u53d6\u5f97\u200b\u8f83\u4f18\u200b\u7684\u200b\u6027\u80fd\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u901a\u5e38\u200b\u7528\u6237\u200b\u53ef\u80fd\u200b\u5e76\u200b\u4e0d\u7528\u200b\u5173\u5fc3\u200b\u5982\u4f55\u200b\u8fd9\u4e9b\u200b\u914d\u7f6e\u200b\u7684\u200b\u5177\u4f53\u200b\u7ec6\u8282\u200b\u3002\u200b\u7136\u800c\u200b\uff0c\u200b\u7531\u4e8e\u200b\u5b9e\u9645\u200b\u90e8\u7f72\u200b\u73af\u5883\u200b\u4e0e\u200b\u9700\u6c42\u200b\u7684\u200b\u591a\u6837\u6027\u200b\uff0c\u200b\u4f7f\u7528\u200b\u9ed8\u8ba4\u200b\u914d\u7f6e\u200b\u53ef\u80fd\u200b\u65e0\u6cd5\u200b\u5728\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u83b7\u53d6\u200b\u7406\u60f3\u200b\u7684\u200b\u6027\u80fd\u200b\uff0c\u200b\u751a\u81f3\u200b\u53ef\u80fd\u200b\u51fa\u73b0\u200b\u63a8\u7406\u200b\u5931\u8d25\u200b\u7684\u200b\u60c5\u51b5\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u9ed8\u8ba4\u200b\u914d\u7f6e\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\u7684\u200b\u60c5\u5f62\u200b\uff0c\u200b\u7528\u6237\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\u4e2d\u200b inference.yml \u200b\u6587\u4ef6\u200b\u4e2d\u200b Hpi \u200b\u5b57\u200b\u6bb5\u200b\uff08\u200b\u5982\u679c\u200b\u8be5\u5b57\u200b\u6bb5\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u65b0\u589e\u200b\uff09\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u624b\u52a8\u200b\u8c03\u6574\u200b\u914d\u7f6e\u200b\u3002\u200b\u4ee5\u4e0b\u200b\u5217\u4e3e\u200b\u4e24\u79cd\u200b\u5e38\u89c1\u200b\u7684\u200b\u60c5\u5f62\u200b\uff1a

  • \u200b\u66f4\u6362\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1a

    \u200b\u5f53\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u4e0d\u53ef\u200b\u7528\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u66f4\u6362\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u3002\u200b\u7528\u6237\u200b\u9700\u8981\u200b\u4fee\u6539\u200b selected_backends \u200b\u5b57\u200b\u6bb5\u200b\uff08\u200b\u5982\u679c\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u65b0\u589e\u200b\uff09\u3002

    Hpi:\n  ...\n  selected_backends:\n    cpu: paddle_infer\n    gpu: onnx_runtime\n  ...\n

    \u200b\u5176\u4e2d\u200b\u6bcf\u4e00\u9879\u200b\u5747\u200b\u6309\u7167\u200b {\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b}: {\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u540d\u79f0\u200b} \u200b\u7684\u200b\u683c\u5f0f\u200b\u586b\u5199\u200b\u3002

    \u200b\u76ee\u524d\u200b\u6240\u6709\u200b\u53ef\u9009\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u5982\u4e0b\u200b\uff1a

    • paddle_infer\uff1aPaddle Inference \u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u3002\u200b\u652f\u6301\u200b CPU \u200b\u548c\u200b GPU\u3002\u200b\u76f8\u6bd4\u200b PaddleX \u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u652f\u6301\u200b\u4ee5\u200b\u96c6\u6210\u200b TensorRT \u200b\u5b50\u56fe\u200b\u7684\u200b\u65b9\u5f0f\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b GPU \u200b\u63a8\u7406\u200b\u6027\u80fd\u200b\u3002
    • openvino\uff1aOpenVINO\uff0cIntel \u200b\u63d0\u4f9b\u200b\u7684\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u63a8\u7406\u200b\u5de5\u5177\u200b\uff0c\u200b\u4f18\u5316\u200b\u4e86\u200b\u591a\u79cd\u200b Intel \u200b\u786c\u4ef6\u200b\u4e0a\u200b\u7684\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u6027\u80fd\u200b\u3002\u200b\u4ec5\u200b\u652f\u6301\u200b CPU\u3002\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u81ea\u52a8\u200b\u5c06\u200b\u6a21\u578b\u200b\u8f6c\u6362\u200b\u4e3a\u200b ONNX \u200b\u683c\u5f0f\u200b\u540e\u7528\u200b\u8be5\u200b\u5f15\u64ce\u200b\u63a8\u7406\u200b\u3002
    • onnx_runtime\uff1aONNX Runtime\uff0c\u200b\u8de8\u5e73\u53f0\u200b\u3001\u200b\u9ad8\u6027\u80fd\u200b\u7684\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u3002\u200b\u652f\u6301\u200b CPU \u200b\u548c\u200b GPU\u3002\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u81ea\u52a8\u200b\u5c06\u200b\u6a21\u578b\u200b\u8f6c\u6362\u200b\u4e3a\u200b ONNX \u200b\u683c\u5f0f\u200b\u540e\u7528\u200b\u8be5\u200b\u5f15\u64ce\u200b\u63a8\u7406\u200b\u3002
    • tensorrt\uff1aTensorRT\uff0cNVIDIA \u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u63a8\u7406\u200b\u5e93\u200b\uff0c\u200b\u9488\u5bf9\u200b NVIDIA GPU \u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901f\u5ea6\u200b\u3002\u200b\u4ec5\u200b\u652f\u6301\u200b GPU\u3002\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u81ea\u52a8\u200b\u5c06\u200b\u6a21\u578b\u200b\u8f6c\u6362\u200b\u4e3a\u200b ONNX \u200b\u683c\u5f0f\u200b\u540e\u7528\u200b\u8be5\u200b\u5f15\u64ce\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u4fee\u6539\u200b Paddle Inference \u200b\u6216\u200b TensorRT \u200b\u7684\u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\u914d\u7f6e\u200b\uff1a

    \u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\u662f\u200b TensorRT \u200b\u5ef6\u8fdf\u200b\u6307\u5b9a\u200b\u90e8\u5206\u200b\u6216\u200b\u5168\u90e8\u200b\u5f20\u91cf\u200b\u7ef4\u5ea6\u200b\u76f4\u5230\u200b\u8fd0\u884c\u200b\u65f6\u200b\u7684\u200b\u80fd\u529b\u200b\u3002\u200b\u5f53\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\u914d\u7f6e\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u200b\u9700\u6c42\u200b\uff08\u200b\u4f8b\u5982\u200b\uff0c\u200b\u6a21\u578b\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u8303\u56f4\u200b\u5916\u200b\u7684\u200b\u8f93\u5165\u200b\u5f62\u72b6\u200b\uff09\uff0c\u200b\u7528\u6237\u200b\u9700\u8981\u200b\u4fee\u6539\u200b\u72b6\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u914d\u7f6e\u200b\u4e2d\u200b\u7684\u200b trt_dynamic_shapes \u200b\u6216\u200b dynamic_shapes \u200b\u5b57\u200b\u6bb5\u200b\uff1a

    Hpi:\n  ...\n  backend_configs:\n    # Paddle Inference \u200b\u540e\u200b\u7aef\u200b\u914d\u7f6e\u200b\n    paddle_infer:\n      ...\n      trt_dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n    # TensorRT \u200b\u540e\u200b\u7aef\u200b\u914d\u7f6e\u200b\n    tensorrt:\n      ...\n      dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n

    \u200b\u5728\u200b trt_dynamic_shapes \u200b\u6216\u200b dynamic_shapes \u200b\u4e2d\u200b\uff0c\u200b\u9700\u8981\u200b\u4e3a\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u8f93\u5165\u200b\u5f20\u91cf\u200b\u6307\u5b9a\u200b\u52a8\u6001\u200b\u5f62\u72b6\u200b\uff0c\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a{\u200b\u8f93\u5165\u200b\u5f20\u91cf\u200b\u540d\u79f0\u200b}: [{\u200b\u6700\u5c0f\u200b\u5f62\u72b6\u200b}, [{\u200b\u6700\u4f18\u200b\u5f62\u72b6\u200b}], [{\u200b\u6700\u5927\u200b\u5f62\u72b6\u200b}]]\u3002\u200b\u6709\u5173\u200b\u6700\u5c0f\u200b\u5f62\u72b6\u200b\u3001\u200b\u6700\u4f18\u200b\u5f62\u72b6\u200b\u4ee5\u53ca\u200b\u6700\u5927\u200b\u5f62\u72b6\u200b\u7684\u200b\u76f8\u5173\u200b\u4ecb\u7ecd\u200b\u53ca\u200b\u66f4\u200b\u591a\u200b\u7ec6\u8282\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b TensorRT \u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u3002

    \u200b\u5728\u200b\u5b8c\u6210\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u8bf7\u200b\u5220\u9664\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u7684\u200b\u7f13\u5b58\u200b\u6587\u4ef6\u200b\uff08shape_range_info.pbtxt \u200b\u4e0e\u200b trt_serialized \u200b\u5f00\u5934\u200b\u7684\u200b\u6587\u4ef6\u200b\uff09\u3002

"},{"location":"pipeline_deploy/high_performance_inference.html#2","title":"2\u3001\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e0e\u200b\u6a21\u578b","text":"\u6a21\u578b\u200b\u4ea7\u7ebf\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u2705 \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u2705 \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b FasterRCNN-Swin-Tiny-FPN \u274cCenterNet-DLA-34 \u274c CenterNet-ResNet50 \u274c \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b Mask-RT-DETR-S \u274c \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u2705 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u2705 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u274c \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u9884\u6d4b\u200b \u274c \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u274c \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u2705 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u2705 \u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b \u2705 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u274c \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u2705 \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u2705 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u274c \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u274c \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b \u2705 \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u2705 \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b \u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b \u2705 \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b \u274c \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u274c \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b \u274c \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b \u274c \u200b\u4eba\u8138\u8bc6\u522b\u200b \u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b \u2705 \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b \u2705"},{"location":"pipeline_deploy/service_deploy.html","title":"PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357","text":"

\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u3002\u200b\u672c\u200b\u6587\u6863\u200b\u5c06\u200b\u9996\u5148\u200b\u4ecb\u7ecd\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u7684\u200b\u57fa\u672c\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u7136\u540e\u200b\u4ecb\u7ecd\u200b\u5c06\u200b\u670d\u52a1\u200b\u7528\u4e8e\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u65f6\u200b\u7684\u200b\u6ce8\u610f\u4e8b\u9879\u200b\u4ee5\u53ca\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u6267\u884c\u200b\u7684\u200b\u64cd\u4f5c\u200b\u3002

\u200b\u6ce8\u610f\u200b - \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d0\u4f9b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u5177\u4f53\u200b\u5230\u200b\u67d0\u4e2a\u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b\u3002

\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u793a\u4f8b\u200b\u56fe\u200b\uff1a

"},{"location":"pipeline_deploy/service_deploy.html#1","title":"1\u3001\u200b\u57fa\u672c\u200b\u6d41\u7a0b","text":""},{"location":"pipeline_deploy/service_deploy.html#11","title":"1.1 \u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6","text":"

\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6\u200b\uff1a

paddlex --install serving\n
"},{"location":"pipeline_deploy/service_deploy.html#12","title":"1.2 \u200b\u542f\u52a8\u200b\u670d\u52a1","text":"

\u200b\u901a\u8fc7\u200b PaddleX CLI \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\uff0c\u200b\u6307\u4ee4\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a

paddlex --serve --pipeline {\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b} [{\u200b\u5176\u4ed6\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b}]\n

\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --serve --pipeline image_classifcation\n

\u200b\u670d\u52a1\u200b\u542f\u52a8\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u7c7b\u4f3c\u200b\u4ee5\u4e0b\u200b\u5c55\u793a\u200b\u7684\u200b\u4fe1\u606f\u200b\uff1a

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline\u200b\u53ef\u200b\u6307\u5b9a\u200b\u4e3a\u200b\u5b98\u65b9\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u200b\u672c\u5730\u4ea7\u200b\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002PaddleX \u200b\u4ee5\u6b64\u200b\u6784\u5efa\u200b\u4ea7\u7ebf\u200b\u5e76\u200b\u90e8\u7f72\u200b\u4e3a\u200b\u670d\u52a1\u200b\u3002\u200b\u5982\u9700\u200b\u8c03\u6574\u200b\u914d\u7f6e\u200b\uff08\u200b\u5982\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u3001batch_size\u3001\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u7b49\u200b\uff09\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b \u201c\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b \u200b\u90e8\u5206\u200b\u3002

\u200b\u4e0e\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u76f8\u5173\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u8bf4\u660e\u200b --pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002 --device \u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b cpu\uff08\u200b\u5982\u200b GPU \u200b\u4e0d\u53ef\u200b\u7528\u200b\uff09\u200b\u6216\u200b gpu\uff08\u200b\u5982\u200b GPU \u200b\u53ef\u7528\u200b\uff09\u3002 --host \u200b\u670d\u52a1\u5668\u200b\u7ed1\u5b9a\u200b\u7684\u200b\u4e3b\u673a\u540d\u200b\u6216\u200b IP \u200b\u5730\u5740\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b0.0.0.0\u3002 --port \u200b\u670d\u52a1\u5668\u200b\u76d1\u542c\u200b\u7684\u200b\u7aef\u53e3\u53f7\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b8080\u3002 --use_hpip \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002 --serial_number \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4f7f\u7528\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5e76\u975e\u200b\u6240\u6709\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6a21\u578b\u200b\u90fd\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002 --update_license \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002"},{"location":"pipeline_deploy/service_deploy.html#13","title":"1.3 \u200b\u8c03\u7528\u200b\u670d\u52a1","text":"

\u200b\u8bf7\u200b\u53c2\u8003\u200b\u5404\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b \u201c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u201d \u200b\u90e8\u5206\u200b\u3002\u200b\u5728\u200b\u6b64\u5904\u200b\u53ef\u4ee5\u200b\u627e\u5230\u200b\u5404\u4ea7\u7ebf\u200b\u7684\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"pipeline_deploy/service_deploy.html#2","title":"2\u3001\u200b\u5c06\u200b\u670d\u52a1\u200b\u7528\u4e8e\u200b\u751f\u4ea7","text":"

\u200b\u5c06\u200b\u670d\u52a1\u200b\u5e94\u7528\u200b\u4e8e\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u65f6\u200b\uff0c\u200b\u670d\u52a1\u200b\u7684\u200b\u7a33\u5b9a\u6027\u200b\u3001\u200b\u9ad8\u6548\u6027\u200b\u4e0e\u200b\u5b89\u5168\u6027\u200b\u5c24\u4e3a\u91cd\u8981\u200b\u3002\u200b\u4ee5\u4e0b\u200b\u662f\u200b\u4e00\u4e9b\u200b\u9488\u5bf9\u200b\u5c06\u200b\u670d\u52a1\u200b\u7528\u4e8e\u200b\u751f\u4ea7\u200b\u7684\u200b\u5efa\u8bae\u200b\u3002

"},{"location":"pipeline_deploy/service_deploy.html#21-paddlex","title":"2.1 \u200b\u4f7f\u7528\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u54cd\u5e94\u200b\u65f6\u95f4\u200b\u8981\u6c42\u200b\u8f83\u200b\u4e25\u683c\u200b\u7684\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u52a0\u901f\u200b\uff0c\u200b\u4ece\u800c\u200b\u964d\u4f4e\u200b\u54cd\u5e94\u200b\u65f6\u95f4\u200b\u3001\u200b\u63d0\u5347\u200b\u541e\u5410\u91cf\u200b\u3002

\u200b\u4f7f\u7528\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u4e2d\u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3001\u200b\u83b7\u53d6\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u6fc0\u6d3b\u200b\u90e8\u5206\u200b\u5b8c\u6210\u200b\u63d2\u4ef6\u200b\u7684\u200b\u5b89\u88c5\u200b\u4e0e\u200b\u5e8f\u5217\u53f7\u200b\u7684\u200b\u7533\u8bf7\u200b\u3002\u200b\u540c\u65f6\u200b\uff0c\u200b\u4e0d\u662f\u200b\u6240\u6709\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6a21\u578b\u200b\u548c\u200b\u73af\u5883\u200b\u90fd\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u7684\u200b\u8be6\u7ec6\u60c5\u51b5\u200b\u8bf7\u200b\u53c2\u8003\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u4e0e\u200b\u6a21\u578b\u200b\u90e8\u5206\u200b\u3002

\u200b\u5728\u200b\u542f\u52a8\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u65f6\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u6307\u5b9a\u200b --use_hpip \u200b\u53ca\u200b\u5e8f\u5217\u53f7\u200b\u4ee5\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002\u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b \u200b\u9700\u200b\u6307\u5b9a\u200b --update_license\u3002\u200b\u4f7f\u7528\u200b\u793a\u4f8b\u200b\uff1a

paddlex --serve --pipeline image_classfication --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n\n# \u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\npaddlex --serve --pipeline image_classfication --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license\n
"},{"location":"pipeline_deploy/service_deploy.html#22","title":"2.2 \u200b\u8003\u8651\u200b\u5b89\u5168\u6027","text":"

\u200b\u4e00\u4e2a\u200b\u5178\u578b\u200b\u7684\u200b\u573a\u666f\u200b\u662f\u200b\uff0c\u200b\u5e94\u7528\u200b\u63a5\u53d7\u200b\u6765\u81ea\u200b\u7f51\u7edc\u200b\u7684\u200b\u8f93\u5165\u200b\uff0cPaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u4f5c\u4e3a\u200b\u5e94\u7528\u200b\u4e2d\u200b\u7684\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u901a\u8fc7\u200b API \u200b\u4e0e\u200b\u5176\u4ed6\u200b\u6a21\u5757\u200b\u4ea4\u4e92\u200b\u3002\u200b\u6b64\u65f6\u200b\uff0cPaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u5728\u200b\u5e94\u7528\u200b\u4e2d\u6240\u5904\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u5c24\u4e3a\u91cd\u8981\u200b\u3002PaddleX \u200b\u63d0\u4f9b\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u6848\u200b\u4e13\u6ce8\u200b\u4e8e\u200b\u63d0\u4f9b\u200b\u9ad8\u6548\u6027\u200b\u548c\u200b\u6613\u7528\u6027\u200b\uff0c\u200b\u4f46\u200b\u672a\u200b\u5bf9\u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u8db3\u591f\u200b\u7684\u200b\u5b89\u5168\u68c0\u67e5\u200b\u3002\u200b\u6765\u81ea\u200b\u7f51\u7edc\u200b\u7684\u200b\u6076\u610f\u200b\u8bf7\u6c42\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8d85\u5927\u200b\u5c3a\u5bf8\u200b\u7684\u200b\u56fe\u50cf\u200b\u6216\u200b\u7cbe\u5fc3\u200b\u6784\u9020\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u90fd\u200b\u53ef\u80fd\u200b\u5bfc\u81f4\u200b\u670d\u52a1\u200b\u5d29\u6e83\u200b\u7b49\u200b\u4e25\u91cd\u540e\u679c\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5efa\u8bae\u200b\u5c06\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\u670d\u52a1\u200b\u653e\u7f6e\u200b\u4e8e\u200b\u5e94\u7528\u200b\u5185\u90e8\u200b\uff0c\u200b\u4e0d\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u5916\u90e8\u200b\u8f93\u5165\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5176\u200b\u53ea\u200b\u5904\u7406\u200b\u53ef\u4fe1\u8d56\u200b\u7684\u200b\u8bf7\u6c42\u200b\u3002\u200b\u5728\u200b\u5e94\u7528\u200b\u7684\u200b\u5916\u5c42\u200b\uff0c\u200b\u9700\u8981\u200b\u6dfb\u52a0\u200b\u5408\u9002\u200b\u7684\u200b\u9632\u62a4\u200b\u63aa\u65bd\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8f93\u5165\u200b\u9a8c\u8bc1\u200b\u3001\u200b\u8eab\u4efd\u9a8c\u8bc1\u200b\u7b49\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6982\u89c8","text":"

\u200b\u82e5\u200b\u60a8\u200b\u5df2\u7ecf\u200b\u4f53\u9a8c\u200b\u8fc7\u200bPaddleX\u200b\u4e2d\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u5e0c\u671b\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u8df3\u8f6c\u200b\u5230\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b

\u200b\u5b8c\u6574\u200b\u7684\u200bPaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

PaddleX \u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5f00\u53d1\u200b\u6d41\u7a0b\u56fe\u200b

graph LR\n    select_pipeline(\u200b\u9009\u62e9\u200b\u4ea7\u7ebf\u200b) --> online_experience[\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b]\n    online_experience --> online_ok{\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff1f}\n    online_ok --\u200b\u4e0d\u200b\u6ee1\u610f\u200b--> select_model[\u200b\u9009\u62e9\u200b\u6a21\u578b\u200b]\n    select_model --> model_finetune[\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b]\n    online_ok --\u200b\u6ee1\u610f\u200b--> development_integration(\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b)\n    model_finetune --> pipeline_test[\u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5\u200b]\n    pipeline_test --> test_ok{\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff1f}\n    test_ok --\u200b\u4e0d\u200b\u6ee1\u610f\u200b--> select_model\n    test_ok --\u200b\u6ee1\u610f\u200b--> development_integration

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5c06\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff0c\u200b\u76f4\u5230\u200b\u8fbe\u5230\u200b\u6ee1\u610f\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u4e0b\u9762\u200b\uff0c\u200b\u8ba9\u200b\u6211\u4eec\u200b\u4ee5\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4ecb\u7ecd\u200bPaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u8fc7\u7a0b\u200b\u3002 \u200b\u5728\u200b\u4f7f\u7528\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#1","title":"1\u3001\u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

PaddleX\u200b\u4e2d\u200b\u6bcf\u200b\u6761\u4ea7\u7ebf\u200b\u90fd\u200b\u53ef\u4ee5\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\u7684\u200b\u95ee\u9898\u200b\u5982\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3001\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3001\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7b49\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u9009\u62e9\u200b\u540e\u7eed\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u4f8b\u5982\u200b\u6b64\u5904\u200b\u4e3a\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u66f4\u200b\u591a\u4efb\u52a1\u200b\u4e0e\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)\u200b\u67e5\u8be2\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#2","title":"2\u3001\u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX\u200b\u7684\u200b\u6bcf\u200b\u6761\u4ea7\u7ebf\u200b\u90fd\u200b\u96c6\u6210\u200b\u4e86\u200b\u4f17\u591a\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5148\u200b\u4f53\u9a8c\u200bPaddleX\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u5982\u679c\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u7b26\u5408\u200b\u60a8\u200b\u7684\u200b\u9884\u671f\u200b\uff0c\u200b\u5373\u53ef\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u7b26\u5408\u200b\uff0c\u200b\u518d\u200b\u6839\u636e\u200b\u540e\u7eed\u200b\u6b65\u9aa4\u200b\u5bf9\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\u3002

PaddleX\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e09\u79cd\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u4f53\u9a8c\u200b\uff1a

  • \u200b\u5728\u7ebf\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b\uff1aPaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)
  • \u200b\u547d\u4ee4\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1aPaddleX\u200b\u4ea7\u7ebf\u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b
  • Python\u200b\u811a\u672c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1aPaddleX\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b

\u200b\u4ee5\u200b\u5b9e\u73b0\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u7528\u200b\u4e09\u79cd\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff1a

\ud83c\udf10 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200bAI Studio\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\ud83d\udcbb \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c\u200b

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b,\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200bOCR\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u53f7\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u53f7\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n
\ud83d\udc49\u200b\u70b9\u51fb\u200b\u67e5\u770b\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_ocr_002.png', 'dt_polys': [array([[ 6, 13],\n       [64, 13],\n       [64, 31],\n       [ 6, 31]], dtype=int16), array([[210,  14],\n       [238,  14],\n        ......\n       [830, 445],\n       [830, 464],\n       [338, 473]], dtype=int16)], 'dt_scores': [0.7629529090100092, 0.7717284653547034, 0.7139251666762622, 0.8057611181556994, 0.8840947658872964, 0.793295938183885, 0.8342027855884783, 0.8081378522874861, 0.8436969344212185, 0.8500845646497226, 0.7932189714842249, 0.8875924621248228, 0.8827884273639948, 0.8322404317386042, 0.8614796803023563, 0.8804252994596097, 0.9069978945305474, 0.8383917914190059, 0.8495824076580516, 0.8825556800041383, 0.852788927706737, 0.8379584696974435, 0.8633519228646618, 0.763234473595298, 0.8602154244410916, 0.9206341882426813, 0.6341425973804049, 0.8490156149797171, 0.758314821564747, 0.8757849788793592, 0.772485060565334, 0.8404023012596349, 0.8190037953773427, 0.851908529295617, 0.6126112758079643, 0.7324388418218587], 'rec_text': ['www.9', '5', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', '', 'CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO', '\u200b\u5ea7\u4f4d\u53f7\u200b', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200b DATE', '03DEC', 'W', '035', 'MU 2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200b', 'GATES CLOSE 1O MINUTESBEFOREDEPARTURE TIME'], 'rec_score': [0.683099627494812, 0.23417049646377563, 0.9969978928565979, 0.9945957660675049, 0.9787729382514954, 0.9983421564102173, 0.0, 0.9896272420883179, 0.9927973747253418, 0.9976049065589905, 0.9330753684043884, 0.9562691450119019, 0.9312669038772583, 0.9749765396118164, 0.9749416708946228, 0.9988260865211487, 0.9319792985916138, 0.9979889988899231, 0.9956836700439453, 0.9991750717163086, 0.9938803315162659, 0.9982991218566895, 0.9701204299926758, 0.9986245632171631, 0.9888408780097961, 0.9793729782104492, 0.9952947497367859, 0.9945247173309326, 0.9919753670692444, 0.991995632648468, 0.9937331080436707, 0.9963390827178955, 0.9954304695129395, 0.9934715628623962, 0.9974429607391357, 0.9529641270637512]}\n

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200bOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6309\u7167\u200b\u4e0b\u9762\u200b\u7684\u200b\u6b65\u9aa4\u200b\u8fdb\u884c\u200b\u64cd\u4f5c\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b

\u200b\u83b7\u53d6\u200bOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff1a

paddlex --get_pipeline_config OCR\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0cOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path\uff09\uff1a

paddlex --get_pipeline_config OCR --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ocr.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ocr.yaml --input general_ocr_002.png\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\ud83d\udcbbPython\u200b\u811a\u672c\u200b\u4f53\u9a8c\u200b

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

  • create_pipeline() \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b
  • \u200b\u4f20\u5165\u200b\u56fe\u7247\u200b\u5e76\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b
  • \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b

\u2757 Python\u200b\u811a\u672c\u200b\u8fd0\u884c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5982\u679c\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u7b26\u5408\u200b\u60a8\u200b\u7684\u200b\u9884\u671f\u200b\uff0c\u200b\u5373\u53ef\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u7b26\u5408\u200b\uff0c\u200b\u518d\u200b\u6839\u636e\u200b\u540e\u7eed\u200b\u6b65\u9aa4\u200b\u5bf9\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#3","title":"3\u3001\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u7531\u4e8e\u200b\u4e00\u4e2a\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u53ef\u80fd\u200b\u5305\u542b\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u5355\u200b\u529f\u80fd\u6a21\u5757\u200b\uff0c\u200b\u5728\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u65f6\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6d4b\u8bd5\u200b\u7684\u200b\u60c5\u51b5\u200b\u786e\u5b9a\u200b\u5fae\u8c03\u200b\u5176\u4e2d\u200b\u7684\u200b\u54ea\u4e2a\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u4ee5\u200b\u6b64\u5904\u200b\u767b\u673a\u724c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u7684\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u8be5\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200b PP-OCRv4_mobile_det\uff09\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200b PP-OCRv4_mobile_rec\uff09\uff0c\u200b\u5982\u200b\u53d1\u73b0\u200b\u6587\u5b57\u200b\u7684\u200b\u5b9a\u4f4d\u200b\u4e0d\u51c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u679c\u200b\u53d1\u73b0\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b\u4e0d\u51c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4e0d\u200b\u6e05\u695a\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#4","title":"4\u3001\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5728\u200b\u786e\u5b9a\u200b\u597d\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u7684\u200b\u6a21\u578b\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5bf9\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u4ee5\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff08 PP-OCRv4_mobile_rec\uff09\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=your/dataset_dir\n
\u200b\u6b64\u5916\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u4e2d\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u51c6\u5907\u200b\u3001\u200b\u5355\u200b\u6a21\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u7b49\u200b\u5185\u5bb9\u200b\uff0cPaddleX\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6559\u7a0b\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u6a21\u5757\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

"},{"location":"pipeline_usage/pipeline_develop_guide.html#5","title":"5\u3001\u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5\u200b\uff08\u200b\u53ef\u200b\u9009\u200b\uff09","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  det_model: PP-OCRv4_server_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5373\u53ef\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5373\u53ef\u200b\u56de\u5230\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u5c1d\u8bd5\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\u5176\u4ed6\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u76f4\u5230\u200b\u8fbe\u5230\u200b\u6ee1\u610f\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/pipeline_develop_guide.html#6","title":"6\u3001\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bPaddleX\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u53ca\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200bPython\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

\u2757 PaddleX\u200b\u4e3a\u200b\u6bcf\u4e2a\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u8be6\u7ec6\u200b\u7684\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u8fdb\u884c\u200b\u9009\u62e9\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\u7684\u200b\u4f7f\u7528\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200bOCR \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b"},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200bCLI\u200b\u547d\u4ee4\u884c\u200b\u4f7f\u7528\u200b\u8bf4\u660e","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200bCLI\u200b\u547d\u4ee4\u884c\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html#_1","title":"\u4e00\u200b\u3001\u200b\u4f7f\u7528\u200b\u793a\u4f8b","text":""},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html#1","title":"1. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

paddlex --pipeline image_classification \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --device gpu:0 \\\n        --save_path ./output/\n
\u200b\u53ea\u200b\u9700\u200b\u4e00\u6b65\u200b\u5c31\u200b\u80fd\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • pipeline\uff1a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u540d\u200b\u201cimage_classification\u201d\uff0c\u200b\u6216\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u201cpath/to/image_classification.yaml\u201d\uff1b
  • input\uff1a\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u652f\u6301\u200b\u672c\u5730\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3001\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\u3001\u200b\u6587\u4ef6\u200bURL\u200b\u94fe\u63a5\u200b\uff1b
  • device\uff1a\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff0c\u200b\u5982\u4e3a\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u53ef\u4ee5\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u201ccpu\u201d\u3001\u201cgpu:2\u201d\uff0c\u200b\u5f53\u200b\u4e0d\u200b\u4f20\u5165\u200b\u65f6\u200b\uff0c\u200b\u5982\u200b\u6709\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u4f7f\u7528\u200bGPU\uff0c\u200b\u5426\u5219\u200b\u4f7f\u7528\u200bCPU\uff1b
  • save_path\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u200b\u4e0d\u200b\u4f20\u5165\u200b\u65f6\u200b\uff0c\u200b\u5219\u200b\u4e0d\u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_CLI_usage.html#2","title":"2. \u200b\u81ea\u5b9a\u4e49\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e","text":"

\u200b\u5982\u9700\u200b\u5bf9\u4ea7\u7ebf\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\uff0c\u200b\u53ef\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\uff0c\u200b\u4ecd\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

paddlex --get_pipeline_config image_classification\n\n# Please enter the path that you want to save the pipeline config file: (default `./`)\n./configs/\n\n# The pipeline config has been saved to: configs/image_classification.yaml\n

\u200b\u7136\u540e\u200b\u53ef\u200b\u4fee\u6539\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200bconfigs/image_classification.yaml\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u4e3a\u200b\uff1a

Global:\n  pipeline_name: image_classification\n  input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\n\nPipeline:\n  model: PP-LCNet_x0_5\n  batch_size: 1\n  device: \"gpu:0\"\n

\u200b\u5728\u200b\u4fee\u6539\u200b\u5b8c\u6210\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u8be5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

paddlex --pipeline configs/image_classification.yaml \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --save_path ./output/\n\n# {'input_path': '/root/.paddlex/predict_input/general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': array([0.62817, 0.03729, 0.03262, 0.03247, 0.03196]), 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200bPython\u200b\u811a\u672c\u200b\u4f7f\u7528\u200b\u8bf4\u660e","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200bPython\u200b\u811a\u672c\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_1","title":"\u4e00\u200b\u3001\u200b\u4f7f\u7528\u200b\u793a\u4f8b","text":"

\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(\"image_classification\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e09\u6b65\u200b\uff1a

  • \u200b\u8c03\u7528\u200bcreate_pipeline()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u8c03\u7528\u200bprint()\u3001save_to_xxx()\u200b\u7b49\u200b\u76f8\u5173\u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316\u200b\u6216\u662f\u200b\u4fdd\u5b58\u200b\u3002
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#api","title":"\u4e8c\u200b\u3001API\u200b\u8bf4\u660e","text":""},{"location":"pipeline_usage/instructions/pipeline_python_API.html#1-create_pipeline","title":"1. \u200b\u8c03\u7528\u200bcreate_pipeline()\u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61","text":"
  • create_pipeline\uff1a\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • pipeline_name\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u4ea7\u7ebf\u200b\u540d\u200b\u6216\u662f\u200b\u672c\u5730\u4ea7\u200b\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u201cimage_classification\u201d\u3001\u201c/path/to/image_classification.yaml\u201d\uff1b
    • device\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff0c\u200b\u5982\u4e3a\u200bGPU\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u53ef\u4ee5\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u201ccpu\u201d\u3001\u201cgpu:2\u201d\uff1b
    • pp_option\uff1aPaddlePredictorOption \u200b\u7c7b\u578b\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aBasePredictor\u200b\u7c7b\u578b\u200b\u3002
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#2-predict","title":"2. \u200b\u8c03\u7528\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200bpredict()\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b","text":"
  • predict\uff1a\u200b\u4f7f\u7528\u200b\u5b9a\u4e49\u200b\u7684\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5bf9\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • input\uff1a\u200b\u4efb\u610f\u200b\u7c7b\u578b\u200b\uff0c\u200b\u652f\u6301\u200bstr\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6216\u662f\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6587\u4ef6\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u6216\u662f\u200b\u7f51\u7edc\u200bURL\uff1b\u200b\u5bf9\u4e8e\u200bCV\u200b\u4efb\u52a1\u200b\uff0c\u200b\u652f\u6301\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\uff1b\u200b\u5bf9\u4e8e\u200bTS\u200b\u4efb\u52a1\u200b\uff0c\u200b\u652f\u6301\u200bpandas.DataFrame\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff1b\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6240\u200b\u6784\u6210\u200b\u7684\u200blist\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1agenerator\uff0c\u200b\u6bcf\u6b21\u200b\u8c03\u7528\u200b\u8fd4\u56de\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#3","title":"3. \u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316","text":"

\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u652f\u6301\u200b\u8bbf\u95ee\u200b\u3001\u200b\u53ef\u89c6\u5316\u200b\u53ca\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u76f8\u5e94\u200b\u7684\u200b\u5c5e\u6027\u200b\u6216\u200b\u65b9\u6cd5\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u5177\u4f53\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_2","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • str\uff1astr \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff0c\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bstr\u200b\u8868\u793a\u200b\uff1b
  • json\uff1ajson\u200b\u683c\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1adict \u200b\u7c7b\u578b\u200b\uff1b
  • img\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u56fe\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aPIL.Image \u200b\u7c7b\u578b\u200b\uff1b
  • html\uff1a\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u7684\u200bHTML\u200b\u8868\u793a\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_3","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • print()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8f93\u51fa\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e0d\u200b\u4fbf\u4e8e\u200b\u76f4\u63a5\u200b\u8f93\u51fa\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u7701\u7565\u200b\u76f8\u5173\u200b\u5185\u5bb9\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • json_format\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u8868\u793a\u200b\u4e0d\u200b\u4f7f\u7528\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u8f93\u51fa\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_json()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9700\u8981\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5f53\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5305\u542b\u200b\u65e0\u6cd5\u200bjson\u200b\u5e8f\u5217\u5316\u200b\u7684\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u8fdb\u884c\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\u4ee5\u200b\u5b9e\u73b0\u200b\u5e8f\u5217\u5316\u200b\u4fdd\u5b58\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
    • indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200bjson\u200b\u683c\u5f0f\u5316\u200b\u7684\u200b\u7c7b\u578b\u200b\uff1b
    • ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff0c\u200b\u5f53\u200bjson_format\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_img()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_csv()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bCSV\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_html()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bHTML\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • save_to_xlsx()\uff1a\u200b\u5c06\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bXLSX\u200b\u6587\u4ef6\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a
    • save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1a\u200b\u65e0\u200b\uff1b
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#4","title":"4. \u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e","text":"

PaddleX \u200b\u652f\u6301\u200b\u901a\u8fc7\u200bPaddlePredictorOption\u200b\u8bbe\u7f6e\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u76f8\u5173\u200bAPI\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_4","title":"\u5c5e\u6027\u200b\uff1a","text":"
  • deivce\uff1a\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u53ca\u200b\u5361\u53f7\u200b\uff0c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'gpu', 'cpu', 'npu', 'xpu', 'mlu'\uff0c\u200b\u5f53\u200b\u4f7f\u7528\u200b\u52a0\u901f\u5361\u200b\u65f6\u200b\uff0c\u200b\u652f\u6301\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\u4f7f\u7528\u200b 0 \u200b\u53f7\u200b gpu\uff1a'gpu:0'\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'gpu:0'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002
  • run_mode\uff1a\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b str \u200b\u7c7b\u578b\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\uff0c\u200b\u652f\u6301\u200b\u53ef\u200b\u9009\u200b 'paddle'\uff0c'trt_fp32'\uff0c'trt_fp16'\uff0c'trt_int8'\uff0c'mkldnn'\uff0c'mkldnn_bf16'\uff0c\u200b\u5176\u4e2d\u200b 'mkldnn' \u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u53ef\u9009\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b 'paddle'\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u3002
  • cpu_threads\uff1acpu \u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff0c\u200b\u4ec5\u5f53\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u4f7f\u7528\u200b cpu \u200b\u65f6\u200b\u6709\u6548\u200b\uff1b
  • \u200b\u652f\u6301\u200b\u8bbe\u7f6e\u200b int \u200b\u7c7b\u578b\u200b\uff0ccpu \u200b\u63a8\u7406\u200b\u65f6\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1aint \u200b\u7c7b\u578b\u200b\uff0c\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u52a0\u901f\u200b\u5e93\u200b\u8ba1\u7b97\u200b\u7ebf\u7a0b\u200b\u6570\u200b\u3002
"},{"location":"pipeline_usage/instructions/pipeline_python_API.html#_5","title":"\u65b9\u6cd5\u200b\uff1a","text":"
  • get_support_run_mode\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u63a8\u7406\u200b\u540e\u200b\u7aef\u200b\u8bbe\u7f6e\u200b\u3002
  • get_support_device\uff1a\u200b\u83b7\u53d6\u200b\u652f\u6301\u200b\u7684\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1alist \u200b\u7c7b\u578b\u200b\uff0c\u200b\u53ef\u9009\u200b\u7684\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3002
  • get_device\uff1a\u200b\u83b7\u53d6\u200b\u5f53\u524d\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8bbe\u5907\u200b\uff1b
  • \u200b\u53c2\u6570\u200b\uff1a\u200b\u65e0\u200b\uff1b
  • \u200b\u8fd4\u56de\u503c\u200b\uff1astr \u200b\u7c7b\u578b\u200b\u3002
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html","title":"\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#1","title":"1. \u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u65e8\u5728\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u548c\u200b\u6bd4\u8f83\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u4e2a\u4eba\u8eab\u4efd\u200b\u7684\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u3002\u200b\u8be5\u200b\u4efb\u52a1\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u68c0\u6d4b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u4eba\u8138\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u5bf9\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7279\u5f81\u63d0\u53d6\u200b\u548c\u200b\u5339\u914d\u200b\uff0c\u200b\u4ece\u800c\u200b\u5728\u200b\u6570\u636e\u5e93\u200b\u4e2d\u200b\u627e\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u8eab\u4efd\u200b\u4fe1\u606f\u200b\u3002\u200b\u4eba\u8138\u8bc6\u522b\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5b89\u5168\u200b\u8ba4\u8bc1\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u3001\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u548c\u200b\u667a\u80fd\u200b\u8bbe\u5907\u200b\u7b49\u200b\u573a\u666f\u200b\u3002

\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u4e13\u6ce8\u200b\u4e8e\u200b\u89e3\u51b3\u200b\u4eba\u8138\u200b\u5b9a\u4f4d\u200b\u548c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4ece\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5feb\u901f\u200b\u51c6\u786e\u200b\u5730\u200b\u5b9a\u4f4d\u200b\u4eba\u8138\u200b\u533a\u57df\u200b\u3001\u200b\u63d0\u53d6\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u4e0e\u200b\u7279\u5f81\u200b\u5e93\u4e2d\u200b\u9884\u5148\u200b\u5efa\u7acb\u200b\u7684\u200b\u7279\u5f81\u200b\u505a\u200b\u68c0\u7d22\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u4ece\u800c\u200b\u786e\u8ba4\u200b\u8eab\u4efd\u200b\u4fe1\u606f\u200b\u3002

\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AP (%)Easy/Medium/Hard GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b BlazeFace\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.7/73.4/49.5 0.447 \u200b\u8f7b\u91cf\u200b\u9ad8\u6548\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b BlazeFace-FPN-SSH\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.2/80.5/60.5 0.606 BlazeFace\u200b\u7684\u200b\u6539\u8fdb\u200b\u6a21\u578b\u200b\uff0c\u200b\u589e\u52a0\u200bFPN\u200b\u548c\u200bSSH\u200b\u7ed3\u6784\u200b PicoDet_LCNet_x2_5_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.7/90.7/68.1 28.9 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 93.9/91.8/79.8 26.5 \u200b\u57fa\u4e8e\u200bPP-YOLOE_plus-S\u200b\u7684\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5728\u200bWIDER-FACE\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\uff0c\u200b\u4ee5\u200b640 *640\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u5c3a\u5bf8\u200b\u8bc4\u4f30\u200b\u5f97\u5230\u200b\u7684\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8f93\u51fa\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b Acc (%)AgeDB-30/CFP-FP/LFW GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b MobileFaceNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 128 96.28/96.71/99.58 4.1 \u200b\u57fa\u4e8e\u200bMobileFaceNet\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b ResNet50_face\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 512 98.12/98.56/99.77 87.2 \u200b\u57fa\u4e8e\u200bResNet50\u200b\u5728\u200bMS1Mv3\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u8bad\u7ec3\u200b\u7684\u200b\u4eba\u8138\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5206\u522b\u200b\u5728\u200b AgeDB-30\u3001CFP-FP \u200b\u548c\u200b LFW \u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u6d4b\u5f97\u200b\u7684\u200b Accuracy\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u2757 \u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u547d\u4ee4\u884c\u200b\u4f53\u9a8c\u200b

\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5185\u7f6e\u200b\u7684\u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config face_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b./my_path\uff09\uff1a

paddlex --get_pipeline_config face_recognition --save_path ./my_path\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u8bf7\u200b\u4e0b\u8f7d\u200b\u6d4b\u8bd5\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\u3002 \u200b\u5728\u200b\u8be5\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8fd0\u884c\u200b\u793a\u4f8b\u200b\u4e2d\u200b\u9700\u8981\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\u4e0b\u8f7d\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200bdemo\u200b\u6570\u636e\u200b\u7528\u6765\u200b\u540e\u7eed\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u5c06\u200b Demo \u200b\u6570\u636e\u200b\u96c6\u200b\u4e0b\u8f7d\u200b\u5230\u200b\u6307\u5b9a\u200b\u6587\u4ef6\u5939\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_demo_gallery.tar\ntar -xf ./face_demo_gallery.tar\n

\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5efa\u7acb\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u3002\u200b\u4e4b\u540e\u200b\u901a\u8fc7\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u5efa\u7acb\u200b\u548c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\", index_dir=\"face_gallery_index\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b \u200b\u4eba\u8138\u8bc6\u522b\u200b \u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b index_dir \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u68c0\u7d22\u200b\u5e93\u200b\u6587\u4ef6\u200b\u6240\u5728\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5728\u200bpredict()\u200b\u4e2d\u200b\u6307\u5b9a\u200bindex_dir\u3002 str None device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b build_index \u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u4e3a\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b data_root \u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b index_dir \u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u3002\u200b\u6210\u529f\u200b\u8c03\u7528\u200bbuild_index\u200b\u65b9\u6cd5\u200b\u540e\u4f1a\u200b\u5728\u200b\u6539\u200b\u8def\u5f84\u200b\u4e0b\u200b\u751f\u6210\u200b\u4e24\u4e2a\u200b\u6587\u4ef6\u200b\uff1a \"id_map.pkl\" \u200b\u4fdd\u5b58\u200b\u4e86\u200b\u56fe\u50cf\u200bID\u200b\u4e0e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\u4e4b\u95f4\u200b\u7684\u200b\u6620\u5c04\u200b\u5173\u7cfb\u200b\uff1b \u201cvector.index\u201d\u200b\u5b58\u50a8\u200b\u4e86\u200b\u6bcf\u5f20\u200b\u56fe\u50cf\u200b\u7684\u200b\u7279\u5f81\u5411\u91cf\u200b str \u200b\u65e0\u200b

\uff083\uff09\u200b\u8c03\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200binput\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\u200b\u53e6\u5916\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u652f\u6301\u200b\u53c2\u6570\u200bindex_dir\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u68c0\u7d22\u200b\u5e93\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b index_dir \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u68c0\u7d22\u200b\u5e93\u200b\u6587\u4ef6\u200b\u6240\u5728\u200b\u7684\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5728\u200bcreate_pipeline()\u200b\u4e2d\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200bindex_dir\u200b\u6307\u5b9a\u200b\u7684\u200b\u68c0\u7d22\u200b\u5e93\u200b\u3002

\uff084\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u3002

\uff085\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/face_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/face_recognition.yaml\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#223","title":"2.2.3 \u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6dfb\u52a0\u200b\u548c\u200b\u5220\u9664\u200b\u64cd\u4f5c","text":"

\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u5c06\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u6dfb\u52a0\u200b\u5230\u200b\u7279\u5f81\u200b\u5e93\u4e2d\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b append_index \u200b\u65b9\u6cd5\u200b\uff1b\u200b\u5220\u9664\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b remove_index \u200b\u65b9\u6cd5\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\npipeline.buile_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\", index_type=\"IVF\")\npipeline.append_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\", index_type=\"IVF\")\npipeline.remove_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\", index_type=\"IVF\")\n

\u200b\u4e0a\u8ff0\u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b data_root \u200b\u8981\u200b\u6dfb\u52a0\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6839\u76ee\u5f55\u200b\u3002\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u4e0e\u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u65f6\u200b\u76f8\u540c\u200b\uff0c\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b index_dir \u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u5b58\u50a8\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5728\u200b append_index \u200b\u548c\u200b remove_index \u200b\u4e2d\u200b\uff0c\u200b\u540c\u65f6\u200b\u4e5f\u200b\u662f\u200b\u88ab\u200b\u4fee\u6539\u200b\uff08\u200b\u6216\u200b\u5220\u9664\u200b\uff09\u200b\u7684\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u8def\u5f84\u200b\uff0c str \u200b\u65e0\u200b index_type \u200b\u652f\u6301\u200b HNSW32\u3001IVF\u3001Flat\u3002\u200b\u5176\u4e2d\u200b\uff0cHNSW32 \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u4e14\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u4f46\u200b\u4e0d\u200b\u652f\u6301\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bIVF \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u4f46\u200b\u7cbe\u5ea6\u200b\u76f8\u5bf9\u200b\u8f83\u200b\u4f4e\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bFlat \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u4f4e\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\u3002 str HNSW32 metric_type \u200b\u652f\u6301\u200b\uff1aIP\uff0c\u200b\u5185\u79ef\u200b\uff08Inner Product\uff09\uff1bL2\uff0c\u200b\u6b27\u51e0\u91cc\u5f97\u200b\u8ddd\u79bb\u200b\uff08Euclidean Distance\uff09\u3002 str IP"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#23","title":"2.3 \u200b\u6784\u5efa\u200b\u7279\u5f81\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f","text":"

PaddleX\u200b\u7684\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u793a\u4f8b\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u597d\u200b\u7684\u200b\u7279\u5f81\u200b\u5e93\u200b\u8fdb\u884c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u68c0\u7d22\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u6784\u5efa\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u5e93\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u7ec4\u7ec7\u200b\u6570\u636e\u200b\uff1a

data_root             # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images            # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u2502   \u251c\u2500\u2500 ID0           # \u200b\u8eab\u4efd\u200bID\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u6bd4\u5982\u200b\u4eba\u200b\u540d\u200b\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # \u200b\u56fe\u7247\u200b\uff0c\u200b\u6b64\u5904\u200b\u652f\u6301\u200b\u5c42\u7ea7\u200b\u5d4c\u5957\u200b\n\u2502   \u2502       ...\n\u2502   \u251c\u2500\u2500 ID1           # \u200b\u8eab\u4efd\u200bID\u200b\u540d\u5b57\u200b\uff0c\u200b\u6700\u597d\u200b\u662f\u200b\u6709\u200b\u610f\u4e49\u200b\u7684\u200b\u540d\u5b57\u200b\uff0c\u200b\u6bd4\u5982\u200b\u4eba\u200b\u540d\u200b\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # \u200b\u7279\u5f81\u200b\u5e93\u200b\u6570\u636e\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u4e0d\u53ef\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u5f85\u200b\u68c0\u7d22\u200b\u4eba\u8138\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1aimages/Chandler/Chandler00037.jpg Chandler\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u56fe\u50cf\u200bOCR\u200b\u7ed3\u679c\u200b\u3002

POST /ocr

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 image string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6807\u6ce8\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"\u200b\u5317\u4eac\u200b\u5357\u7ad9\u200b\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"\u200b\u5929\u6d25\u7ad9\u200b\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b \u200b\u4eba\u8138\u8bc6\u522b\u200b \u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u548c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4eba\u8138\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u4eba\u8138\u200b\u51fa\u73b0\u200b\u5339\u914d\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  device: \"gpu:0\"\n  det_model: \"BlazeFace\"        #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  rec_model: \"MobileFaceNet\"    #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4e3a\u200b\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u548c\u200b\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u8bbe\u7f6e\u200b\u5355\u72ec\u200b\u7684\u200bbatch_size\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/face_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u4f7f\u7528\u200bPython\u200b\u8fd0\u884c\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u4ece\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u66f4\u200b\u6539\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b\u811a\u672c\u200b\u4e2d\u200b\u7684\u200b device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu \u200b\u5373\u53ef\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"face_recognition\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u4eba\u8138\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html","title":"\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#1","title":"1. \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u65e8\u5728\u200b\u89e3\u51b3\u200b\u5f00\u653e\u200b\u57df\u200b\u76ee\u6807\u200b\u5b9a\u4f4d\u200b\u53ca\u200b\u8bc6\u522b\u200b\u95ee\u9898\u200b\uff0c\u200b\u76ee\u524d\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b PP-ShiTuV2\u3002

PP-ShiTuV2 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u5b9e\u7528\u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u4e3b\u8981\u200b\u7531\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u7279\u5f81\u200b\u5b66\u4e60\u200b\u548c\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\u7ec4\u6210\u200b\u3002\u200b\u8be5\u200b\u7cfb\u7edf\u200b\u4ece\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\u9009\u62e9\u200b\u548c\u200b\u8c03\u6574\u200b\u3001\u200b\u635f\u5931\u200b\u51fd\u6570\u200b\u7684\u200b\u9009\u62e9\u200b\u3001\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u3001\u200b\u5b66\u4e60\u200b\u7387\u200b\u53d8\u6362\u200b\u7b56\u7565\u200b\u3001\u200b\u6b63\u5219\u200b\u5316\u200b\u53c2\u6570\u200b\u9009\u62e9\u200b\u3001\u200b\u9884\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u4f7f\u7528\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u88c1\u526a\u200b\u91cf\u5316\u200b\u591a\u4e2a\u200b\u65b9\u9762\u200b\uff0c\u200b\u878d\u5408\u200b\u6539\u8fdb\u200b\u591a\u79cd\u200b\u7b56\u7565\u200b\uff0c\u200b\u5bf9\u200b\u5404\u4e2a\u200b\u6a21\u5757\u200b\u8fdb\u884c\u200b\u4f18\u5316\u200b\uff0c\u200b\u6700\u7ec8\u200b\u5728\u200b\u591a\u4e2a\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u7684\u200b\u68c0\u7d22\u200b\u6027\u80fd\u200b\u5747\u200b\u6709\u200b\u8f83\u200b\u597d\u200b\u6548\u679c\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff0c\u200b\u6709\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\u53ef\u200b\u4f9b\u9009\u62e9\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_det 41.5 62.0 33.7 537.0 27.54 \u200b\u57fa\u4e8e\u200bPicoDet_LCNet_x2_5\u200b\u7684\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6a21\u578b\u200b\u53ef\u80fd\u200b\u4f1a\u200b\u540c\u65f6\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u591a\u4e2a\u200b\u5e38\u89c1\u200b\u4e3b\u4f53\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas \u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b recall@1 (%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2\u200b\u662f\u200b\u4e00\u4e2a\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7531\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u3001\u200b\u7279\u5f81\u63d0\u53d6\u200b\u3001\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\u6784\u6210\u200b\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u662f\u200b\u5176\u4e2d\u200b\u7684\u200b\u7279\u5f81\u63d0\u53d6\u200b\u6a21\u5757\u200b\u7684\u200b\u6a21\u578b\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u7cfb\u7edf\u200b\u7684\u200b\u60c5\u51b5\u200b\u9009\u62e9\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u578b\u200b\u3002 PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u2757 \u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u8be5\u4ea7\u7ebf\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u547d\u4ee4\u884c\u200b\u4f53\u9a8c\u200b\u3002

\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5185\u7f6e\u200b\u7684\u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config PP-ShiTuV2\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b./my_path\uff09\uff1a

paddlex --get_pipeline_config PP-ShiTuV2 --save_path ./my_path\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"
  • \u200b\u5728\u200b\u8be5\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u8fd0\u884c\u200b\u793a\u4f8b\u200b\u4e2d\u200b\u9700\u8981\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4e0b\u8f7d\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b\u996e\u6599\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u6570\u636e\u200b\u96c6\u200bdrink_dataset_v2.0 \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u3002\u200b\u4e4b\u540e\u200b\u901a\u8fc7\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u5efa\u7acb\u200b\u7d22\u5f15\u200b\u5e93\u200b\u548c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\u3002
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"PP-ShiTuV2\")\n\nindex_data = pipeline.build_index(gallery_imgs=\"drink_dataset_v2.0/\", gallery_label=\"drink_dataset_v2.0/gallery.txt\")\nindex_data.save(\"drink_index\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\", index=index_data)\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b \u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b index \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u76ee\u5f55\u200b\uff08\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u8981\u200b\u5305\u542b\u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200bvector.index\u200b\u548c\u200bindex_info.yaml\uff09\uff1b2. IndexData\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5728\u200bpredict()\u200b\u4e2d\u200b\u6307\u5b9a\u200bindex\u3002 str None device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b build_index \u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u4e3a\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b gallery_imgs \u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b gallery_label \u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b str \u200b\u65e0\u200b

\u200b\u7d22\u5f15\u200b\u5e93\u200b\u5bf9\u8c61\u200b index \u200b\u652f\u6301\u200b save \u200b\u65b9\u6cd5\u200b\uff0c\u200b\u7528\u4e8e\u200b\u5c06\u200b\u7d22\u5f15\u200b\u5e93\u200b\u4fdd\u5b58\u200b\u5230\u200b\u78c1\u76d8\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b save_path \u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5982\u200bdrink_index\u3002 str \u200b\u65e0\u200b

\uff083\uff09\u200b\u8c03\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200b input\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\u200b\u53e6\u5916\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u652f\u6301\u200b\u53c2\u6570\u200bindex\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b index \u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u6240\u7528\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u76ee\u5f55\u200b\uff08\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u8981\u200b\u5305\u542b\u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200bvector.index\u200b\u548c\u200bindex_info.yaml\uff09\uff1b2. IndexData\u200b\u5bf9\u8c61\u200b\u3002\u200b\u5982\u200b\u4e0d\u200b\u4f20\u5165\u200b\u8be5\u200b\u53c2\u6570\u200b\uff0c\u200b\u5219\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b\u5728\u200bcreate_pipeline()\u200b\u4e2d\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200bindex\u200b\u6307\u5b9a\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002

\uff084\uff09\u200b\u8c03\u7528\u200b predict \u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200b generator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict \u200b\u5c06\u200b\u65b9\u6cd5\u200b\u4ee5\u200b batch \u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u3002

\uff085\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200b dict \u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/PP-ShiTuV2.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/PP-ShiTuV2.yaml\", index=\"drink_index\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#223","title":"2.2.3 \u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6dfb\u52a0\u200b\u548c\u200b\u5220\u9664\u200b\u64cd\u4f5c","text":"

\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u5c06\u200b\u66f4\u200b\u591a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6dfb\u52a0\u200b\u5230\u200b\u7d22\u5f15\u200b\u5e93\u4e2d\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b append_index \u200b\u65b9\u6cd5\u200b\uff1b\u200b\u5220\u9664\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff0c\u200b\u5219\u200b\u53ef\u4ee5\u200b\u8c03\u7528\u200b remove_index \u200b\u65b9\u6cd5\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(\"PP-ShiTuV2\")\nindex_data = pipeline.build_index(gallery_imgs=\"drink_dataset_v2.0/\", gallery_label=\"drink_dataset_v2.0/gallery.txt\", index_type=\"IVF\", metric_type=\"IP\")\nindex_data = pipeline.append_index(gallery_imgs=\"drink_dataset_v2.0/\", gallery_label=\"drink_dataset_v2.0/gallery.txt\", index=index_data)\nindex_data = pipeline.remove_index(remove_ids=\"drink_dataset_v2.0/remove_ids.txt\", index=index_data)\nindex_data.save(\"drink_index\")\n

\u200b\u4e0a\u8ff0\u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b gallery_imgs \u200b\u8981\u200b\u6dfb\u52a0\u200b\u7684\u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u7247\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u4e0e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u65f6\u200b\u76f8\u540c\u200b\uff0c\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\uff1b2. [numpy.ndarray, numpy.ndarray, ..]\u200b\u7c7b\u578b\u200b\u7684\u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\u6570\u636e\u200b\u3002 str|list \u200b\u65e0\u200b gallery_label \u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\u7684\u200b\u6807\u6ce8\u200b\u4fe1\u606f\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u7684\u200b\u8def\u5f84\u200b\uff0c\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\u4e0e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u65f6\u200b\u76f8\u540c\u200b\uff0c\u200b\u53c2\u8003\u200b2.3\u200b\u8282\u200b \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f\u200b\uff1b2. [str, str, ..]\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5e95\u5e93\u200b\u56fe\u7247\u200b\u6807\u6ce8\u200b\u3002 str|list \u200b\u65e0\u200b remove_ids \u200b\u5f85\u200b\u5220\u9664\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e8f\u53f7\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. str\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200btxt\u200b\u6587\u4ef6\u200b\u7684\u200b\u8def\u5f84\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3a\u200b\u5f85\u200b\u5220\u9664\u200b\u7684\u200b\u7d22\u5f15\u200bid\uff0c\u200b\u6bcf\u884c\u200b\u4e00\u4e2a\u200b\u201cid\u201d\uff1b2. [int, int, ..]\u200b\u7c7b\u578b\u200b\u8868\u793a\u200b\u7684\u200b\u5f85\u200b\u5220\u9664\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e8f\u53f7\u200b\u3002\u200b\u4ec5\u200b\u5728\u200b remove_index \u200b\u4e2d\u200b\u6709\u6548\u200b\u3002 str|list \u200b\u65e0\u200b index \u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u652f\u6301\u200b\uff1a1. \u200b\u7d22\u5f15\u200b\u5e93\u200b\u6587\u4ef6\u200b\uff08vector.index\u200b\u548c\u200bindex_info.yaml\uff09\u200b\u6240\u5728\u200b\u76ee\u5f55\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b2. IndexData\u200b\u7c7b\u578b\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u5bf9\u8c61\u200b\uff0c\u200b\u4ec5\u200b\u5728\u200b append_index \u200b\u548c\u200b remove_index \u200b\u4e2d\u200b\u6709\u6548\u200b\uff0c\u200b\u8868\u793a\u200b\u5f85\u200b\u4fee\u6539\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u3002 str|IndexData \u200b\u65e0\u200b index_type \u200b\u652f\u6301\u200b HNSW32\u3001IVF\u3001Flat\u3002\u200b\u5176\u4e2d\u200b\uff0cHNSW32 \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u4e14\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u4f46\u200b\u4e0d\u200b\u652f\u6301\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bIVF \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u4f46\u200b\u7cbe\u5ea6\u200b\u76f8\u5bf9\u200b\u8f83\u200b\u4f4e\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\uff1bFlat \u200b\u68c0\u7d22\u200b\u901f\u5ea6\u200b\u8f83\u200b\u4f4e\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\uff0c\u200b\u652f\u6301\u200b append_index() \u200b\u548c\u200b remove_index() \u200b\u64cd\u4f5c\u200b\u3002 str HNSW32 metric_type \u200b\u652f\u6301\u200b\uff1aIP\uff0c\u200b\u5185\u79ef\u200b\uff08Inner Product\uff09\uff1bL2\uff0c\u200b\u6b27\u51e0\u91cc\u5f97\u200b\u8ddd\u79bb\u200b\uff08Euclidean Distance\uff09\u3002 str IP"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#23","title":"2.3 \u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\u7684\u200b\u6570\u636e\u7ec4\u7ec7\u200b\u65b9\u5f0f","text":"

PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u793a\u4f8b\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u9884\u5148\u200b\u6784\u5efa\u200b\u597d\u200b\u7684\u200b\u7d22\u5f15\u200b\u5e93\u200b\u8fdb\u884c\u200b\u7279\u5f81\u200b\u68c0\u7d22\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u5e0c\u671b\u200b\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u5e93\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6309\u7167\u200b\u5982\u4e0b\u200b\u65b9\u5f0f\u200b\u7ec4\u7ec7\u200b\u6570\u636e\u200b\uff1a

data_root             # \u200b\u6570\u636e\u200b\u96c6\u200b\u6839\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u251c\u2500\u2500 images            # \u200b\u56fe\u50cf\u200b\u7684\u200b\u4fdd\u5b58\u200b\u76ee\u5f55\u200b\uff0c\u200b\u76ee\u5f55\u200b\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # \u200b\u7d22\u5f15\u200b\u5e93\u200b\u6570\u636e\u200b\u96c6\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\uff0c\u200b\u6587\u4ef6\u540d\u79f0\u200b\u53ef\u4ee5\u200b\u6539\u53d8\u200b\u3002\u200b\u6bcf\u884c\u200b\u7ed9\u51fa\u200b\u5f85\u200b\u68c0\u7d22\u200b\u56fe\u50cf\u200b\u8def\u5f84\u200b\u548c\u200b\u56fe\u50cf\u200b\u6807\u7b7e\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7a7a\u683c\u200b\u5206\u9694\u200b\uff0c\u200b\u5185\u5bb9\u200b\u4e3e\u4f8b\u200b\uff1a \u201c0/0.jpg \u200b\u8109\u52a8\u200b\u201d\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • buildIndex

\u200b\u6784\u5efa\u200b\u7279\u5f81\u5411\u91cf\u200b\u7d22\u5f15\u200b\u3002

POST /shitu-index-build

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b imageLabelPairs array \u200b\u7528\u4e8e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u7684\u200b\u56fe\u50cf\u200b-\u200b\u6807\u7b7e\u200b\u5bf9\u200b\u3002 \u200b\u662f\u200b

imageLabelPairs\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 label string \u200b\u6807\u7b7e\u200b\u3002
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\uff0c\u200b\u7528\u4e8e\u200b\u6807\u8bc6\u200b\u5efa\u7acb\u200b\u7684\u200b\u7d22\u5f15\u200b\u3002\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002 idMap object \u200b\u5411\u91cf\u200bID\u200b\u5230\u200b\u6807\u7b7e\u200b\u7684\u200b\u6620\u5c04\u200b\u3002
  • addImagesToIndex

\u200b\u5c06\u200b\u56fe\u50cf\u200b\uff08\u200b\u5bf9\u5e94\u200b\u7684\u200b\u7279\u5f81\u5411\u91cf\u200b\uff09\u200b\u52a0\u5165\u200b\u7d22\u5f15\u200b\u3002

POST /shitu-index-add

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b imageLabelPairs array \u200b\u7528\u4e8e\u200b\u6784\u5efa\u200b\u7d22\u5f15\u200b\u7684\u200b\u56fe\u50cf\u200b-\u200b\u6807\u7b7e\u200b\u5bf9\u200b\u3002 \u200b\u662f\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\u3002\u200b\u7531\u200bbuildIndex\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b

imageLabelPairs\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 label string \u200b\u6807\u7b7e\u200b\u3002
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b idMap object \u200b\u5411\u91cf\u200bID\u200b\u5230\u200b\u6807\u7b7e\u200b\u7684\u200b\u6620\u5c04\u200b\u3002
  • removeImagesFromIndex

\u200b\u4ece\u200b\u7d22\u5f15\u200b\u4e2d\u200b\u79fb\u9664\u200b\u56fe\u50cf\u200b\uff08\u200b\u5bf9\u5e94\u200b\u7684\u200b\u7279\u5f81\u5411\u91cf\u200b\uff09\u3002

POST /shitu-index-remove

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b ids array \u200b\u9700\u8981\u200b\u4ece\u200b\u7d22\u5f15\u200b\u4e2d\u200b\u79fb\u9664\u200b\u7684\u200b\u5411\u91cf\u200b\u7684\u200bID\u3002 \u200b\u662f\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\u3002\u200b\u7531\u200bbuildIndex\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b idMap object \u200b\u5411\u91cf\u200bID\u200b\u5230\u200b\u6807\u7b7e\u200b\u7684\u200b\u6620\u5c04\u200b\u3002
  • infer

\u200b\u8fdb\u884c\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u3002

POST /shitu-infer

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b indexKey string \u200b\u7d22\u5f15\u200b\u5bf9\u5e94\u200b\u7684\u200b\u952e\u200b\u3002\u200b\u7531\u200bbuildIndex\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b detectedObjects array \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u76ee\u6807\u200b\u7684\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

detectedObjects\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u76ee\u6807\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 recResults array \u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002 score number \u200b\u68c0\u6d4b\u200b\u5f97\u5206\u200b\u3002

recResults\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\n\nbase_image_label_pairs = [\n    {\"image\": \"./demo0.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo1.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo2.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nimage_label_pairs_to_add = [\n    {\"image\": \"./demo3.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nids_to_remove = [1]\ninfer_image_path = \"./demo4.jpg\"\noutput_image_path = \"./out.jpg\"\n\nfor pair in base_image_label_pairs:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": base_image_label_pairs}\nresp_index_build = requests.post(f\"{API_BASE_URL}/shitu-index-build\", json=payload)\nif resp_index_build.status_code != 200:\n    print(f\"Request to shitu-index-build failed with status code {resp_index_build}.\")\n    pprint.pp(resp_index_build.json())\n    sys.exit(1)\nresult_index_build = resp_index_build.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_build['idMap'])}\")\n\nfor pair in image_label_pairs_to_add:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": image_label_pairs_to_add, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_add = requests.post(f\"{API_BASE_URL}/shitu-index-add\", json=payload)\nif resp_index_add.status_code != 200:\n    print(f\"Request to shitu-index-add failed with status code {resp_index_add}.\")\n    pprint.pp(resp_index_add.json())\n    sys.exit(1)\nresult_index_add = resp_index_add.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_add['idMap'])}\")\n\npayload = {\"ids\": ids_to_remove, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_remove = requests.post(f\"{API_BASE_URL}/shitu-index-remove\", json=payload)\nif resp_index_remove.status_code != 200:\n    print(f\"Request to shitu-index-remove failed with status code {resp_index_remove}.\")\n    pprint.pp(resp_index_remove.json())\n    sys.exit(1)\nresult_index_remove = resp_index_remove.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_remove['idMap'])}\")\n\nwith open(infer_image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_infer = requests.post(f\"{API_BASE_URL}/shitu-infer\", json=payload)\nif resp_infer.status_code != 200:\n    print(f\"Request to shitu-infer failed with status code {resp_infer}.\")\n    pprint.pp(resp_infer.json())\n    sys.exit(1)\nresult_infer = resp_infer.json()[\"result\"]\n\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result_infer[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\npprint.pp(result_infer[\"detectedObjects\"])\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4e3b\u4f53\u200b\u76ee\u6807\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u4e3b\u4f53\u200b\u51fa\u73b0\u200b\u5339\u914d\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

Pipeline:\n  device: \"gpu:0\"\n  det_model: \"./PP-ShiTuV2_det_infer/\"        #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  rec_model: \"./PP-ShiTuV2_rec_infer/\"        #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u4f7f\u7528\u200bPython\u200b\u8fd0\u884c\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u4ece\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u66f4\u200b\u6539\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b\u811a\u672c\u200b\u4e2d\u200b\u7684\u200b device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu \u200b\u5373\u53ef\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ShiTuV2\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n

\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html","title":"\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#1","title":"1. \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\uff0c\u200b\u6765\u200b\u8bc6\u522b\u200b\u4e0e\u4f17\u4e0d\u540c\u200b\u6216\u200b\u4e0d\u200b\u7b26\u5408\u200b\u6b63\u5e38\u200b\u6a21\u5f0f\u200b\u7684\u200b\u56fe\u50cf\u5904\u7406\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5de5\u4e1a\u200b\u8d28\u91cf\u200b\u68c0\u6d4b\u200b\u3001\u200b\u533b\u7597\u200b\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u5b89\u5168\u76d1\u63a7\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6f5c\u5728\u200b\u7684\u200b\u7f3a\u9677\u200b\u3001\u200b\u5f02\u5e38\u200b\u6216\u200b\u5f02\u5e38\u200b\u884c\u4e3a\u200b\uff0c\u200b\u4ece\u800c\u200b\u5e2e\u52a9\u200b\u6211\u4eec\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u95ee\u9898\u200b\u5e76\u200b\u91c7\u53d6\u76f8\u5e94\u200b\u63aa\u65bd\u200b\u3002\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7cfb\u7edf\u200b\u88ab\u200b\u8bbe\u8ba1\u200b\u7528\u4e8e\u200b\u81ea\u52a8\u68c0\u6d4b\u200b\u548c\u200b\u6807\u8bb0\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u9ad8\u200b\u5de5\u4f5c\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002

\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) STFPM\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.2 21.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config anomaly_detection\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config anomaly_detection --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./anomaly_detection.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./anomaly_detection.yaml --input uad_grid.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'uad_grid.png'}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"anomaly_detection\")\n\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/*anomaly_detection.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/anomaly_detection.yaml\")\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3002

POST /anomaly-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b labelMap array \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u3002\u200b\u5176\u4e2d\u200b255\u200b\u8868\u793a\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c0\u200b\u8868\u793a\u200b\u975e\u200b\u5f02\u5e38\u200b\u70b9\u200b\u3002 size array \u200b\u56fe\u50cf\u200b\u5f62\u72b6\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u7684\u200b\u9ad8\u5ea6\u200b\u548c\u200b\u5bbd\u5ea6\u200b\u3002 image string \u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"labelMap\": [\n0,\n0,\n255,\n0\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-anomaly-detection\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n# result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/image-anomaly-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n            // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-anomaly-detection\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-anomaly-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-anomaly-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-anomaly-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-anomaly-detection\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n// result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65e0\u200b\u76d1\u7763\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65e0\u200b\u76d1\u7763\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: STFPM   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline anomaly_detection --input uad_grid.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html","title":"\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#1","title":"1. \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b9\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b80\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top1 Acc(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b CLIP_vit_base_patch16_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.36 13.1957 285.493 306.5 M CLIP\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200b\u89c6\u89c9\u200b\u548c\u200b\u8bed\u8a00\u200b\u76f8\u5173\u8054\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u91c7\u7528\u200b\u5bf9\u6bd4\u200b\u5b66\u4e60\u200b\u548c\u200b\u9884\u200b\u8bad\u7ec3\u65b9\u6cd5\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u65e0\u200b\u76d1\u7763\u200b\u6216\u5f31\u200b\u76d1\u7763\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\uff0c\u200b\u5c24\u5176\u200b\u9002\u7528\u200b\u4e8e\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u5c06\u200b\u56fe\u50cf\u200b\u548c\u200b\u6587\u672c\u200b\u6620\u5c04\u200b\u5230\u200b\u540c\u4e00\u200b\u8868\u793a\u200b\u7a7a\u95f4\u200b\uff0c\u200b\u5b66\u4e60\u200b\u5230\u200b\u901a\u7528\u200b\u7279\u5f81\u200b\uff0c\u200b\u5177\u6709\u200b\u826f\u597d\u200b\u7684\u200b\u6cdb\u5316\u200b\u80fd\u529b\u200b\u548c\u200b\u89e3\u91ca\u6027\u200b\u3002\u200b\u5176\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8bad\u7ec3\u200b\u8bef\u5dee\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 CLIP_vit_large_patch14_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.84 12.8473 1513.87 313.9 M ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200bMeta\u200b\u5728\u200b2022\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u57fa\u4e8e\u200bCNN\u200b\u67b6\u6784\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200bResNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u901a\u8fc7\u200b\u501f\u9274\u200bSwinTransformer\u200b\u7684\u200b\u4f18\u70b9\u200b\u8bbe\u8ba1\u200b\uff0c\u200b\u5305\u62ec\u200b\u8bad\u7ec3\u200b\u7b56\u7565\u200b\u548c\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7684\u200b\u4f18\u5316\u200b\u601d\u8def\u200b\uff0c\u200b\u4ece\u800c\u200b\u6539\u8fdb\u200b\u7684\u200b\u7eaf\u200bCNN\u200b\u67b6\u6784\u200b\u7f51\u7edc\u200b\uff0c\u200b\u63a2\u7d22\u200b\u4e86\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u6027\u80fd\u200b\u4e0a\u9650\u200b\u3002ConvNeXt\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u5177\u5907\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u7684\u200b\u8bf8\u591a\u200b\u4f18\u70b9\u200b\uff0c\u200b\u5305\u62ec\u200b\u63a8\u7406\u200b\u6548\u7387\u9ad8\u200b\u548c\u200b\u6613\u4e8e\u200b\u8fc1\u79fb\u200b\u5230\u200b\u4e0b\u6e38\u200b\u4efb\u52a1\u200b\u7b49\u200b\u3002 ConvNeXt_base_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.27 66.4058 6598.92 700.7 M ConvNeXt_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.13 9.74075 1127.6 178.0 M ConvNeXt_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.03 5.48923 672.559 104.1 M FasterNet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.5 23.4415 - 357.1 M FasterNet\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e8\u5728\u200b\u63d0\u9ad8\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u7684\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u6539\u8fdb\u200b\u70b9\u200b\u4e3b\u8981\u200b\u5982\u4e0b\u200b\uff1a 1.\u200b\u91cd\u65b0\u200b\u5ba1\u89c6\u200b\u4e86\u200b\u6d41\u884c\u200b\u7684\u200b\u8fd0\u7b97\u7b26\u200b\uff0c\u200b\u53d1\u73b0\u200b\u4f4e\u200bFLOPS\u200b\u4e3b\u8981\u200b\u6765\u81ea\u200b\u4e8e\u200b\u8fd0\u7b97\u200b\u9891\u7e41\u200b\u7684\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\uff0c\u200b\u7279\u522b\u200b\u662f\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff1b 2.\u200b\u63d0\u51fa\u200b\u4e86\u200b\u90e8\u5206\u200b\u5377\u79ef\u200b(PConv)\uff0c\u200b\u901a\u8fc7\u200b\u51cf\u5c11\u200b\u5197\u4f59\u200b\u8ba1\u7b97\u200b\u548c\u200b\u5185\u5b58\u200b\u8bbf\u95ee\u200b\u6765\u200b\u66f4\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\uff1b 3.\u200b\u57fa\u4e8e\u200bPConv\u200b\u63a8\u51fa\u200b\u4e86\u200bFasterNet\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u8bbe\u8ba1\u65b9\u6848\u200b\uff0c\u200b\u5728\u200b\u4e0d\u200b\u5f71\u54cd\u200b\u6a21\u578b\u200b\u4efb\u52a1\u200b\u6027\u80fd\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5728\u200b\u5404\u79cd\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u663e\u8457\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u8fd0\u884c\u200b\u901f\u5ea6\u200b\u3002 FasterNet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.0 21.8936 - 204.6 M FasterNet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.3 13.0409 - 119.3 M FasterNet-T0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.9 12.2432 - 15.1 M FasterNet-T1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.9 11.3562 - 29.2 M FasterNet-T2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.703 - 57.4 M MobileNetV1_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.5 1.86754 7.48297 4.8 M MobileNetV1\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2017\u200b\u5e74\u200b\u53d1\u5e03\u200b\u7684\u200b\u7528\u4e8e\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u200b\u6216\u200b\u5d4c\u5165\u5f0f\u200b\u8bbe\u5907\u200b\u4e2d\u200b\u7684\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5c06\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u64cd\u4f5c\u200b\u62c6\u89e3\u200b\u6210\u200b\u6df1\u5ea6\u200b\u53ef\u200b\u5206\u79bb\u200b\u5377\u79ef\u200b\uff0c\u200b\u5373\u200bDepthwise\u200b\u5377\u79ef\u200b\u548c\u200bPointwise\u200b\u5377\u79ef\u200b\u7684\u200b\u7ec4\u5408\u200b\u3002\u200b\u76f8\u6bd4\u200b\u4f20\u7edf\u200b\u7684\u200b\u5377\u79ef\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7ec4\u5408\u200b\u53ef\u4ee5\u200b\u5927\u5927\u200b\u8282\u7701\u200b\u53c2\u200b\u6570\u91cf\u200b\u548c\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u3002\u200b\u540c\u65f6\u200b\u8be5\u200b\u7f51\u7edc\u200b\u53ef\u4ee5\u200b\u7528\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7b49\u200b\u5176\u4ed6\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u3002 MobileNetV1_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.0 4.94234 11.1629 7.1 M MobileNetV2\u200b\u662f\u200bGoogle\u200b\u7ee7\u200bMobileNetV1\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u76f8\u6bd4\u200bMobileNetV1\uff0cMobileNetV2\u200b\u63d0\u51fa\u200b\u4e86\u200bLinear bottlenecks\u200b\u4e0e\u200bInverted residual block\u200b\u4f5c\u4e3a\u200b\u7f51\u7edc\u200b\u57fa\u672c\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u91cf\u200b\u5730\u200b\u5806\u53e0\u200b\u8fd9\u4e9b\u200b\u57fa\u672c\u200b\u6a21\u5757\u200b\uff0c\u200b\u6784\u6210\u200b\u4e86\u200bMobileNetV2\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u3002\u200b\u6700\u540e\u200b\uff0c\u200b\u5728\u200bFLOPs\u200b\u53ea\u6709\u200bMobileNetV1\u200b\u7684\u200b\u4e00\u534a\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\u53d6\u5f97\u200b\u4e86\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u5206\u7c7b\u200b\u7cbe\u5ea6\u200b\u3002 MobileNetV2_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 69.2 6.31302 14.5588 9.6 M MobileNetV3\u200b\u662f\u200bGoogle\u200b\u4e8e\u200b2019\u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bNAS\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u7f51\u7edc\u200b\u3002\u200b\u4e3a\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\uff0c\u200b\u5c06\u200brelu\u200b\u548c\u200bsigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\u5206\u522b\u200b\u66ff\u6362\u200b\u4e3a\u200bhard_swish\u200b\u4e0e\u200bhard_sigmoid\u200b\u6fc0\u6d3b\u200b\u51fd\u6570\u200b\uff0c\u200b\u540c\u65f6\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u4e9b\u200b\u4e13\u95e8\u200b\u4e3a\u200b\u51cf\u5c11\u200b\u7f51\u7edc\u200b\u8ba1\u7b97\u200b\u91cf\u200b\u7684\u200b\u6539\u8fdb\u200b\u7b56\u7565\u200b\u3002 MobileNetV3_large_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.4 12.5485 51.6453 125.2 M MobileNetV4\u200b\u662f\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u8bbe\u5907\u8bbe\u8ba1\u200b\u7684\u200b\u9ad8\u6548\u200b\u67b6\u6784\u200b\u3002\u200b\u5176\u200b\u6838\u5fc3\u200b\u5728\u4e8e\u200b\u5f15\u5165\u200b\u4e86\u200bUIB\uff08Universal Inverted Bottleneck\uff09\u200b\u6a21\u5757\u200b\uff0c\u200b\u8fd9\u662f\u200b\u4e00\u79cd\u200b\u7edf\u4e00\u200b\u4e14\u200b\u7075\u6d3b\u200b\u7684\u200b\u7ed3\u6784\u200b\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bIB\uff08Inverted Bottleneck\uff09\u3001ConvNeXt\u3001FFN\uff08Feed Forward Network\uff09\u200b\u4ee5\u53ca\u200b\u6700\u65b0\u200b\u7684\u200bExtraDW\uff08Extra Depthwise\uff09\u200b\u6a21\u5757\u200b\u3002\u200b\u4e0e\u200bUIB\u200b\u540c\u65f6\u200b\u63a8\u51fa\u200b\u7684\u200b\u8fd8\u6709\u200bMobile MQA\uff0c\u200b\u8fd9\u200b\u662f\u200b\u79cd\u200b\u4e13\u4e3a\u200b\u79fb\u52a8\u200b\u52a0\u901f\u5668\u200b\u5b9a\u5236\u200b\u7684\u200b\u6ce8\u610f\u529b\u200b\u5757\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b\u9ad8\u200b\u8fbe\u200b39%\u200b\u7684\u200b\u663e\u8457\u200b\u52a0\u901f\u200b\u3002\u200b\u6b64\u5916\u200b\uff0cMobileNetV4\u200b\u5f15\u5165\u200b\u4e86\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u795e\u7ecf\u200b\u67b6\u6784\u200b\u641c\u7d22\u200b\uff08Neural Architecture Search, NAS\uff09\u200b\u65b9\u6848\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u641c\u7d22\u200b\u7684\u200b\u6709\u6548\u6027\u200b\u3002 MobileNetV4_conv_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_large\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_medium\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.5 19.7543 62.2624 42.9 M PP-HGNet_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 85.0 14.2969 327.114 249.4 M PP-HGNet\uff08High Performance GPU Net\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u9002\u7528\u200b\u4e8e\u200bGPU\u200b\u5e73\u53f0\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u7ed3\u5408\u200bVOVNet\u200b\u7684\u200b\u57fa\u7840\u200b\u51fa\u200b\u4f7f\u7528\u200b\u4e86\u200b\u53ef\u200b\u5b66\u4e60\u200b\u7684\u200b\u4e0b\u200b\u91c7\u6837\u200b\u5c42\u200b\uff08LDS Layer\uff09\uff0c\u200b\u878d\u5408\u200b\u4e86\u200bResNet_vd\u3001PPHGNet\u200b\u7b49\u200b\u6a21\u578b\u200b\u7684\u200b\u4f18\u70b9\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200bGPU\u200b\u5e73\u53f0\u200b\u4e0a\u200b\u4e0e\u200b\u5176\u4ed6\u200bSOTA\u200b\u6a21\u578b\u200b\u5728\u200b\u76f8\u540c\u200b\u7684\u200b\u901f\u5ea6\u200b\u4e0b\u200b\u6709\u7740\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u5728\u200b\u540c\u7b49\u200b\u901f\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u9ad8\u4e8e\u200bResNet34-0\u200b\u6a21\u578b\u200b3.8\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u9ad8\u4e8e\u200bResNet50-0\u200b\u6a21\u578b\u200b2.4\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0c\u200b\u5728\u200b\u4f7f\u7528\u200b\u76f8\u540c\u200b\u7684\u200bSLSD\u200b\u6761\u6b3e\u200b\u4e0b\u200b\uff0c\u200b\u6700\u7ec8\u200b\u8d85\u8d8a\u200b\u4e86\u200bResNet50-D\u200b\u6a21\u578b\u200b4.7\u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\u3002\u200b\u4e0e\u6b64\u540c\u65f6\u200b\uff0c\u200b\u5728\u200b\u76f8\u540c\u200b\u7cbe\u5ea6\u200b\u4e0b\u200b\uff0c\u200b\u5176\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e5f\u200b\u8fdc\u8d85\u200b\u4e3b\u6d41\u200bVisionTransformer\u200b\u7684\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-HGNet_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.51 5.50661 119.041 86.5 M PP-HGNet_tiny\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.77 6.53694 23.352 21.4 M PP-HGNetV2\uff08High Performance GPU Network V2\uff09\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u7684\u200bPP-HGNet\u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPP-HGNet\u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u5176\u200b\u5728\u200bNVIDIA\u200b\u53d1\u5e03\u200b\u7684\u200b\u201cAccuracy-Latency Balance\u201d\u200b\u505a\u5230\u200b\u4e86\u200b\u6781\u81f4\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u4e86\u200b\u5176\u4ed6\u200b\u540c\u6837\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5728\u200b\u6bcf\u79cd\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8003\u6807\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u90fd\u200b\u6709\u200b\u8f83\u200b\u5f3a\u200b\u7684\u200b\u8868\u73b0\u200b\u3002 PP-HGNetV2-B1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.14 3.67722 6.66857 6.7 M PP-LCNet\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u5b83\u200b\u80fd\u200b\u5728\u200b\u4e0d\u200b\u589e\u52a0\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\uff0c\u200b\u5927\u5e45\u200b\u8d85\u8d8a\u200b\u5176\u4ed6\u200b\u8f7b\u91cf\u7ea7\u200bSOTA\u200b\u6a21\u578b\u200b\u3002 PP-LCNet_x0_25\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_base\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.05 5.23428 19.6005 23.7 M PP-LCNetV2 \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b PP-LCNet \u200b\u7684\u200b\u4e0b\u4e00\u4ee3\u200b\u7248\u672c\u200b\uff0c\u200b\u5176\u200b\u5728\u200b PP-LCNet \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u505a\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u4f18\u5316\u200b\u548c\u200b\u6539\u8fdb\u200b\uff0c\u200b\u4e3b\u8981\u200b\u4f7f\u7528\u200b\u91cd\u200b\u53c2\u6570\u200b\u5316\u200b\u7b56\u7565\u200b\u7ec4\u5408\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5927\u5c0f\u200b\u5377\u79ef\u200b\u6838\u200b\u7684\u200b\u6df1\u5ea6\u200b\u5377\u79ef\u200b\uff0c\u200b\u5e76\u200b\u4f18\u5316\u200b\u4e86\u200b\u70b9\u200b\u5377\u79ef\u200b\u3001Shortcut\u200b\u7b49\u200b\u3002\u200b\u5728\u200b\u4e0d\u200b\u4f7f\u7528\u200b\u989d\u5916\u200b\u6570\u636e\u200b\u7684\u200b\u524d\u63d0\u200b\u4e0b\u200b\uff0cPPLCNetV2_base \u200b\u6a21\u578b\u200b\u5728\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b ImageNet \u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u80fd\u591f\u200b\u53d6\u5f97\u200b\u8d85\u8fc7\u200b 77% \u200b\u7684\u200b Top1 Acc\uff0c\u200b\u540c\u65f6\u200b\u5728\u200b Intel CPU \u200b\u5e73\u53f0\u200b\u7684\u200b\u63a8\u7406\u200b\u65f6\u95f4\u200b\u5728\u200b 4.4 ms \u200b\u4ee5\u4e0b\u200b PP-LCNetV2_large \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_small\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.97 3.89762 13.0273 14.6 M ResNet18_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 72.3 3.53048 31.3014 41.5 M ResNet \u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u662f\u200b\u5728\u200b 2015 \u200b\u5e74\u200b\u63d0\u51fa\u200b\u7684\u200b\uff0c\u200b\u4e00\u4e3e\u200b\u5728\u200b ILSVRC2015 \u200b\u6bd4\u8d5b\u200b\u4e2d\u200b\u53d6\u5f97\u200b\u51a0\u519b\u200b\uff0ctop5 \u200b\u9519\u8bef\u7387\u200b\u4e3a\u200b 3.57%\u3002\u200b\u8be5\u200b\u7f51\u7edc\u200b\u521b\u65b0\u6027\u200b\u7684\u200b\u63d0\u51fa\u200b\u4e86\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5806\u53e0\u200b\u591a\u4e2a\u200b\u6b8b\u5dee\u200b\u7ed3\u6784\u200b\u4ece\u800c\u200b\u6784\u5efa\u200b\u4e86\u200b ResNet \u200b\u7f51\u7edc\u200b\u3002\u200b\u5b9e\u9a8c\u200b\u8868\u660e\u200b\u4f7f\u7528\u200b\u6b8b\u5dee\u200b\u5757\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u5730\u200b\u63d0\u5347\u200b\u6536\u655b\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u3002 ResNet18 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 71.0 2.4868 27.4601 41.5 M ResNet34_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.0 5.60675 56.0653 77.3 M ResNet34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.6 4.16902 51.925 77.3 M ResNet50_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.1 10.1885 68.446 90.8 M ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 76.5 9.62383 64.8135 90.8 M ResNet101_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.2 20.0563 124.85 158.4 M ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.6 19.2297 121.006 158.4 M ResNet152_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.6 29.6439 181.678 214.3 M ResNet152\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.3 30.0461 177.707 214.2 M ResNet200_vd\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.9 39.1628 235.185 266.0 M StarNet-S1\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 73.6 9.895 23.0465 11.2 M StarNet \u200b\u805a\u7126\u200b\u4e8e\u200b\u7814\u7a76\u200b\u7f51\u7edc\u200b\u8bbe\u8ba1\u200b\u4e2d\u200b\u201c\u200b\u661f\u200b\u64cd\u4f5c\u200b\u201d\uff08\u200b\u5373\u200b\u5143\u7d20\u200b\u7ea7\u200b\u4e58\u6cd5\u200b\uff09\u200b\u7684\u200b\u672a\u200b\u5f00\u53d1\u200b\u6f5c\u529b\u200b\u3002\u200b\u63ed\u793a\u200b\u661f\u200b\u64cd\u4f5c\u200b\u80fd\u591f\u200b\u5c06\u200b\u8f93\u5165\u200b\u6620\u5c04\u200b\u5230\u200b\u9ad8\u7ef4\u200b\u3001\u200b\u975e\u7ebf\u6027\u200b\u7279\u5f81\u200b\u7a7a\u95f4\u200b\u7684\u200b\u80fd\u529b\u200b\uff0c\u200b\u8fd9\u4e00\u200b\u8fc7\u7a0b\u200b\u7c7b\u4f3c\u200b\u4e8e\u200b\u6838\u200b\u6280\u5de7\u200b\uff0c\u200b\u4f46\u200b\u65e0\u9700\u200b\u6269\u5927\u200b\u7f51\u7edc\u200b\u89c4\u6a21\u200b\u3002\u200b\u56e0\u6b64\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u51fa\u200b\u4e86\u200b StarNet\uff0c\u200b\u4e00\u4e2a\u200b\u7b80\u5355\u200b\u800c\u200b\u5f3a\u5927\u200b\u7684\u200b\u539f\u578b\u200b\u7f51\u7edc\u200b\uff0c\u200b\u8be5\u200b\u7f51\u7edc\u200b\u5728\u200b\u7d27\u51d1\u200b\u7684\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u548c\u200b\u6709\u9650\u200b\u7684\u200b\u8ba1\u7b97\u8d44\u6e90\u200b\u4e0b\u200b\uff0c\u200b\u5c55\u73b0\u51fa\u200b\u4e86\u200b\u5353\u8d8a\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u4f4e\u200b\u5ef6\u8fdf\u200b\u3002 StarNet-S2 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 74.8 7.91279 21.9571 14.3 M StarNet-S3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.0 10.7531 30.7656 22.2 M StarNet-S4\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.37 16.9848 383.83 310.5 M SwinTransformer \u200b\u662f\u200b\u4e00\u79cd\u200b\u65b0\u200b\u7684\u200b\u89c6\u89c9\u200b Transformer \u200b\u7f51\u7edc\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u7528\u4f5c\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u901a\u7528\u200b\u9aa8\u5e72\u7f51\u200b\u8def\u200b\u3002SwinTransformer \u200b\u7531\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\uff08shifted windows\uff09\u200b\u8868\u793a\u200b\u7684\u200b\u5c42\u6b21\u200b Transformer \u200b\u7ed3\u6784\u200b\u7ec4\u6210\u200b\u3002\u200b\u79fb\u52a8\u200b\u7a97\u53e3\u200b\u5c06\u200b\u81ea\u200b\u6ce8\u610f\u200b\u8ba1\u7b97\u200b\u9650\u5236\u200b\u5728\u200b\u975e\u200b\u91cd\u53e0\u200b\u7684\u200b\u5c40\u90e8\u200b\u7a97\u53e3\u200b\u4e0a\u200b\uff0c\u200b\u540c\u65f6\u200b\u5141\u8bb8\u200b\u8de8\u200b\u7a97\u53e3\u200b\u8fde\u63a5\u200b\uff0c\u200b\u4ece\u800c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u7f51\u7edc\u200b\u6027\u80fd\u200b\u3002 SwinTransformer_base_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 81.10 8.54846 156.306 100.1 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config image_classification\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config image_classification --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./image_classification.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': [0.62736, 0.03752, 0.03256, 0.0323, 0.03194], 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/image_classification*.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002

POST /image-classification

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b topK integer \u200b\u7ed3\u679c\u200b\u4e2d\u5c06\u200b\u53ea\u200b\u4fdd\u7559\u200b\u5f97\u5206\u200b\u6700\u9ad8\u200b\u7684\u200btopK\u200b\u4e2a\u200b\u7c7b\u522b\u200b\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b categories array \u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

categories\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b id integer \u200b\u7c7b\u522b\u200bID\u3002 name string \u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u3002 score number \u200b\u7c7b\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"\u200b\u5154\u5b50\u200b\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-classification\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/image-classification\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-classification\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-classification\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PP-LCNet_x1_0  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_classification.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html","title":"\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#1","title":"1. \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u4e00\u5f20\u200b\u56fe\u50cf\u200b\u540c\u65f6\u200b\u5206\u914d\u200b\u5230\u200b\u591a\u4e2a\u200b\u76f8\u5173\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u3001\u200b\u5185\u5bb9\u200b\u63a8\u8350\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b58\u5728\u200b\u7684\u200b\u591a\u4e2a\u200b\u7269\u4f53\u200b\u6216\u200b\u7279\u5f81\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u4e2d\u200b\u540c\u65f6\u200b\u5305\u542b\u200b\u201c\u200b\u72d7\u200b\u201d\u200b\u548c\u200b\u201c\u200b\u6237\u5916\u200b\u201d\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u6807\u7b7e\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u66f4\u52a0\u200b\u5168\u9762\u200b\u7684\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u641c\u7d22\u5f15\u64ce\u200b\u548c\u200b\u81ea\u52a8\u200b\u5185\u5bb9\u200b\u751f\u6210\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u200b\u5177\u6709\u200b\u91cd\u8981\u200b\u610f\u4e49\u200b\u3002

\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) CLIP_vit_base_patch16_448_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.15 - PP-HGNetV2-B0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 80.98 39.6 PP-HGNetV2-B4_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.96 88.5 PP-HGNetV2-B6_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.25 286.5 PP-LCNet_x1_0_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.96 29.4 ResNet50_ML\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 83.50 108.9

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u652f\u6301\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline multi_label_image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b \u200b\u547d\u4ee4\u200b\u884c\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config multi_label_image_classification\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config multi_label_image_classification --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./multi_label_image_classification.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./multi_label_image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [21, 0, 30, 24], 'scores': [0.99257, 0.70596, 0.63001, 0.57852], 'label_names': ['bear', 'person', 'skis', 'backpack']}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"multi_label_image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/multi_label_image_classification.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/multi_label_image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002

POST /multilabel-image-classification

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b topK integer \u200b\u7ed3\u679c\u200b\u4e2d\u5c06\u200b\u53ea\u200b\u4fdd\u7559\u200b\u5f97\u5206\u200b\u6700\u9ad8\u200b\u7684\u200btopK\u200b\u4e2a\u200b\u7c7b\u522b\u200b\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b categories array \u200b\u56fe\u50cf\u200b\u7c7b\u522b\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

categories\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b id integer \u200b\u7c7b\u522b\u200bID\u3002 name string \u200b\u7c7b\u522b\u200b\u540d\u79f0\u200b\u3002 score number \u200b\u7c7b\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"\u200b\u5154\u5b50\u200b\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/multilabel-image-classification\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/multilabel-image-classification\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/multilabel-image-classification\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/multilabel-image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/multilabel-image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/multilabel-image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/multilabel-image-classification\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  model: PP-LCNet_x1_0_ML   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline multi_label_image_classification --input general_image_classification_001.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline multi_label_image_classification --input general_image_classification_001.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html","title":"\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#1","title":"1. \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5b83\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u533a\u5206\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u4e0d\u540c\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u7684\u200b\u7cbe\u786e\u200b\u5206\u5272\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5728\u200b\u540c\u4e00\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5206\u522b\u200b\u6807\u8bb0\u200b\u51fa\u200b\u6bcf\u200b\u4e00\u8f86\u8f66\u200b\u3001\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u4eba\u200b\u6216\u200b\u6bcf\u200b\u4e00\u53ea\u200b\u52a8\u7269\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5b83\u4eec\u200b\u5728\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u4e0a\u200b\u88ab\u200b\u72ec\u7acb\u200b\u5904\u7406\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u5305\u542b\u200b\u591a\u8f86\u200b\u8f66\u200b\u548c\u200b\u884c\u4eba\u200b\u7684\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u80fd\u591f\u200b\u5c06\u200b\u6bcf\u8f86\u8f66\u200b\u548c\u200b\u6bcf\u4e2a\u200b\u4eba\u200b\u7684\u200b\u8f6e\u5ed3\u200b\u6e05\u6670\u200b\u5730\u200b\u5206\u5f00\u200b\uff0c\u200b\u5f62\u6210\u200b\u591a\u4e2a\u200b\u72ec\u7acb\u200b\u7684\u200b\u533a\u57df\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u548c\u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bMask R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6765\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u7684\u200b\u50cf\u7d20\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u533a\u5206\u200b\uff0c\u200b\u4e3a\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u7684\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u652f\u6301\u200b\u3002

\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b15\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b Cascade-MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.3 - - 254.8 M Cascade-MaskRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bMask RCNN\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u7ea7\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIOU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u68c0\u6d4b\u200b\u4e0e\u200b\u63a8\u7406\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 - - 254.7 M Mask-RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.6 132.693 4896.17 449.9 M Mask-RT-DETR \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bRT-DETR\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200b\u6700\u4f18\u6027\u200b\u80fd\u200b\u7684\u200b\u66f4\u597d\u200b\u7684\u200bPP-HGNetV2\u200b\u4f5c\u4e3a\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200b\uff0c\u200b\u6784\u5efa\u200b\u4e86\u200bMaskHybridEncoder\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u5f15\u5165\u200b\u4e86\u200bIOU-aware Query Selection \u200b\u6280\u672f\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u5728\u200b\u76f8\u540c\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u4e86\u200bSOTA\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7cbe\u5ea6\u200b\u3002 Mask-RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 36.8329 - 66.6 M Mask-RT-DETR-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.0 33.5007 - 51.8 M Mask-RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.6 - - 157.5 M Mask R-CNN\u200b\u662f\u200b\u7531\u200b\u534e\u76db\u987f\u200b\u9996\u4f8b\u200b\u5373\u73b0\u200b\u6295\u5f71\u200b\u5361\u200b\u7684\u200b\u4e00\u4e2a\u200b\u5168\u200b\u4efb\u52a1\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u6a21\u578b\u200b\u4e2d\u200b\u5b8c\u6210\u200b\u56fe\u7247\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9a\u4f4d\u200b\uff0c\u200b\u5e76\u200b\u7ed3\u5408\u200b\u56fe\u50cf\u200b\u7ea7\u200b\u7684\u200b\u906e\u7f69\u200b\uff08Mask\uff09\u200b\u6765\u200b\u5b8c\u6210\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u3002 MaskRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.4 - - 157.5 M MaskRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.8 - - 128.7 M MaskRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 370.0 M PP-YOLOE_seg-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.5 - - 31.5 M PP-YOLOE_seg \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u6cbf\u7528\u200b\u4e86\u200bPP-YOLOE\u200b\u7684\u200bbackbone\u200b\u548c\u200bhead\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bPP-YOLOE\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u5934\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7684\u200b\u6027\u80fd\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SOLOv2\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 35.5 - - 179.1 M SOLOv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u6309\u200b\u4f4d\u7f6e\u200b\u5206\u5272\u200b\u7269\u4f53\u200b\u7684\u200b\u5b9e\u65f6\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7b97\u6cd5\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u662f\u200bSOLO\u200b\u7684\u200b\u6539\u8fdb\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u63a9\u7801\u200b\u5b66\u4e60\u200b\u548c\u200b\u63a9\u7801\u200bNMS\uff0c\u200b\u5b9e\u73b0\u200b\u4e86\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u901f\u5ea6\u200b\u4e0a\u200b\u53d6\u5f97\u200b\u826f\u597d\u200b\u5e73\u8861\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200b PaddleX \u200b\u7684\u200b wheel \u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config instance_segmentation\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config instance_segmentation --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./instance_segmentation.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./instance_segmentation.yaml --input general_instance_segmentation_004.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_instance_segmentation_004.png', 'boxes': [{'cls_id': 0, 'label': 'person', 'score': 0.8698326945304871, 'coordinate': [339, 0, 639, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8571141362190247, 'coordinate': [0, 0, 195, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8202633857727051, 'coordinate': [88, 113, 401, 574]}, {'cls_id': 0, 'label': 'person', 'score': 0.7108577489852905, 'coordinate': [522, 21, 767, 574]}, {'cls_id': 27, 'label': 'tie', 'score': 0.554280698299408, 'coordinate': [247, 311, 355, 574]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"instance_segmentation\")\n\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/instance_segmentation.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/instance_segmentation.yaml\")\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u3002

POST /instance-segmentation

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b instances array \u200b\u5b9e\u4f8b\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u7c7b\u522b\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

instances\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u5b9e\u4f8b\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 categoryId integer \u200b\u5b9e\u4f8b\u200b\u7c7b\u522b\u200bID\u3002 score number \u200b\u5b9e\u4f8b\u200b\u5f97\u5206\u200b\u3002 mask object \u200b\u5b9e\u4f8b\u200b\u7684\u200b\u5206\u5272\u200b\u63a9\u819c\u200b\u3002

mask\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b rleResult str \u200b\u63a9\u819c\u200b\u7684\u200b\u6e38\u7a0b\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 size array \u200b\u63a9\u819c\u200b\u7684\u200b\u5f62\u72b6\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u63a9\u819c\u200b\u7684\u200b\u9ad8\u5ea6\u200b\u548c\u200b\u5bbd\u5ea6\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"instances\": [\n{\n\"bbox\": [\n162.39381408691406,\n83.88176727294922,\n624.0797119140625,\n343.4986877441406\n],\n\"categoryId\": 33,\n\"score\": 0.8691174983978271,\n\"mask\": {\n\"rleResult\": \"xxxxxx\",\n\"size\": [\n259,\n462\n]\n}\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/instance-segmentation\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nInstances:\")\nprint(result[\"instances\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/instance-segmentation\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto instances = result[\"instances\"];\n        std::cout << \"\\nInstances:\" << std::endl;\n        for (const auto& inst : instances) {\n            std::cout << inst << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/instance-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode instances = result.get(\"instances\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nInstances: \" + instances.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/instance-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Instances []map[string]interface{} `json:\"instances\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nInstances:\")\n    for _, inst := range respData.Result.Instances {\n        fmt.Println(inst)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/instance-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nInstances:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"instances\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/instance-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nInstances:\");\n    console.log(result[\"instances\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/instance-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nInstances:\\n\";\nprint_r($result[\"instances\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: Mask-RT-DETR-S  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html","title":"\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#1","title":"1. \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002

\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b6\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b37\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b Cascade-FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.1 - - 245.4 M Cascade-FasterRCNN \u200b\u662f\u200b\u4e00\u79cd\u200b\u6539\u8fdb\u200b\u7684\u200bFaster R-CNN\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8026\u8054\u200b\u591a\u4e2a\u200b\u68c0\u6d4b\u5668\u200b\uff0c\u200b\u5229\u7528\u200b\u4e0d\u540c\u200bIoU\u200b\u9608\u503c\u200b\u4f18\u5316\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u89e3\u51b3\u200b\u8bad\u7ec3\u200b\u548c\u200b\u9884\u6d4b\u200b\u9636\u6bb5\u200b\u7684\u200bmismatch\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7684\u200b\u51c6\u786e\u6027\u200b\u3002 Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 45.0 - - 246.2 M CenterNet-DLA-34\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.6 - - 75.4 M CenterNet\u200b\u662f\u200b\u4e00\u79cd\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u628a\u200b\u5f85\u200b\u68c0\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u5173\u952e\u70b9\u200b\u89c6\u4e3a\u200b\u5355\u200b\u4e00\u70b9\u200b-\u200b\u5373\u200b\u5176\u200b\u8fb9\u754c\u200b\u6846\u200b\u7684\u200b\u4e2d\u5fc3\u70b9\u200b\uff0c\u200b\u5e76\u200b\u901a\u8fc7\u200b\u5173\u952e\u70b9\u200b\u8fdb\u884c\u200b\u56de\u5f52\u200b\u3002 CenterNet-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.9 - - 319.7 M DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.3 59.2132 5334.52 159.3 M DETR \u200b\u662f\u200bFacebook\u200b\u63d0\u51fa\u200b\u7684\u200b\u4e00\u79cd\u200btransformer\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u578b\u200b\u5728\u200b\u4e0d\u200b\u9700\u8981\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7684\u200b\u5148\u9a8c\u200b\u6846\u200banchor\u200b\u548c\u200bNMS\u200b\u7684\u200b\u540e\u5904\u7406\u200b\u7b56\u7565\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u5c31\u200b\u53ef\u4ee5\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002 FasterRCNN-ResNet34-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.8 - - 137.5 M Faster R-CNN\u200b\u662f\u200b\u5178\u578b\u200b\u7684\u200btwo-stage\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5373\u200b\u5148\u751f\u200b\u6210\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff08Region Proposal\uff09\uff0c\u200b\u7136\u540e\u200b\u5728\u200b\u751f\u6210\u200b\u7684\u200bRegion Proposal\u200b\u4e0a\u200b\u505a\u200b\u5206\u7c7b\u200b\u548c\u200b\u56de\u5f52\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200b\u524d\u4ee3\u200bR-CNN\u200b\u548c\u200bFast R-CNN\uff0cFaster R-CNN\u200b\u7684\u200b\u6539\u8fdb\u200b\u4e3b\u8981\u200b\u5728\u4e8e\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u65b9\u9762\u200b\uff0c\u200b\u4f7f\u7528\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7f51\u7edc\u200b\uff08Region Proposal Network, RPN\uff09\u200b\u63d0\u4f9b\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\uff0c\u200b\u4ee5\u200b\u53d6\u4ee3\u200b\u4f20\u7edf\u200b\u9009\u62e9\u6027\u200b\u641c\u7d22\u200b\u3002RPN\u200b\u662f\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5e76\u200b\u4e0e\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u5171\u4eab\u200b\u56fe\u50cf\u200b\u7684\u200b\u5377\u79ef\u200b\u7279\u5f81\u200b\uff0c\u200b\u51cf\u5c11\u200b\u4e86\u200b\u533a\u57df\u200b\u5efa\u8bae\u200b\u7684\u200b\u8ba1\u7b97\u200b\u5f00\u9500\u200b\u3002 FasterRCNN-ResNet50-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 148.1 M FasterRCNN-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 36.7 - - 120.2 M FasterRCNN-ResNet101-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 41.4 - - 216.3 M FasterRCNN-ResNet101\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 - - 159.8 M FCOS-ResNet50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.6 103.367 3424.91 124.2 M FCOS\u200b\u662f\u200b\u4e00\u79cd\u200b\u5bc6\u96c6\u200b\u9884\u6d4b\u200b\u7684\u200banchor-free\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u4f7f\u7528\u200bRetinaNet\u200b\u7684\u200b\u9aa8\u67b6\u200b\uff0c\u200b\u76f4\u63a5\u200b\u5728\u200bfeature map\u200b\u4e0a\u200b\u56de\u5f52\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u957f\u5bbd\u200b\uff0c\u200b\u5e76\u200b\u9884\u6d4b\u200b\u7269\u4f53\u200b\u7684\u200b\u7c7b\u522b\u200b\u4ee5\u53ca\u200bcenterness\uff08feature map\u200b\u4e0a\u200b\u50cf\u7d20\u70b9\u200b\u79bb\u200b\u7269\u4f53\u200b\u4e2d\u5fc3\u200b\u7684\u200b\u504f\u79fb\u200b\u7a0b\u5ea6\u200b\uff09\uff0ccenterness\u200b\u6700\u7ec8\u200b\u4f1a\u200b\u4f5c\u4e3a\u200b\u6743\u91cd\u200b\u6765\u200b\u8c03\u6574\u200b\u7269\u4f53\u200b\u5f97\u5206\u200b\u3002 PicoDet-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.6 16.6715 169.904 20.9 M PP-PicoDet\u200b\u662f\u200b\u4e00\u79cd\u200b\u5168\u200b\u5c3a\u5bf8\u200b\u3001\u200b\u68f1\u89c6\u200b\u5bbd\u200b\u76ee\u6807\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u5b83\u200b\u8003\u8651\u200b\u79fb\u52a8\u200b\u7aef\u200b\u8bbe\u5907\u200b\u8fd0\u7b97\u91cf\u200b\u3002\u200b\u4e0e\u200b\u4f20\u7edf\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7b97\u6cd5\u200b\u76f8\u6bd4\u200b\uff0cPP-PicoDet\u200b\u5177\u6709\u200b\u66f4\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u5c3a\u5bf8\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u8ba1\u7b97\u200b\u590d\u6742\u5ea6\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u4fdd\u8bc1\u200b\u68c0\u6d4b\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u540c\u65f6\u200b\u66f4\u200b\u9ad8\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u66f4\u200b\u4f4e\u200b\u7684\u200b\u5ef6\u8fdf\u200b\u3002 PicoDet-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 37.5 16.2311 71.7257 16.8 M PicoDet-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 29.1 14.097 37.6563 4.4 M PicoDet-XS\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus \u200b\u662f\u200b\u4e00\u79cd\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u4e91\u8fb9\u200b\u4e00\u4f53\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200bPP-YOLOE\u200b\u8fed\u4ee3\u200b\u4f18\u5316\u200b\u5347\u7ea7\u200b\u7684\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200bObjects365\u200b\u5927\u89c4\u6a21\u200b\u6570\u636e\u200b\u96c6\u200b\u3001\u200b\u4f18\u5316\u200b\u9884\u5904\u7406\u200b\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 PP-YOLOE_plus-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.7 57.8995 1439.93 349.4 M RT-DETR-H\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 56.3 114.814 3933.39 435.8 M RT-DETR\u200b\u662f\u200b\u7b2c\u4e00\u4e2a\u200b\u5b9e\u65f6\u200b\u7aef\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u8bbe\u8ba1\u200b\u4e86\u200b\u4e00\u4e2a\u200b\u9ad8\u6548\u200b\u7684\u200b\u6df7\u5408\u200b\u7f16\u7801\u5668\u200b\uff0c\u200b\u6ee1\u8db3\u200b\u6a21\u578b\u200b\u6548\u679c\u200b\u4e0e\u200b\u541e\u5410\u200b\u7387\u200b\u7684\u200b\u53cc\u200b\u9700\u6c42\u200b\uff0c\u200b\u9ad8\u6548\u200b\u5904\u7406\u200b\u591a\u200b\u5c3a\u5ea6\u200b\u7279\u5f81\u200b\uff0c\u200b\u5e76\u200b\u63d0\u51fa\u200b\u4e86\u200b\u52a0\u901f\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u67e5\u8be2\u200b\u9009\u62e9\u200b\u673a\u5236\u200b\uff0c\u200b\u4ee5\u200b\u4f18\u5316\u200b\u89e3\u7801\u5668\u200b\u67e5\u8be2\u200b\u7684\u200b\u52a8\u6001\u5316\u200b\u3002RT-DETR\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u89e3\u7801\u5668\u200b\u6765\u200b\u5b9e\u73b0\u200b\u7075\u6d3b\u200b\u7aef\u5230\u200b\u7aef\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 RT-DETR-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.0 34.5252 1454.27 113.7 M RT-DETR-R18\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.5 19.89 784.824 70.7 M RT-DETR-R50\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 53.1 41.9327 1625.95 149.1 M RT-DETR-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 39.1 40.1055 883.041 219.7 M YOLOv3\u200b\u662f\u200b\u4e00\u79cd\u200b\u5b9e\u65f6\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u5668\u200b\u3002\u200b\u5b83\u200b\u4f7f\u7528\u200b\u4e00\u4e2a\u200b\u72ec\u7279\u200b\u7684\u200b\u5355\u4e2a\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c06\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u95ee\u9898\u200b\u5206\u89e3\u200b\u4e3a\u200b\u4e00\u4e2a\u200b\u56de\u5f52\u200b\u95ee\u9898\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5b9e\u65f6\u200b\u7684\u200b\u68c0\u6d4b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u91c7\u7528\u200b\u4e86\u200b\u591a\u4e2a\u200b\u5c3a\u5ea6\u200b\u7684\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u4e86\u200b\u4e0d\u540c\u200b\u5c3a\u5ea6\u200b\u76ee\u6807\u200b\u7269\u4f53\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOv3-MobileNetV3\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCN\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.6 31.6276 856.047 163.0 M YOLOX-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 50.1 185.691 1250.58 192.5 M YOLOX\u200b\u6a21\u578b\u200b\u4ee5\u200bYOLOv3\u200b\u4f5c\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7f51\u7edc\u200b\u7684\u200b\u6846\u67b6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u8bbe\u8ba1\u200bDecoupled Head\u3001Data Aug\u3001Anchor Free\u200b\u4ee5\u53ca\u200bSimOTA\u200b\u7ec4\u4ef6\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u5404\u79cd\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u68c0\u6d4b\u200b\u6027\u80fd\u200b\u3002 YOLOX-M\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 46.9 123.324 688.071 90.0 M YOLOX-N\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 26.1 79.1665 155.59 3.4 M YOLOX-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 40.4 184.828 474.446 32.0 M YOLOX-T\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 32.9 102.748 212.52 18.1 M YOLOX-X\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 51.8 227.361 2067.84 351.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config object_detection\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config object_detection --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./object_detection.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./object_detection.yaml --input general_object_detection_002.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_object_detection_002.png', 'boxes': [{'cls_id': 49, 'label': 'orange', 'score': 0.8188097476959229, 'coordinate': [661, 93, 870, 305]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7743489146232605, 'coordinate': [76, 274, 330, 520]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7270504236221313, 'coordinate': [285, 94, 469, 297]}, {'cls_id': 46, 'label': 'banana', 'score': 0.5570532083511353, 'coordinate': [310, 361, 685, 712]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5484835505485535, 'coordinate': [764, 285, 924, 440]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5160726308822632, 'coordinate': [853, 169, 987, 303]}, {'cls_id': 60, 'label': 'dining table', 'score': 0.5142655968666077, 'coordinate': [0, 0, 1072, 720]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5101479291915894, 'coordinate': [57, 23, 213, 176]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"object_detection\")\n\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu enable_hpi \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/object_detection.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/object_detection.yaml\")\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002

POST /object-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b detectedObjects array \u200b\u76ee\u6807\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u7c7b\u522b\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

detectedObjects\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u76ee\u6807\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 categoryId integer \u200b\u76ee\u6807\u200b\u7c7b\u522b\u200bID\u3002 score number \u200b\u76ee\u6807\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/object-detection\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/object-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/object-detection\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/object-detection\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PicoDet-S  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/object_detection.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline object_detection --input general_object_detection_002.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html","title":"\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#1","title":"1. \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u529f\u80fd\u200b\uff0c\u200b\u7528\u4e8e\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u6807\u8bb0\u200b\u884c\u4eba\u200b\u7684\u200b\u7279\u5b9a\u200b\u7279\u5f81\u200b\uff0c\u200b\u5982\u200b\u6027\u522b\u200b\u3001\u200b\u5e74\u9f84\u200b\u3001\u200b\u8863\u7269\u200b\u989c\u8272\u200b\u548c\u200b\u6b3e\u5f0f\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u4efb\u52a1\u200b\u4e0d\u4ec5\u200b\u8981\u6c42\u200b\u51c6\u786e\u200b\u68c0\u6d4b\u200b\u51fa\u884c\u200b\u4eba\u200b\uff0c\u200b\u8fd8\u200b\u9700\u200b\u8bc6\u522b\u200b\u6bcf\u4e2a\u200b\u884c\u4eba\u200b\u7684\u200b\u8be6\u7ec6\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\u3002\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u8bc6\u522b\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u667a\u6167\u200b\u57ce\u5e02\u200b\u548c\u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u53ef\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u7cfb\u7edf\u200b\u7684\u200b\u667a\u80fd\u5316\u200b\u6c34\u5e73\u200b\u548c\u200b\u7ba1\u7406\u6548\u7387\u200b\u3002

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5:0.95) mAP(0.5) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-L_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 48.0 81.9 32.8 777.7 196.02 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-S_human\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.5 77.9 15.0 179.3 28.79

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCrowdHuman\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_pedestrian_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b26\u200b\u4e2a\u200b\u7c7b\u522b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b mA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config pedestrian_attribute_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config pedestrian_attribute_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./pedestrian_attribute_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./pedestrian_attribute_recognition.yaml --input pedestrian_attribute_002.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"pedestrian_attribute_recognition\")\n\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/pedestrian_attribute_recognition*.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/pedestrian_attribute_recognition.yaml\")\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /pedestrian-attribute-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b pedestrians array \u200b\u884c\u4eba\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u53ca\u200b\u5c5e\u6027\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

pedestrians\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u884c\u4eba\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 attributes array \u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u3002 score number \u200b\u68c0\u6d4b\u200b\u5f97\u5206\u200b\u3002

attributes\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u5c5e\u6027\u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u5206\u7c7b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/pedestrian-attribute-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected pedestrians:\")\nprint(result[\"pedestrians\"])\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u548c\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4e3b\u4f53\u200b\u76ee\u6807\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\u7684\u200b\u4e3b\u4f53\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  det_model: PP-YOLOE-L_human\n  cls_model: PP-LCNet_x1_0_pedestrian_attribute  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u884c\u4eba\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html","title":"\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#1","title":"1. \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bSegFormer\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6216\u200b\u89c6\u89c9\u200b\u53d8\u6362\u5668\u200b\uff08Transformer\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002

\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 \u200b\u4ee5\u4e0a\u200b\u5217\u51fa\u200b\u7684\u200b\u662f\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u91cd\u70b9\u200b\u652f\u6301\u200b\u7684\u200b2\u200b\u4e2a\u200b\u6838\u5fc3\u200b\u6a21\u578b\u200b\uff0c\u200b\u8be5\u200b\u6a21\u5757\u200b\u603b\u5171\u200b\u652f\u6301\u200b18\u200b\u4e2a\u200b\u6a21\u578b\u200b\uff0c\u200b\u5b8c\u6574\u200b\u7684\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b \u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

\u200b\u4ee5\u4e0a\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200bModel Download Link mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

SeaFormer\u200b\u7cfb\u5217\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bADE20k\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config semantic_segmentation\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./semantic_segmentation.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./semantic_segmentation.yaml --input makassaridn-road_demo.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_object_detection_002.png'}\n
\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"semantic_segmentation\")\n\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu enable_hpi \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/semantic_segmentation.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3002

POST /semantic-segmentation

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b labelMap array \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u3002 size array \u200b\u56fe\u50cf\u200b\u5f62\u72b6\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u56fe\u50cf\u200b\u7684\u200b\u9ad8\u5ea6\u200b\u548c\u200b\u5bbd\u5ea6\u200b\u3002 image string \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"labelMap\": [\n0,\n0,\n1,\n2\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/semantic-segmentation\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n# result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/semantic-segmentation\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n            // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/semantic-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/semantic-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/semantic-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/semantic-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    // result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/semantic-segmentation\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n// result.labelMap \u200b\u8bb0\u5f55\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u7684\u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\uff08\u200b\u6309\u7167\u200b\u884c\u200b\u4f18\u5148\u200b\u987a\u5e8f\u6392\u5217\u200b\uff09\u200b\u8be6\u89c1\u200bAPI\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff08github\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u94fe\u63a5\u200b\u6807\u9898\u200b\uff09\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PP-LiteSeg-T  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#_2","title":"\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline semantic_segmentation --input semantic_segmentation/makassaridn-road_demo.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline semantic_segmentation --input semantic_segmentation/makassaridn-road_demo.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#1","title":"1. \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u4e13\u95e8\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u4f53\u79ef\u200b\u8f83\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u76d1\u63a7\u200b\u3001\u200b\u65e0\u4eba\u9a7e\u9a76\u200b\u548c\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u4ece\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e2d\u200b\u51c6\u786e\u200b\u627e\u5230\u200b\u5e76\u200b\u5206\u7c7b\u200b\u50cf\u200b\u884c\u4eba\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u6216\u200b\u5c0f\u200b\u52a8\u7269\u200b\u7b49\u200b\u5c0f\u200b\u5c3a\u5bf8\u200b\u7269\u4f53\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u63d0\u5347\u200b\u5bf9\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5728\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4e2d\u200b\u4e0d\u200b\u9057\u6f0f\u200b\u91cd\u8981\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u63d0\u9ad8\u200b\u5b89\u5168\u6027\u200b\u548c\u200b\u81ea\u52a8\u5316\u200b\u6c34\u5e73\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002

\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) PP-YOLOE_plus_SOD-S\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-largesize-L\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 42.7 458.521 11172.7 340.5 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u652f\u6301\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline small_object_detection --input small_object_detection.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config small_object_detection\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config small_object_detection --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./small_object_detection.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./small_object_detection.yaml --input small_object_detection.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'small_object_detection.jpg', 'boxes': [{'cls_id': 3, 'label': 'car', 'score': 0.9243856072425842, 'coordinate': [624, 638, 682, 741]}, {'cls_id': 3, 'label': 'car', 'score': 0.9206348061561584, 'coordinate': [242, 561, 356, 613]}, {'cls_id': 3, 'label': 'car', 'score': 0.9194547533988953, 'coordinate': [670, 367, 705, 400]}, {'cls_id': 3, 'label': 'car', 'score': 0.9162291288375854, 'coordinate': [459, 259, 523, 283]}, {'cls_id': 4, 'label': 'van', 'score': 0.9075379371643066, 'coordinate': [467, 213, 498, 242]}, {'cls_id': 4, 'label': 'van', 'score': 0.9066920876502991, 'coordinate': [547, 351, 577, 397]}, {'cls_id': 3, 'label': 'car', 'score': 0.9041045308113098, 'coordinate': [502, 632, 562, 736]}, {'cls_id': 3, 'label': 'car', 'score': 0.8934890627861023, 'coordinate': [613, 383, 647, 427]}, {'cls_id': 3, 'label': 'car', 'score': 0.8803309202194214, 'coordinate': [640, 280, 671, 309]}, {'cls_id': 3, 'label': 'car', 'score': 0.8727016448974609, 'coordinate': [1199, 256, 1259, 281]}, {'cls_id': 3, 'label': 'car', 'score': 0.8705748915672302, 'coordinate': [534, 410, 570, 461]}, {'cls_id': 3, 'label': 'car', 'score': 0.8654043078422546, 'coordinate': [669, 248, 702, 271]}, {'cls_id': 3, 'label': 'car', 'score': 0.8555219769477844, 'coordinate': [525, 243, 550, 270]}, {'cls_id': 3, 'label': 'car', 'score': 0.8522038459777832, 'coordinate': [526, 220, 553, 243]}, {'cls_id': 3, 'label': 'car', 'score': 0.8392605185508728, 'coordinate': [557, 141, 575, 158]}, {'cls_id': 3, 'label': 'car', 'score': 0.8353804349899292, 'coordinate': [537, 120, 553, 133]}, {'cls_id': 3, 'label': 'car', 'score': 0.8322211503982544, 'coordinate': [585, 132, 603, 147]}, {'cls_id': 3, 'label': 'car', 'score': 0.8298957943916321, 'coordinate': [701, 283, 736, 313]}, {'cls_id': 3, 'label': 'car', 'score': 0.8217393159866333, 'coordinate': [885, 347, 943, 377]}, {'cls_id': 3, 'label': 'car', 'score': 0.820313572883606, 'coordinate': [493, 150, 511, 168]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.8183429837226868, 'coordinate': [203, 701, 224, 743]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.815082848072052, 'coordinate': [185, 710, 201, 744]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7892289757728577, 'coordinate': [311, 371, 344, 407]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7812919020652771, 'coordinate': [345, 380, 388, 405]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7748346328735352, 'coordinate': [295, 500, 309, 532]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7688500285148621, 'coordinate': [851, 436, 863, 466]}, {'cls_id': 3, 'label': 'car', 'score': 0.7466475367546082, 'coordinate': [565, 114, 580, 128]}, {'cls_id': 3, 'label': 'car', 'score': 0.7156463265419006, 'coordinate': [483, 66, 495, 78]}, {'cls_id': 3, 'label': 'car', 'score': 0.704211950302124, 'coordinate': [607, 138, 642, 152]}, {'cls_id': 3, 'label': 'car', 'score': 0.7021926045417786, 'coordinate': [505, 72, 518, 83]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6897469162940979, 'coordinate': [802, 460, 815, 488]}, {'cls_id': 3, 'label': 'car', 'score': 0.671891450881958, 'coordinate': [574, 123, 593, 136]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.6712754368782043, 'coordinate': [445, 317, 472, 334]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6695684790611267, 'coordinate': [479, 309, 489, 332]}, {'cls_id': 3, 'label': 'car', 'score': 0.6273623704910278, 'coordinate': [654, 210, 677, 234]}, {'cls_id': 3, 'label': 'car', 'score': 0.6070230603218079, 'coordinate': [640, 166, 667, 185]}, {'cls_id': 3, 'label': 'car', 'score': 0.6064521670341492, 'coordinate': [461, 59, 476, 71]}, {'cls_id': 3, 'label': 'car', 'score': 0.5860581398010254, 'coordinate': [464, 87, 484, 100]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.5792551636695862, 'coordinate': [390, 390, 419, 408]}, {'cls_id': 3, 'label': 'car', 'score': 0.5559225678443909, 'coordinate': [481, 125, 496, 140]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5531904697418213, 'coordinate': [869, 306, 880, 331]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5468509793281555, 'coordinate': [895, 294, 904, 319]}, {'cls_id': 3, 'label': 'car', 'score': 0.5451828241348267, 'coordinate': [505, 94, 518, 108]}, {'cls_id': 3, 'label': 'car', 'score': 0.5398445725440979, 'coordinate': [657, 188, 681, 208]}, {'cls_id': 4, 'label': 'van', 'score': 0.5318890810012817, 'coordinate': [518, 88, 534, 102]}, {'cls_id': 3, 'label': 'car', 'score': 0.5296525359153748, 'coordinate': [527, 71, 540, 81]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.5168400406837463, 'coordinate': [528, 320, 563, 346]}, {'cls_id': 3, 'label': 'car', 'score': 0.5088561177253723, 'coordinate': [511, 84, 530, 95]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.502006471157074, 'coordinate': [841, 266, 850, 283]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"small_object_detection\")\n\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/small_object_detection.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/small_object_detection.yaml\")\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3002

POST /small-object-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b detectedObjects array \u200b\u76ee\u6807\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u7c7b\u522b\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

detectedObjects\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u76ee\u6807\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 categoryId integer \u200b\u76ee\u6807\u200b\u7c7b\u522b\u200bID\u3002 score number \u200b\u76ee\u6807\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/small-object-detection\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/small-object-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& category : detectedObjects) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/small-object-detection\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/small-object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, category := range respData.Result.DetectedObjects {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/small-object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/small-object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/small-object-detection\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: PP-YOLOE_plus_SOD-L  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#_2","title":"\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html","title":"\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#1","title":"1. \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u91cd\u8981\u200b\u7ec4\u6210\u90e8\u5206\u200b\uff0c\u200b\u5176\u200b\u4e3b\u8981\u200b\u4efb\u52a1\u200b\u662f\u200b\u5728\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u6807\u8bb0\u200b\u51fa\u200b\u8f66\u8f86\u200b\u7684\u200b\u7279\u5b9a\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5982\u200b\u8f66\u8f86\u200b\u7c7b\u578b\u200b\u3001\u200b\u989c\u8272\u200b\u3001\u200b\u8f66\u724c\u53f7\u200b\u7b49\u200b\u3002\u200b\u8be5\u200b\u4efb\u52a1\u200b\u4e0d\u4ec5\u200b\u8981\u6c42\u200b\u51c6\u786e\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u8f66\u8f86\u200b\uff0c\u200b\u8fd8\u200b\u9700\u200b\u8bc6\u522b\u200b\u6bcf\u8f86\u8f66\u200b\u7684\u200b\u8be6\u7ec6\u200b\u5c5e\u6027\u200b\u4fe1\u606f\u200b\u3002\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u8bc6\u522b\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u7684\u200b\u7aef\u200b\u5230\u200b\u7aef\u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u4ea4\u901a\u7ba1\u7406\u200b\u3001\u200b\u667a\u80fd\u200b\u505c\u8f66\u200b\u3001\u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u3001\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u7cfb\u7edf\u200b\u6548\u7387\u200b\u548c\u200b\u667a\u80fd\u5316\u200b\u6c34\u5e73\u200b\uff0c\u200b\u5e76\u200b\u63a8\u52a8\u200b\u4e86\u200b\u76f8\u5173\u200b\u884c\u4e1a\u200b\u7684\u200b\u53d1\u5c55\u200b\u4e0e\u200b\u521b\u65b0\u200b\u3002

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP 0.5:0.95 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-YOLOE-S_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 61.3 15.4 178.4 28.79 \u200b\u57fa\u4e8e\u200bPP-YOLOE\u200b\u7684\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PP-YOLOE-L_vehicle\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.9 32.6 775.6 196.02

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bPPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_vehicle_attribute\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute \u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bPP-LCNet\u200b\u7684\u200b\u8f7b\u91cf\u7ea7\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VeRi \u200b\u6570\u636e\u200b\u96c6\u200bmA\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config vehicle_attribute_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config vehicle_attribute_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./vehicle_attribute_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./vehicle_attribute_recognition.yaml --input vehicle_attribute_002.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"vehicle_attribute_recognition\")\n\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/vehicle_attribute_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/vehicle_attribute_recognition.yaml\")\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /vehicle-attribute-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b vehicles array \u200b\u8f66\u8f86\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u53ca\u200b\u5c5e\u6027\u200b\u7b49\u200b\u4fe1\u606f\u200b\u3002 image string \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

vehicles\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u8f66\u8f86\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 attributes array \u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u3002 score number \u200b\u68c0\u6d4b\u200b\u5f97\u5206\u200b\u3002

attributes\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u5c5e\u6027\u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u5206\u7c7b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/vehicle-attribute-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected vehicles:\")\nprint(result[\"vehicles\"])\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u548c\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u4e3b\u4f53\u200b\u76ee\u6807\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\u7684\u200b\u4e3b\u4f53\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  det_model: PP-YOLOE-L_vehicle\n  cls_model: PP-LCNet_x1_0_vehicle_attribute  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html","title":"\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#1-v3","title":"1. \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u6587\u6863\u200b\u548c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u8bc6\u522b\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002

\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M SLANet_plus \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bSLANet\u200b\u7684\u200b\u589e\u5f3a\u7248\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200bSLANet\uff0cSLANet_plus \u200b\u5bf9\u200b\u65e0\u7ebf\u200b\u8868\u200b\u3001\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\u5f97\u5230\u200b\u4e86\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\uff0c\u200b\u5e76\u200b\u964d\u4f4e\u200b\u4e86\u200b\u6a21\u578b\u200b\u5bf9\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51c6\u786e\u6027\u200b\u7684\u200b\u654f\u611f\u5ea6\u200b\uff0c\u200b\u5373\u4f7f\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51fa\u73b0\u200b\u504f\u79fb\u200b\uff0c\u200b\u4e5f\u200b\u80fd\u591f\u200b\u8f83\u200b\u51c6\u786e\u200b\u5730\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MS-SSIM \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b UVDoc\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.40 30.3 M \u200b\u9ad8\u7cbe\u5ea6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u578b\u200b

\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b DocUNet benchmark\u3002

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_doc_ori\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 99.06 3.84845 9.23735 7 \u200b\u57fa\u4e8e\u200bPP-LCNet_x1_0\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u542b\u6709\u200b\u56db\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5373\u200b0\u200b\u5ea6\u200b\uff0c90\u200b\u5ea6\u200b\uff0c180\u200b\u5ea6\u200b\uff0c270\u200b\u5ea6\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8bc1\u4ef6\u200b\u548c\u200b\u6587\u6863\u200b\u7b49\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5305\u542b\u200b 1000 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
\u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u4ec5\u200b\u652f\u6301\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\u6216\u8005\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\u200b\u4e0a\u200b\u83b7\u53d6\u200b\u76f8\u5173\u200b\u7684\u200b ak/sk(access_token)\u3002\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bAK\u200b\u548c\u200bSK\u200b\u9274\u6743\u200b\u8c03\u7528\u200bAPI\u200b\u6d41\u7a0b\u200b \u200b\u83b7\u53d6\u200bak/sk\uff0c\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio \u200b\u8bbf\u95ee\u200b\u4ee4\u724c\u200b\u4e2d\u200b\u83b7\u53d6\u200b access_token\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

{'chat_res': {'\u200b\u4e59\u65b9\u200b': '\u200b\u80a1\u4efd\u200b\u6d4b\u8bd5\u200b\u6709\u9650\u516c\u53f8\u200b', '\u200b\u624b\u673a\u53f7\u200b': '19331729920'}, 'prompt': ''}\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u56db\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u8c03\u7528\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u5b9e\u4f8b\u200b\u5316\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b pipeline str \u200b\u65e0\u200b \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\uff1b llm_name str \"ernie-3.5\" \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\uff0c\u200b\u76ee\u524d\u200b\u652f\u6301\u200bernie-4.0\uff0cernie-3.5\uff0c\u200b\u66f4\u200b\u591a\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u4e2d\u200b; llm_params dict {} LLM\u200b\u76f8\u5173\u200bAPI\u200b\u914d\u7f6e\u200b\uff1b device str\u3001None None \u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\uff08None\u200b\u4e3a\u200b\u81ea\u52a8\u200b\u9002\u914d\u200b\uff09,\u200b\u652f\u6301\u200b\u4f20\u5165\u200b'cpu'\uff0c'gpu'\u200b\u6216\u200b'gpu:0'\u200b\u7b49\u200b\uff1b

\uff082\uff09\u200b\u8c03\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b visual_predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u89c6\u89c9\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b input Python Var \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\uff1b input str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\uff1b input str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200burl\uff0c\u200b\u5982\u200bhttps://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\uff1b input str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\uff1b input dict \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u8981\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4e3a\u200b\"img\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b\uff1a{\"img\": \"/root/data1\"}\uff1b input list \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]\uff0c[\"/root/data1\", \"/root/data2\"]\uff0c[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]\uff1b use_doc_image_ori_cls_model bool True \u200b\u662f\u5426\u200b\u4f7f\u7528\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff1b use_doc_image_unwarp_model bool True \u200b\u662f\u5426\u200b\u4f7f\u7528\u200b\u7248\u9762\u200b\u77eb\u6b63\u200b\u4ea7\u7ebf\u200b\uff1b use_seal_text_det_model bool True \u200b\u662f\u5426\u200b\u4f7f\u7528\u200b\u5f2f\u66f2\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff1b

\uff083\uff09\u200b\u8c03\u7528\u200b\u89c6\u89c9\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5bf9\u8c61\u200b\u7684\u200b\u76f8\u5173\u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u89c6\u89c9\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u5177\u4f53\u65b9\u6cd5\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u53c2\u6570\u200b \u200b\u65b9\u6cd5\u200b\u8bf4\u660e\u200b save_to_img save_path \u200b\u5c06\u200bOCR\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3001\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u7247\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53c2\u6570\u200bsave_path\u200b\u7528\u4e8e\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b save_to_html save_path \u200b\u5c06\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53c2\u6570\u200bsave_path\u200b\u7528\u4e8e\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b save_to_xlsx save_path \u200b\u5c06\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bxlsx\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53c2\u6570\u200bsave_path\u200b\u7528\u4e8e\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u7684\u200b\u8def\u5f84\u200b\uff1b

\uff084\uff09\u200b\u8c03\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b chat \u200b\u65b9\u6cd5\u200b\u4e0e\u200b\u5927\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u4ea4\u4e92\u200b\uff0c\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b key_list str \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u67e5\u8be2\u200b\u7684\u200b\u5173\u952e\u5b57\u200b\uff08query\uff09\uff1b\u200b\u652f\u6301\u200b\u201c\uff0c\u201d\u200b\u6216\u200b\u201c,\u201d\u200b\u4f5c\u4e3a\u200b\u5206\u9694\u7b26\u200b\u7684\u200b\u591a\u4e2a\u200b\u5173\u952e\u5b57\u200b\u7ec4\u6210\u200b\u7684\u200b\u5b57\u7b26\u4e32\u200b\uff0c\u200b\u5982\u200b\u201c\u200b\u4e59\u65b9\u200b\uff0c\u200b\u624b\u673a\u53f7\u200b\u201d\uff1b key_list list \u200b\u65e0\u200b \u200b\u7528\u4e8e\u200b\u67e5\u8be2\u200b\u7684\u200b\u5173\u952e\u5b57\u200b\uff08query\uff09\uff0c\u200b\u652f\u6301\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u5173\u952e\u5b57\u200b\uff0c\u200b\u5176\u200b\u5143\u7d20\u200b\u4e3a\u200bstr\u200b\u7c7b\u578b\u200b\uff1b

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u60a8\u200b\u5373\u53ef\u200b\u5bf9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff1a

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

\u200b\u5728\u200b\u4e0a\u8ff0\u200b\u914d\u7f6e\u200b\u4e2d\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4fee\u6539\u200b\u4ea7\u7ebf\u200b\u5404\u200b\u6a21\u5757\u200b\u52a0\u8f7d\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u4fee\u6539\u200b\u4f7f\u7528\u200b\u7684\u200b\u5927\u200b\u6a21\u578b\u200b\u3002\u200b\u5404\u200b\u6a21\u5757\u200b\u652f\u6301\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8bf7\u200b\u53c2\u8003\u200b\u6a21\u5757\u200b\u6587\u6863\u200b\uff0c\u200b\u5927\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5217\u8868\u200b\u4e3a\u200b\uff1aernie-4.0\u3001ernie-3.5\u3001ernie-3.5-8k\u3001ernie-lite\u3001ernie-tiny-8k\u3001ernie-speed\u3001ernie-speed-128k\u3001ernie-char-8k\u3002

\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5e94\u7528\u200b\u914d\u7f6e\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/PP-ChatOCRv3-doc.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • analyzeImages

\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u83b7\u5f97\u200bOCR\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002

POST /chatocr-vision

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b file string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u6216\u200bPDF\u200b\u6587\u4ef6\u200b\u7684\u200bURL\uff0c\u200b\u6216\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u8d85\u8fc7\u200b10\u200b\u9875\u200b\u7684\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53ea\u6709\u200b\u524d\u200b10\u200b\u9875\u200b\u7684\u200b\u5185\u5bb9\u200b\u4f1a\u200b\u88ab\u200b\u4f7f\u7528\u200b\u3002 \u200b\u662f\u200b fileType integer \u200b\u6587\u4ef6\u7c7b\u578b\u200b\u30020\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c1\u200b\u8868\u793a\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u3002\u200b\u82e5\u200b\u8bf7\u6c42\u200b\u4f53\u65e0\u6b64\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5219\u200b\u670d\u52a1\u200b\u5c06\u200b\u5c1d\u8bd5\u200b\u6839\u636e\u200bURL\u200b\u81ea\u52a8\u200b\u63a8\u65ad\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u3002 \u200b\u5426\u200b useImgOrientationCls boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useImgUnwrapping boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useSealTextDet boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b visionResults array \u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6a21\u578b\u200b\u5f97\u5230\u200b\u7684\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u3002\u200b\u6570\u7ec4\u200b\u957f\u5ea6\u200b\u4e3a\u200b1\uff08\u200b\u5bf9\u4e8e\u200b\u56fe\u50cf\u200b\u8f93\u5165\u200b\uff09\u200b\u6216\u200b\u6587\u6863\u200b\u9875\u6570\u200b\u4e0e\u200b10\u200b\u4e2d\u200b\u7684\u200b\u8f83\u200b\u5c0f\u8005\u200b\uff08\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff09\u3002\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff0c\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6bcf\u200b\u4e00\u9875\u200b\u7684\u200b\u5904\u7406\u7ed3\u679c\u200b\u3002 visionInfo object \u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\uff0c\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002

visionResults\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 tables array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5185\u5bb9\u200b\u3002 inputImage string \u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002

tables\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 html string HTML\u200b\u683c\u5f0f\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002
  • buildVectorStore

\u200b\u6784\u5efa\u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u3002

POST /chatocr-vector

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b visionInfo object \u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002\u200b\u7531\u200banalyzeImages\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b minChars integer \u200b\u542f\u7528\u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u7684\u200b\u6700\u5c0f\u200b\u6570\u636e\u200b\u957f\u5ea6\u200b\u3002 \u200b\u5426\u200b llmRequestInterval number \u200b\u8c03\u7528\u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u7684\u200b\u95f4\u9694\u65f6\u95f4\u200b\u3002 \u200b\u5426\u200b llmName string \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\u3002 \u200b\u5426\u200b llmParams object \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

\u200b\u5f53\u524d\u200b\uff0cllmParams \u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5982\u4e0b\u200b\u5f62\u5f0f\u200b\u4e4b\u4e00\u200b\uff1a

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\",\n\"secretKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{\u200b\u661f\u6cb3\u200b\u793e\u533a\u200baccess token}\"\n}\n
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b vectorStore string \u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u5e8f\u5217\u5316\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002
  • retrieveKnowledge

\u200b\u8fdb\u884c\u200b\u77e5\u8bc6\u200b\u68c0\u7d22\u200b\u3002

POST /chatocr-retrieval

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b keys array \u200b\u5173\u952e\u8bcd\u200b\u5217\u8868\u200b\u3002 \u200b\u662f\u200b vectorStore string \u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u5e8f\u5217\u5316\u200b\u7ed3\u679c\u200b\u3002\u200b\u7531\u200bbuildVectorStore\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b llmName string \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\u3002 \u200b\u5426\u200b llmParams object \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

\u200b\u5f53\u524d\u200b\uff0cllmParams \u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5982\u4e0b\u200b\u5f62\u5f0f\u200b\u4e4b\u4e00\u200b\uff1a

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\",\n\"secretKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{\u200b\u661f\u6cb3\u200b\u793e\u533a\u200baccess token}\"\n}\n
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b retrievalResult string \u200b\u77e5\u8bc6\u200b\u68c0\u7d22\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53ef\u200b\u7528\u4f5c\u200b\u5176\u4ed6\u200b\u64cd\u4f5c\u200b\u7684\u200b\u8f93\u5165\u200b\u3002
  • chat

\u200b\u4e0e\u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u4ea4\u4e92\u200b\uff0c\u200b\u5229\u7528\u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u63d0\u70bc\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002

POST /chatocr-chat

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b keys array \u200b\u5173\u952e\u8bcd\u200b\u5217\u8868\u200b\u3002 \u200b\u662f\u200b visionInfo object \u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u3002\u200b\u7531\u200banalyzeImages\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u662f\u200b vectorStore string \u200b\u5411\u91cf\u200b\u6570\u636e\u5e93\u200b\u5e8f\u5217\u5316\u200b\u7ed3\u679c\u200b\u3002\u200b\u7531\u200bbuildVectorStore\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u5426\u200b retrievalResult string \u200b\u77e5\u8bc6\u200b\u68c0\u7d22\u200b\u7ed3\u679c\u200b\u3002\u200b\u7531\u200bretrieveKnowledge\u200b\u64cd\u4f5c\u200b\u63d0\u4f9b\u200b\u3002 \u200b\u5426\u200b taskDescription string \u200b\u63d0\u793a\u200b\u8bcd\u200b\u4efb\u52a1\u200b\u3002 \u200b\u5426\u200b rules string \u200b\u63d0\u793a\u200b\u8bcd\u200b\u89c4\u5219\u200b\u3002\u200b\u7528\u4e8e\u200b\u81ea\u5b9a\u4e49\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u89c4\u5219\u200b\uff0c\u200b\u4f8b\u5982\u200b\u89c4\u8303\u200b\u8f93\u51fa\u200b\u683c\u5f0f\u200b\u3002 \u200b\u5426\u200b fewShot string \u200b\u63d0\u793a\u200b\u8bcd\u200b\u793a\u4f8b\u200b\u3002 \u200b\u5426\u200b llmName string \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b\u3002 \u200b\u5426\u200b llmParams object \u200b\u5927\u200b\u8bed\u8a00\u200b\u6a21\u578b\u200bAPI\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b returnPrompts boolean \u200b\u662f\u5426\u200b\u8fd4\u56de\u200b\u4f7f\u7528\u200b\u7684\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u7981\u7528\u200b\u3002 \u200b\u5426\u200b

\u200b\u5f53\u524d\u200b\uff0cllmParams \u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5982\u4e0b\u200b\u5f62\u5f0f\u200b\u4e4b\u4e00\u200b\uff1a

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\",\n\"secretKey\": \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{\u200b\u661f\u6cb3\u200b\u793e\u533a\u200baccess token}\"\n}\n
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b chatResult object \u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7ed3\u679c\u200b\u3002 prompts object \u200b\u4f7f\u7528\u200b\u7684\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002

prompts\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b ocr string OCR\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002 table string \u200b\u8868\u683c\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002 html string HTML\u200b\u63d0\u793a\u200b\u8bcd\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\nAPI_KEY = \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bAPI key}\"\nSECRET_KEY = \"{\u200b\u5343\u5e06\u200b\u5e73\u53f0\u200bsecret key}\"\nLLM_NAME = \"ernie-3.5\"\nLLM_PARAMS = {\n    \"apiType\": \"qianfan\",\n    \"apiKey\": API_KEY,\n    \"secretKey\": SECRET_KEY,\n}\n\nfile_path = \"./demo.jpg\"\nkeys = [\"\u200b\u7535\u8bdd\u200b\"]\n\nwith open(file_path, \"rb\") as file:\n    file_bytes = file.read()\n    file_data = base64.b64encode(file_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": file_data,\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\nresp_vision = requests.post(url=f\"{API_BASE_URL}/chatocr-vision\", json=payload)\nif resp_vision.status_code != 200:\n    print(\n        f\"Request to chatocr-vision failed with status code {resp_vision.status_code}.\"\n    )\n    pprint.pp(resp_vision.json())\n    sys.exit(1)\nresult_vision = resp_vision.json()[\"result\"]\n\nfor i, res in enumerate(result_vision[\"visionResults\"]):\n    print(\"Texts:\")\n    pprint.pp(res[\"texts\"])\n    print(\"Tables:\")\n    pprint.pp(res[\"tables\"])\n    ocr_img_path = f\"ocr_{i}.jpg\"\n    with open(ocr_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"ocrImage\"]))\n    layout_img_path = f\"layout_{i}.jpg\"\n    with open(layout_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"layoutImage\"]))\n    print(f\"Output images saved at {ocr_img_path} and {layout_img_path}\")\n\npayload = {\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"minChars\": 200,\n    \"llmRequestInterval\": 1000,\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_vector = requests.post(url=f\"{API_BASE_URL}/chatocr-vector\", json=payload)\nif resp_vector.status_code != 200:\n    print(\n        f\"Request to chatocr-vector failed with status code {resp_vector.status_code}.\"\n    )\n    pprint.pp(resp_vector.json())\n    sys.exit(1)\nresult_vector = resp_vector.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_retrieval = requests.post(url=f\"{API_BASE_URL}/chatocr-retrieval\", json=payload)\nif resp_retrieval.status_code != 200:\n    print(\n        f\"Request to chatocr-retrieval failed with status code {resp_retrieval.status_code}.\"\n    )\n    pprint.pp(resp_retrieval.json())\n    sys.exit(1)\nresult_retrieval = resp_retrieval.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"retrievalResult\": result_retrieval[\"retrievalResult\"],\n    \"taskDescription\": \"\",\n    \"rules\": \"\",\n    \"fewShot\": \"\",\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n    \"returnPrompts\": True,\n}\nresp_chat = requests.post(url=f\"{API_BASE_URL}/chatocr-chat\", json=payload)\nif resp_chat.status_code != 200:\n    print(\n        f\"Request to chatocr-chat failed with status code {resp_chat.status_code}.\"\n    )\n    pprint.pp(resp_chat.json())\n    sys.exit(1)\nresult_chat = resp_chat.json()[\"result\"]\nprint(\"\\nPrompts:\")\npprint.pp(result_chat[\"prompts\"])\nprint(\"Final result:\")\nprint(result_chat[\"chatResult\"])\n
\u200b\u6ce8\u200b\uff1a\u200b\u8bf7\u200b\u5728\u200b `API_KEY`\u3001`SECRET_KEY` \u200b\u5904\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200b API key \u200b\u548c\u200b secret key\u3002

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u516d\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\uff09\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u9519\u8bef\u200b\uff08\u200b\u5982\u200b\u884c\u5217\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\u3001\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u7248\u9762\u200b\u4e2d\u200b\u5b58\u5728\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff08\u200b\u4f8b\u5982\u200b\u5bf9\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u542b\u200b\u6587\u5b57\u200b\u533a\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u6216\u200b\u8bc1\u4ef6\u200b\u7684\u200b\u65b9\u5411\u200b\u5b58\u5728\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  layout_model: RT-DETR-H_layout_3cls  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  table_model: SLANet_plus  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_server_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_server_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  seal_text_det_model: PP-OCRv4_server_seal_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_ori_cls_model: null   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_unwarp_model: null   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n......\n

\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU \u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u8bbe\u7f6e\u200b device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u65f6\u200b\uff0c\u200b\u5c06\u200b\u8fd0\u884c\u200b\u8bbe\u5907\u200b\u4ece\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u66f4\u200b\u6539\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5c06\u200b\u811a\u672c\u200b\u4e2d\u200b\u7684\u200b device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu \u200b\u5373\u53ef\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"},\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html","title":"\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#1-ocr","title":"1. OCR\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002

\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002

\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72\u200b

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b Demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u4ece\u200b\u4e91\u7aef\u200b\u4e0b\u8f7d\u200b\u90e8\u7f72\u200b\u5305\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b2.2\u200b\u8282\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\u3002\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u2757 \u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"
  • \u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200bOCR\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200bOCR\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200bPython\u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200bOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config OCR\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0cOCR\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b./my_path\uff09\uff1a

paddlex --get_pipeline_config OCR --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./OCR.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./OCR.yaml --input general_ocr_002.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'general_ocr_002.png', 'dt_polys': [[[5, 12], [88, 10], [88, 29], [5, 31]], [[208, 14], [249, 14], [249, 22], [208, 22]], [[695, 15], [824, 15], [824, 60], [695, 60]], [[158, 27], [355, 23], [356, 70], [159, 73]], [[421, 25], [659, 19], [660, 59], [422, 64]], [[337, 104], [460, 102], [460, 127], [337, 129]], [[486, 103], [650, 100], [650, 125], [486, 128]], [[675, 98], [835, 94], [835, 119], [675, 124]], [[64, 114], [192, 110], [192, 131], [64, 134]], [[210, 108], [318, 106], [318, 128], [210, 130]], [[82, 140], [214, 138], [214, 163], [82, 165]], [[226, 136], [328, 136], [328, 161], [226, 161]], [[404, 134], [432, 134], [432, 161], [404, 161]], [[509, 131], [570, 131], [570, 158], [509, 158]], [[730, 138], [771, 138], [771, 154], [730, 154]], [[806, 136], [817, 136], [817, 146], [806, 146]], [[342, 175], [470, 173], [470, 197], [342, 199]], [[486, 173], [616, 171], [616, 196], [486, 198]], [[677, 169], [813, 166], [813, 191], [677, 194]], [[65, 181], [170, 177], [171, 202], [66, 205]], [[96, 208], [171, 205], [172, 230], [97, 232]], [[336, 220], [476, 215], [476, 237], [336, 242]], [[507, 217], [554, 217], [554, 236], [507, 236]], [[87, 229], [204, 227], [204, 251], [87, 254]], [[344, 240], [483, 236], [483, 258], [344, 262]], [[66, 252], [174, 249], [174, 271], [66, 273]], [[75, 279], [264, 272], [265, 297], [76, 303]], [[459, 297], [581, 295], [581, 320], [459, 322]], [[101, 314], [210, 311], [210, 337], [101, 339]], [[68, 344], [165, 340], [166, 365], [69, 368]], [[345, 350], [662, 346], [662, 368], [345, 371]], [[100, 459], [832, 444], [832, 465], [100, 480]]], 'dt_scores': [0.8183103704439653, 0.7609575621092027, 0.8662357274035412, 0.8619508290334809, 0.8495855993183273, 0.8676840017933314, 0.8807986687956436, 0.822308525056085, 0.8686617037621976, 0.8279022169854463, 0.952332847006758, 0.8742692553015098, 0.8477013022907575, 0.8528771493227294, 0.7622965906848765, 0.8492388224448705, 0.8344203789965632, 0.8078477124353284, 0.6300434587457232, 0.8359967356998494, 0.7618617265751318, 0.9481573079350023, 0.8712182945408912, 0.837416955846334, 0.8292475059403851, 0.7860382856406026, 0.7350527486717117, 0.8701022267947695, 0.87172526903969, 0.8779847108088126, 0.7020437651809734, 0.6611684983372949], 'rec_text': ['www.997', '151', 'PASS', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', '\u200b\u8231\u4f4d\u200b CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200bSEATNO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200bDATE', 'MU 2379', '03DEC', 'W', '035', 'F', '1', '\u200b\u59cb\u53d1\u5730\u200bFROM', '\u200b\u767b\u673a\u53e3\u200b GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO.', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO.', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE1OMINUTESBEFOREDEPARTURETIME'], 'rec_score': [0.9617719054222107, 0.4199012815952301, 0.9652514457702637, 0.9978302121162415, 0.9853208661079407, 0.9445787072181702, 0.9714463949203491, 0.9841841459274292, 0.9564052224159241, 0.9959094524383545, 0.9386572241783142, 0.9825271368026733, 0.9356589317321777, 0.9985442161560059, 0.3965512812137604, 0.15236201882362366, 0.9976775050163269, 0.9547433257102966, 0.9974752068519592, 0.9646636843681335, 0.9907559156417847, 0.9895358681678772, 0.9374122023582458, 0.9909093379974365, 0.9796401262283325, 0.9899340271949768, 0.992210865020752, 0.9478569626808167, 0.9982215762138367, 0.9924325942993164, 0.9941263794898987, 0.96443772315979]}\n......\n
\u200b\u5176\u4e2d\u200b\uff0cdt_polys\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u6846\u200b\u5750\u6807\u200b\uff0cdt_polys\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u6846\u200b\u5750\u6807\u200b\uff0cdt_scores\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u6587\u672c\u6846\u200b\u7684\u200b\u7f6e\u4fe1\u5ea6\u200b\uff0crec_text\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\uff0crec_score\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u6587\u672c\u200b\u7684\u200b\u7f6e\u4fe1\u5ea6\u200b

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a \u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"
  • \u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u2757 Python\u200b\u811a\u672c\u200b\u8fd0\u884c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b OCR \u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200bOCR\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/OCR.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/OCR.yaml\")\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u56fe\u50cf\u200bOCR\u200b\u7ed3\u679c\u200b\u3002

POST /ocr

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 image string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6807\u6ce8\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"\u200b\u5317\u4eac\u200b\u5357\u7ad9\u200b\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"\u200b\u5929\u6d25\u7ad9\u200b\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String outputImagePath = \"./out.jpg\"; // \u200b\u8f93\u51fa\u200b\u56fe\u50cf\u200b\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  text_det_model: PP-OCRv4_mobile_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_mobile_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4e3a\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8bbe\u7f6e\u200b\u5355\u72ec\u200b\u7684\u200bbatch_size\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/OCR.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline OCR --input general_ocr_002.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html","title":"\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#1","title":"1. \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200bLaTeX\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u5b66\u200b\u3001\u200b\u7269\u7406\u200b\u3001\u200b\u8ba1\u7b97\u673a\u79d1\u5b66\u200b\u7b49\u200b\u9886\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u7f16\u8f91\u200b\u548c\u200b\u6570\u636e\u5206\u6790\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6570\u5b66\u516c\u5f0f\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200bLaTeX\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002

\u200b\u901a\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.126 3827.25 470.2M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b BLEU score normed edit distance ExpRate \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b LaTeX_OCR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.8821 0.0823 40.01 - - 89.7 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u652f\u6301\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config formula_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config formula_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./formula_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./formula_recognition.yaml --input general_formula_recognition.png --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': 'general_formula_recognition.png', 'layout_result': {'input_path': 'general_formula_recognition.png', 'boxes': [{'cls_id': 3, 'label': 'number', 'score': 0.7580855488777161, 'coordinate': [1028.3635, 205.46213, 1038.953, 222.99033]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.8882032632827759, 'coordinate': [272.75305, 204.50894, 433.7473, 226.17996]}, {'cls_id': 2, 'label': 'text', 'score': 0.9685840606689453, 'coordinate': [272.75928, 282.17773, 1041.9316, 374.44687]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559416770935059, 'coordinate': [272.39056, 385.54114, 1044.1521, 443.8598]}, {'cls_id': 2, 'label': 'text', 'score': 0.9610629081726074, 'coordinate': [272.40817, 467.2738, 1045.1033, 563.4855]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8916195034980774, 'coordinate': [503.45743, 594.6236, 1040.6804, 619.73895]}, {'cls_id': 2, 'label': 'text', 'score': 0.973675549030304, 'coordinate': [272.32007, 648.8599, 1040.8702, 775.15686]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9038916230201721, 'coordinate': [554.2307, 803.5825, 1040.4657, 855.3159]}, {'cls_id': 2, 'label': 'text', 'score': 0.9025381803512573, 'coordinate': [272.535, 875.1402, 573.1086, 898.3587]}, {'cls_id': 2, 'label': 'text', 'score': 0.8336610794067383, 'coordinate': [317.48013, 909.60864, 966.8498, 933.7868]}, {'cls_id': 2, 'label': 'text', 'score': 0.8779091238975525, 'coordinate': [19.704018, 653.322, 72.433235, 1215.1992]}, {'cls_id': 2, 'label': 'text', 'score': 0.8832409977912903, 'coordinate': [272.13028, 958.50806, 1039.7928, 1019.476]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9088466167449951, 'coordinate': [517.1226, 1042.3978, 1040.2208, 1095.7457]}, {'cls_id': 2, 'label': 'text', 'score': 0.9587949514389038, 'coordinate': [272.03336, 1112.9269, 1041.0201, 1206.8417]}, {'cls_id': 2, 'label': 'text', 'score': 0.8885666131973267, 'coordinate': [271.7495, 1231.8752, 710.44495, 1255.7981]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8907185196876526, 'coordinate': [581.2295, 1287.4525, 1039.8014, 1312.772]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559596180915833, 'coordinate': [273.1827, 1341.421, 1041.0299, 1401.7255]}, {'cls_id': 2, 'label': 'text', 'score': 0.875311553478241, 'coordinate': [272.8338, 1427.3711, 789.7108, 1451.1359]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9152213931083679, 'coordinate': [524.9582, 1474.8136, 1041.6333, 1530.7142]}, {'cls_id': 2, 'label': 'text', 'score': 0.9584835767745972, 'coordinate': [272.81665, 1549.524, 1042.9962, 1608.7157]}]}, 'ocr_result': {}, 'table_result': [], 'dt_polys': [array([[ 503.45743,  594.6236 ],\n       [1040.6804 ,  594.6236 ],\n       [1040.6804 ,  619.73895],\n       [ 503.45743,  619.73895]], dtype=float32), array([[ 554.2307,  803.5825],\n       [1040.4657,  803.5825],\n       [1040.4657,  855.3159],\n       [ 554.2307,  855.3159]], dtype=float32), array([[ 517.1226, 1042.3978],\n       [1040.2208, 1042.3978],\n       [1040.2208, 1095.7457],\n       [ 517.1226, 1095.7457]], dtype=float32), array([[ 581.2295, 1287.4525],\n       [1039.8014, 1287.4525],\n       [1039.8014, 1312.772 ],\n       [ 581.2295, 1312.772 ]], dtype=float32), array([[ 524.9582, 1474.8136],\n       [1041.6333, 1474.8136],\n       [1041.6333, 1530.7142],\n       [ 524.9582, 1530.7142]], dtype=float32)], 'rec_formula': ['F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)', 'p(\\mathbf{x})=c(\\mathbf{u})\\prod_{i}p(x_{i}).\\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\quad~~\\quad~~~~~~~~~~~~~~~(2)', 'H_{c}({\\bf x})=-\\int_{{\\bf{u}}}c({\\bf{u}})\\log c({\\bf{u}})d{\\bf{u}}.~~~~~~~~~~~~~~~~~~~~~(3)', 'I({\\bf x})=-H_{c}({\\bf x}).\\qquad\\qquad\\qquad\\qquad(4)', 'H({\\bf x})=\\sum_{i}H(x_{i})+H_{c}({\\bf x}).\\eqno\\qquad\\qquad\\qquad(5)']}\n

\u200b\u5176\u4e2d\u200b\uff0cdt_polys\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u533a\u57df\u200b\u5750\u6807\u200b\uff0c rec_formula\u200b\u4e3a\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u3002

\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u9700\u8981\u200b\u5355\u72ec\u200b\u914d\u7f6e\u200b\u73af\u5883\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u53c2\u8003\u200b2.3 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u89c6\u5316\u200b \u200b\u5bf9\u200bLaTeX\u200b\u6e32\u67d3\u200b\u5f15\u64ce\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n

\u2757 Python\u200b\u811a\u672c\u200b\u8fd0\u884c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/formula_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/formula_recognition.yaml\")\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#23","title":"2.3 \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u89c6\u5316","text":"

\u200b\u5982\u679c\u200b\u60a8\u200b\u9700\u8981\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u53ef\u89c6\u5316\u200b\uff0c\u200b\u9700\u8981\u200b\u8fd0\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u6765\u200b\u5bf9\u200bLaTeX\u200b\u6e32\u67d3\u200b\u73af\u5883\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\uff1a

apt-get install sudo\nsudo apt-get update\nsudo apt-get install texlive\nsudo apt-get install texlive-latex-base\nsudo apt-get install texlive-latex-extra\n
\u200b\u4e4b\u540e\u200b\uff0c\u200b\u4f7f\u7528\u200b save_to_img \u200b\u65b9\u6cd5\u200b\u5bf9\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\u3002\u200b\u5177\u4f53\u200b\u547d\u4ee4\u200b\u5982\u4e0b\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
\u200b\u5907\u6ce8\u200b\uff1a \u200b\u7531\u4e8e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u9700\u8981\u200b\u5bf9\u200b\u6bcf\u5f20\u200b\u516c\u5f0f\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u6e32\u67d3\u200b\uff0c\u200b\u56e0\u6b64\u200b\u8017\u65f6\u200b\u8f83\u957f\u200b\uff0c\u200b\u8bf7\u200b\u60a8\u200b\u8010\u5fc3\u200b\u7b49\u5f85\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u56fe\u50cf\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /formula-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b formulas array \u200b\u516c\u5f0f\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5185\u5bb9\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

formulas\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u516c\u5f0f\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 latex string \u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"formulas\": [\n{\n\"poly\": [\n[\n444.0,\n244.0\n],\n[\n705.4,\n244.5\n],\n[\n705.8,\n311.3\n],\n[\n444.1,\n311.0\n]\n],\n\"latex\": \"F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)\"\n}\n],\n\"layoutImage\": \"xxxxxx\",\n\"ocrImage\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/formula-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected formulas:\")\nprint(result[\"formulas\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/formula-recognition\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto formulas = result[\"formulas\"];\n        std::cout << \"\\nDetected formulas:\" << std::endl;\n        for (const auto& formula : formulas) {\n            std::cout << formula << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/formula-recognition\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String layoutImagePath = \"./layout.jpg\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode formulas = result.get(\"formulas\");\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected formulas: \" + formulas.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/formula-recognition\"\n    imagePath := \"./demo.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            LayoutImage      string   `json:\"layoutImage\"`\n            Formulas []map[string]interface{} `json:\"formulas\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected formulas:\")\n    for _, formula := range respData.Result.Formulas {\n        fmt.Println(formula)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/formula-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected formulas:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"formulas\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/formula-recognition'\nconst imagePath = './demo.jpg'\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected formulas:\");\n    console.log(result[\"formulas\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/formula-recognition\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected formulas:\\n\";\nprint_r($result[\"formulas\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e24\u4e2a\u200b\u6a21\u5757\u200b\uff08\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\uff09\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u5982\u679c\u200b\u5728\u200b\u5206\u6790\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u53d1\u73b0\u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u516c\u5f0f\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u516c\u5f0f\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff1b\u200b\u5982\u679c\u200b\u5728\u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  layout_model: RT-DETR-H_layout_17cls #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  formula_rec_model: LaTeX_OCR_rec #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  formula_rec_batch_size: 5\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b2. \u200b\u5feb\u901f\u200b\u5f00\u59cb\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200bPython\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device\u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html","title":"\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#1","title":"1. \u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u662f\u200b\u4e00\u79cd\u200b\u4ece\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u7ed3\u6784\u5316\u200b\u4fe1\u606f\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u4e3b\u8981\u200b\u7528\u4e8e\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6587\u6863\u200b\u7248\u9762\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u673a\u5668\u200b\u53ef\u8bfb\u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u6587\u6863\u200b\u7ba1\u7406\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u200b\u6570\u5b57\u5316\u200b\u7b49\u200b\u9886\u57df\u200b\u5177\u6709\u200b\u5e7f\u6cdb\u200b\u7684\u200b\u5e94\u7528\u200b\u3002\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff08OCR\uff09\u3001\u200b\u56fe\u50cf\u5904\u7406\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u5757\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u6bb5\u843d\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u4ee5\u53ca\u200b\u5176\u4ed6\u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u3002\u200b\u6b64\u200b\u8fc7\u7a0b\u200b\u901a\u5e38\u200b\u5305\u62ec\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u5143\u7d20\u200b\u5206\u6790\u200b\u548c\u200b\u6570\u636e\u200b\u683c\u5f0f\u5316\u200b\u4e09\u4e2a\u200b\u4e3b\u8981\u200b\u6b65\u9aa4\u200b\uff0c\u200b\u6700\u7ec8\u200b\u751f\u6210\u200b\u7ed3\u6784\u5316\u200b\u7684\u200b\u6587\u6863\u200b\u6570\u636e\u200b\uff0c\u200b\u63d0\u5347\u200b\u6570\u636e\u5904\u7406\u200b\u7684\u200b\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002

\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b

\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M SLANet_plus \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bSLANet\u200b\u7684\u200b\u589e\u5f3a\u7248\u200b\u3002\u200b\u76f8\u8f83\u200b\u4e8e\u200bSLANet\uff0cSLANet_plus \u200b\u5bf9\u200b\u65e0\u7ebf\u200b\u8868\u200b\u3001\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\u5f97\u5230\u200b\u4e86\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\uff0c\u200b\u5e76\u200b\u964d\u4f4e\u200b\u4e86\u200b\u6a21\u578b\u200b\u5bf9\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51c6\u786e\u6027\u200b\u7684\u200b\u654f\u611f\u5ea6\u200b\uff0c\u200b\u5373\u4f7f\u200b\u8868\u683c\u200b\u5b9a\u4f4d\u200b\u51fa\u73b0\u200b\u504f\u79fb\u200b\uff0c\u200b\u4e5f\u200b\u80fd\u591f\u200b\u8f83\u200b\u51c6\u786e\u200b\u5730\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 109 PP-OCRv4 \u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u6027\u80fd\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.7 PP-OCRv4 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200bPP-OCRv3\u200b\u7684\u200b\u4e0b\u200b\u4e00\u4e2a\u200b\u7248\u672c\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5f15\u5165\u200b\u6570\u636e\u200b\u589e\u5f3a\u200b\u65b9\u6848\u200b\u3001GTC-NRTR\u200b\u6307\u5bfc\u200b\u5206\u652f\u200b\u7b49\u200b\u7b56\u7565\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u4e0d\u53d8\u200b\u7684\u200b\u60c5\u51b5\u200b\u4e0b\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u7aef\u200b\uff08server\uff09\u200b\u548c\u200b\u79fb\u52a8\u200b\u7aef\u200b\uff08mobile\uff09\u200b\u4e24\u4e2a\u200b\u4e0d\u540c\u200b\u7248\u672c\u200b\uff0c\u200b\u6765\u200b\u6ee1\u8db3\u200b\u4e0d\u540c\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u5de5\u4e1a\u200b\u9700\u6c42\u200b\u3002 PP-OCRv4_server_rec \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_SVTRv2_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 68.81 8.36801 165.706 73.9 M SVTRv2 \u200b\u662f\u200b\u4e00\u79cd\u200b\u7531\u200b\u590d\u65e6\u5927\u5b66\u200b\u89c6\u89c9\u200b\u4e0e\u200b\u5b66\u4e60\u200b\u5b9e\u9a8c\u5ba4\u200b\uff08FVL\uff09\u200b\u7684\u200bOpenOCR\u200b\u56e2\u961f\u200b\u7814\u53d1\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cA\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b6%\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b ch_RepSVTR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 65.07 10.5047 51.5647 22.1 M RepSVTR \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u662f\u200b\u4e00\u79cd\u200b\u57fa\u4e8e\u200bSVTRv2 \u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5176\u200b\u5728\u200bPaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u4e2d\u200b\u8363\u83b7\u200b\u4e00\u7b49\u5956\u200b\uff0cB\u200b\u699c\u7aef\u200b\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u7cbe\u5ea6\u200b\u76f8\u6bd4\u200bPP-OCRv4\u200b\u63d0\u5347\u200b2.5%\uff0c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u6301\u5e73\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002 \u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b BLEU score normed edit distance ExpRate \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b LaTeX_OCR_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.8821 0.0823 40.01 - - 89.7 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MS-SSIM \uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b UVDoc\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 54.40 30.3 M \u200b\u9ad8\u7cbe\u5ea6\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u578b\u200b

\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b DocUNet benchmark\u3002

\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-LCNet_x1_0_doc_ori\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 99.06 3.84845 9.23735 7 \u200b\u57fa\u4e8e\u200bPP-LCNet_x1_0\u200b\u7684\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u542b\u6709\u200b\u56db\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5373\u200b0\u200b\u5ea6\u200b\uff0c90\u200b\u5ea6\u200b\uff0c180\u200b\u5ea6\u200b\uff0c270\u200b\u5ea6\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8bc1\u4ef6\u200b\u548c\u200b\u6587\u6863\u200b\u7b49\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5305\u542b\u200b 1000 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline layout_parsing --input demo_paper.png --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config layout_parsing\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config layout_parsing --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./layout_parsing.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./layout_parsing.yaml --input layout_parsing.jpg\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': PosixPath('/root/.paddlex/temp/tmp5jmloefs.png'), 'parsing_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmpshsq8_w0.png'), 'layout_bbox': [51.46833, 74.22329, 542.4082, 232.77504], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [213, 221, 238],\n        [217, 223, 240],\n        [233, 234, 241]],\n\n       [[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpcd2q9uyu.png'), 'layout_bbox': [47.68295, 243.08054, 546.28253, 295.71045], 'figure_title': 'Overview of RT-DETR, We feed th', 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpr_iqa8b3.png'), 'layout_bbox': [58.416977, 304.1531, 275.9134, 400.07513], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmphpblxl3p.png'), 'layout_bbox': [100.62961, 405.97458, 234.79774, 414.77414], 'figure_title': 'Figure 5. The fusion block in CCFF.', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmplgnczrsf.png'), 'layout_bbox': [47.81724, 421.9041, 288.01566, 550.538], 'text': 'D, Ds, not only significantly reduces latency (35% faster),\\nRut\\nnproves accuracy (0.4% AP higher), CCFF is opti\\nased on the cross-scale fusion module, which\\nnsisting of convolutional lavers intc\\npath.\\nThe role of the fusion block is t\\n into a new feature, and its\\nFigure 5. The f\\nblock contains tw\\n1 x1\\nchannels, /V RepBlock\\n. anc\\n: two-path outputs are fused by element-wise add. We\\ntormulate the calculation ot the hvbrid encoder as:', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpsq0ey9md.png'), 'layout_bbox': [94.60716, 558.703, 288.04193, 600.19434], 'formula': '\\\\begin{array}{l}{{\\\\Theta=K=\\\\mathrm{p.s.sp{\\\\pm}}\\\\mathrm{i.s.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}}),{\\\\qquad\\\\mathrm{{a.s.}}\\\\mathrm{s.}}}\\\\\\\\ {{\\\\tau_{\\\\mathrm{{s.s.s.s.s.}}(\\\\mathrm{l.s.},\\\\mathrm{l.s.},\\\\mathrm{s.s.}}\\\\mathrm{s.}\\\\mathrm{s.}}\\\\end{array}),}}\\\\\\\\ {{\\\\bar{\\\\mathrm{e-c.c.s.s.}(\\\\mathrm{s.},\\\\mathrm{s.s.},\\\\ s_{s}}\\\\mathrm{s.s.},\\\\tau),}}\\\\end{array}', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpv30qy0v4.png'), 'layout_bbox': [47.975555, 607.12024, 288.5776, 629.1252], 'text': 'tened feature to the same shape as Ss.\\nwhere Re shape represents restoring the shape of the flat-', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp0jejzwwv.png'), 'layout_bbox': [48.383354, 637.581, 245.96404, 648.20496], 'paragraph_title': '4.3. Uncertainty-minimal Query Selection', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpushex416.png'), 'layout_bbox': [47.80134, 656.002, 288.50192, 713.24994], 'text': 'To reduce the difficulty of optimizing object queries in\\nDETR, several subsequent works [42, 44, 45] propose query\\nselection schemes, which have in common that they use the\\nconfidence score to select the top K\u2019 features from the en-\\ncoder to initialize object queries (or just position queries).', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpki7e_6wc.png'), 'layout_bbox': [306.6371, 302.1026, 546.3772, 419.76724], 'text': 'The confidence score represents the likelihood that the fea\\nture includes foreground objects. Nevertheless, the \\nare required to simultaneously model the category\\nojects, both of which determine the quality of the\\npertor\\ncore of the fes\\nBased on the analysis, the current query\\n considerable level of uncertainty in the\\nresulting in sub-optimal initialization for\\nand hindering the performance of the detector.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmppbxrfehp.png'), 'layout_bbox': [306.0642, 422.7347, 546.9216, 539.45734], 'text': 'To address this problem, we propose the uncertainty mini\\nmal query selection scheme, which explicitly const\\noptim\\n the epistemic uncertainty to model the\\nfeatures, thereby providing \\nhigh-quality\\nr the decoder. Specifically,\\n the discrepancy between i\\nalization P\\nand classificat\\n.(2\\ntunction for the gradie', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp1mgiyd21.png'), 'layout_bbox': [331.52808, 549.32635, 546.5229, 586.15546], 'formula': '\\\\begin{array}{c c c}{{}}&{{}}&{{\\\\begin{array}{c}{{i\\\\langle X\\\\rangle=({\\\\bar{Y}}({\\\\bar{X}})+{\\\\bar{Z}}({\\\\bar{X}})\\\\mid X\\\\in{\\\\bar{\\\\pi}}^{\\\\prime}}}&{{}}\\\\\\\\ {{}}&{{}}&{{}}\\\\end{array}}}&{{\\\\emptyset}}\\\\\\\\ {{}}&{{}}&{{C(\\\\bar{X},{\\\\bar{X}})=C..\\\\scriptstyle(\\\\bar{0},{\\\\bar{Y}})+{\\\\mathcal{L}}_{{\\\\mathrm{s}}}({\\\\bar{X}}),\\\\ 6)}}&{{}}\\\\end{array}', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp8t73dpym.png'), 'layout_bbox': [306.44016, 592.8762, 546.84314, 630.60126], 'text': 'where  and y denote the prediction and ground truth,\\n= (c, b), c and b represent the category and bounding\\nbox respectively, X represent the encoder feature.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpftnxeyjm.png'), 'layout_bbox': [306.15652, 632.3142, 546.2463, 713.19073], 'text': 'Effectiveness analysis. To analyze the effectiveness of the\\nuncertainty-minimal query selection, we visualize the clas-\\nsificatior\\nscores and IoU scores of the selected fe\\nCOCO\\na 12017, Figure 6. We draw the scatterplo\\nt with\\ndots\\nrepresent the selected features from the model trained\\nwith uncertainty-minimal query selection and vanilla query', 'layout': 'right'}]}\n

\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u89e3\u6790\u200b\u540e\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\uff0c\u200b\u76f8\u5173\u200b\u529f\u80fd\u200b\u652f\u6301\u200b\u4e2d\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u7ed3\u6784\u5316\u200b\u7684\u200bjson\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"layout_parsing\")\n\noutput = pipeline.predict(\"demo_paper.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200bhtml\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bimg\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u5176\u4e2d\u200b\uff0csave_to_img \u200b\u80fd\u591f\u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\uff08\u200b\u5305\u62ec\u200bOCR\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\uff09\uff0c save_to_html \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u76f4\u63a5\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\uff09\uff0csave_to_xlsx \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bExcel\u200b\u683c\u5f0f\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u683c\u5f0f\u200b\uff09\u3002

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/layout_parsing.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/layout_parsing.yaml\")\noutput = pipeline.predict(\"layout_parsing.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u4ea7\u7ebf\u200b\u5404\u4e2a\u200b\u5b50\u200b\u6a21\u5757\u200b\u7684\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200b\u7684\u200bxlsx\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u7684\u200bhtml\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u8fdb\u884c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u3002

POST /layout-parsing

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b file string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u6216\u200bPDF\u200b\u6587\u4ef6\u200b\u7684\u200bURL\uff0c\u200b\u6216\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u8d85\u8fc7\u200b10\u200b\u9875\u200b\u7684\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c\u200b\u53ea\u6709\u200b\u524d\u200b10\u200b\u9875\u200b\u7684\u200b\u5185\u5bb9\u200b\u4f1a\u200b\u88ab\u200b\u4f7f\u7528\u200b\u3002 \u200b\u662f\u200b fileType integer \u200b\u6587\u4ef6\u7c7b\u578b\u200b\u30020\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\uff0c1\u200b\u8868\u793a\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u3002\u200b\u82e5\u200b\u8bf7\u6c42\u200b\u4f53\u65e0\u6b64\u200b\u5c5e\u6027\u200b\uff0c\u200b\u5219\u200b\u670d\u52a1\u200b\u5c06\u200b\u5c1d\u8bd5\u200b\u6839\u636e\u200bURL\u200b\u81ea\u52a8\u200b\u63a8\u65ad\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u3002 \u200b\u5426\u200b useImgOrientationCls boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useImgUnwrapping boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b useSealTextDet boolean \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u529f\u80fd\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u542f\u7528\u200b\u8be5\u200b\u529f\u80fd\u200b\u3002 \u200b\u5426\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b layoutParsingResults array \u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u7ed3\u679c\u200b\u3002\u200b\u6570\u7ec4\u200b\u957f\u5ea6\u200b\u4e3a\u200b1\uff08\u200b\u5bf9\u4e8e\u200b\u56fe\u50cf\u200b\u8f93\u5165\u200b\uff09\u200b\u6216\u200b\u6587\u6863\u200b\u9875\u6570\u200b\u4e0e\u200b10\u200b\u4e2d\u200b\u7684\u200b\u8f83\u200b\u5c0f\u8005\u200b\uff08\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff09\u3002\u200b\u5bf9\u4e8e\u200bPDF\u200b\u8f93\u5165\u200b\uff0c\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u8868\u793a\u200bPDF\u200b\u6587\u4ef6\u200b\u4e2d\u200b\u6bcf\u200b\u4e00\u9875\u200b\u7684\u200b\u5904\u7406\u7ed3\u679c\u200b\u3002

layoutParsingResults\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b layoutElements array \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u4fe1\u606f\u200b\u3002

layoutElements\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 label string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u6807\u7b7e\u200b\u3002 text string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u5305\u542b\u200b\u7684\u200b\u6587\u672c\u200b\u3002 layoutType string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u6392\u5217\u200b\u65b9\u5f0f\u200b\u3002 image string \u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u56fe\u50cf\u200b\uff0cJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/layout-parsing\" # \u200b\u670d\u52a1\u200bURL\n\nimage_path = \"./demo.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": image_data, # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u6587\u4ef6\u200bURL\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(\"\\nDetected layout elements:\")\nfor res in result[\"layoutParsingResults\"]:\n    for ele in res[\"layoutElements\"]:\n        print(\"===============================\")\n        print(\"bbox:\", ele[\"bbox\"])\n        print(\"label:\", ele[\"label\"])\n        print(\"text:\", repr(ele[\"text\"]))\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b7\u200b\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u9519\u8bef\u200b\uff08\u200b\u5982\u200b\u884c\u5217\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\u3001\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u7248\u9762\u200b\u4e2d\u200b\u5b58\u5728\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff08\u200b\u4f8b\u5982\u200b\u5bf9\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u7684\u200b\u4f4d\u7f6e\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u516c\u5f0f\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b,\u200b\u5bf9\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u542b\u200b\u6587\u5b57\u200b\u533a\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u6216\u200b\u8bc1\u4ef6\u200b\u7684\u200b\u65b9\u5411\u200b\u5b58\u5728\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  table_model: SLANet_plus  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_server_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_server_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  formula_rec_model: LaTeX_OCR_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  seal_text_det_model: PP-OCRv4_server_seal_det   #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_unwarp_model: UVDoc  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  doc_image_ori_cls_model: PP-LCNet_x1_0_doc_ori  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200bnpu \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html","title":"\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#1","title":"1. \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u548c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u5185\u5bb9\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u8bc6\u522b\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u3001\u200b\u5370\u7ae0\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b PP-OCRv4_server_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.21 84.341 2425.06 109 PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b PP-OCRv4_mobile_seal_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 96.47 10.5878 131.813 4.6 PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b\u81ea\u5efa\u200b\u7684\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u5706\u5f62\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4\u200b\u7684\u200b\u79fb\u52a8\u200b\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u6548\u7387\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b PP-OCRv4_server_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M PP-OCRv4\u200b\u7684\u200b\u670d\u52a1\u7aef\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\uff0c\u200b\u9002\u5408\u200b\u5728\u200b\u8f83\u200b\u597d\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u4e0a\u200b\u90e8\u7f72\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b \uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#21","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path ./output\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device: \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n--save_path: \u200b\u8f93\u51fa\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config seal_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config seal_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./seal_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline seal_recognition.yaml --input seal_text_det.png --save_path ./output\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': 'seal_text_det.png', 'layout_result': {'input_path': 'seal_text_det.png', 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9813116192817688, 'coordinate': [0, 5.2238655, 639.59766, 637.6985]}]}, 'ocr_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmp19fn93y5.png'), 'dt_polys': [array([[468, 469],\n       [472, 469],\n       [477, 471],\n       [507, 501],\n       [509, 505],\n       [509, 509],\n       [508, 513],\n       [506, 514],\n       [456, 553],\n       [454, 555],\n       [391, 581],\n       [388, 581],\n       [309, 590],\n       [306, 590],\n       [234, 577],\n       [232, 577],\n       [172, 548],\n       [170, 546],\n       [121, 504],\n       [118, 501],\n       [118, 496],\n       [119, 492],\n       [121, 490],\n       [152, 463],\n       [156, 461],\n       [160, 461],\n       [164, 463],\n       [202, 495],\n       [252, 518],\n       [311, 530],\n       [371, 522],\n       [425, 501],\n       [464, 471]]), array([[442, 439],\n       [445, 442],\n       [447, 447],\n       [449, 490],\n       [448, 494],\n       [446, 497],\n       [440, 499],\n       [197, 500],\n       [193, 499],\n       [190, 496],\n       [188, 491],\n       [188, 448],\n       [189, 444],\n       [192, 441],\n       [197, 439],\n       [438, 438]]), array([[465, 341],\n       [470, 344],\n       [472, 346],\n       [476, 356],\n       [476, 419],\n       [475, 424],\n       [472, 428],\n       [467, 431],\n       [462, 433],\n       [175, 434],\n       [170, 433],\n       [166, 430],\n       [163, 426],\n       [161, 420],\n       [161, 354],\n       [162, 349],\n       [165, 345],\n       [170, 342],\n       [175, 340],\n       [460, 340]]), array([[326,  34],\n       [481,  85],\n       [485,  88],\n       [488,  90],\n       [584, 220],\n       [586, 225],\n       [587, 229],\n       [589, 378],\n       [588, 383],\n       [585, 388],\n       [581, 391],\n       [576, 393],\n       [570, 392],\n       [507, 373],\n       [502, 371],\n       [498, 367],\n       [496, 359],\n       [494, 255],\n       [423, 162],\n       [322, 129],\n       [246, 151],\n       [205, 169],\n       [144, 252],\n       [139, 360],\n       [137, 365],\n       [134, 369],\n       [128, 373],\n       [ 66, 391],\n       [ 61, 392],\n       [ 56, 390],\n       [ 51, 387],\n       [ 48, 382],\n       [ 47, 377],\n       [ 49, 230],\n       [ 50, 225],\n       [ 52, 221],\n       [149,  89],\n       [153,  86],\n       [157,  84],\n       [318,  34],\n       [322,  33]])], 'dt_scores': [0.9943362380813267, 0.9994290391836306, 0.9945320407374245, 0.9908104427126033], 'rec_text': ['5263647368706', '\u200b\u5417\u200b\u7e41\u7269\u200b', '\u200b\u53d1\u7968\u200b\u4e13\u7528\u7ae0\u200b', '\u200b\u5929\u6d25\u200b\u541b\u548c\u7f18\u200b\u5546\u8d38\u200b\u6709\u9650\u516c\u53f8\u200b'], 'rec_score': [0.9921098351478577, 0.997374951839447, 0.9999369382858276, 0.9901710152626038]}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4fdd\u5b58\u200b\u5728\u200b output \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"seal_recognition\")\n\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu enable_hpi \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b print \u200b\u6253\u5370\u200b\u7ed3\u679c\u200b\u5230\u200b\u7ec8\u7aef\u200b - format_json\uff1abool\u200b\u7c7b\u578b\u200b\uff0c\u200b\u662f\u5426\u200b\u5bf9\u200b\u8f93\u51fa\u200b\u5185\u5bb9\u200b\u8fdb\u884c\u200b\u4f7f\u7528\u200bjson\u200b\u7f29\u8fdb\u200b\u683c\u5f0f\u5316\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bTrue\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4ec5\u5f53\u200bformat_json\u200b\u4e3a\u200bTrue\u200b\u65f6\u200b\u6709\u6548\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_json \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bjson\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b- indent\uff1aint\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b4\uff1b- ensure_ascii\uff1abool\u200b\u7c7b\u578b\u200b\uff0cjson\u200b\u683c\u5f0f\u5316\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200bFalse\uff1b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u56fe\u50cf\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/seal_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/seal_recognition.yaml\")\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u83b7\u53d6\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002

POST /seal-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b texts array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3001\u200b\u5185\u5bb9\u200b\u548c\u200b\u5f97\u5206\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

texts\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b poly array \u200b\u6587\u672c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u5305\u56f4\u200b\u6587\u672c\u200b\u7684\u200b\u591a\u8fb9\u5f62\u200b\u7684\u200b\u9876\u70b9\u200b\u5750\u6807\u200b\u3002 text string \u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u3002 score number \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5f97\u5206\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/seal-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/seal-recognition\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/seal-recognition\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/seal-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/seal-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/seal-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/seal-recognition\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u4e09\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u5370\u7ae0\u200b\u533a\u57df\u200b\u5728\u200b\u6574\u4f53\u200b\u7248\u9762\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  layout_model: RT-DETR-H_layout_3cls #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_server_seal_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_server_rec #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200bnpu \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline seal_recognition --input seal_text_det.png --device npu:0 --save_path output\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html","title":"\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#1","title":"1. \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u636e\u5f55\u5165\u200b\u3001\u200b\u4fe1\u606f\u68c0\u7d22\u200b\u548c\u200b\u6587\u6863\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002

\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3001\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u3001\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u3002

\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\ud83d\udc49\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\u8be6\u60c5\u200b

\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) \u200b\u4ecb\u7ecd\u200b SLANet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 59.52 522.536 1845.37 6.9 M SLANet \u200b\u662f\u200b\u767e\u5ea6\u200b\u98de\u6868\u200b\u89c6\u89c9\u200b\u56e2\u961f\u200b\u81ea\u7814\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u3002\u200b\u8be5\u200b\u6a21\u578b\u200b\u901a\u8fc7\u200b\u91c7\u7528\u200bCPU \u200b\u53cb\u597d\u200b\u578b\u200b\u8f7b\u91cf\u7ea7\u200b\u9aa8\u5e72\u200b\u7f51\u7edc\u200bPP-LCNet\u3001\u200b\u9ad8\u4f4e\u200b\u5c42\u200b\u7279\u5f81\u200b\u878d\u5408\u200b\u6a21\u5757\u200bCSP-PAN\u3001\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u4f4d\u7f6e\u200b\u4fe1\u606f\u200b\u5bf9\u9f50\u200b\u7684\u200b\u7279\u5f81\u200b\u89e3\u7801\u200b\u6a21\u5757\u200bSLA Head\uff0c\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u4e86\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u548c\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u3002 SLANet_plus\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 63.69 522.536 1845.37 6.9 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200bPaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) PP-OCRv4_mobile_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 77.79 10.6923 120.177 4.2 M PP-OCRv4_server_det\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 82.69 83.3501 2434.01 100.1M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u6a21\u578b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) PP-OCRv4_mobile_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 78.20 7.95018 46.7868 10.6 M PP-OCRv4_server_rec\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 79.20 7.19439 140.179 71.2 M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b \uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21_1","title":"2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u7247\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config table_recognition\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config table_recognition --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./table_recognition.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./table_recognition.yaml --input table_recognition.jpg --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
{'input_path': 'table_recognition.jpg', 'layout_result': {'input_path': 'table_recognition.jpg', 'boxes': [{'cls_id': 3, 'label': 'Table', 'score': 0.6014542579650879, 'coordinate': [0, 21, 551, 118]}]}, 'ocr_result': {'dt_polys': [array([[37., 40.],\n       [75., 40.],\n       [75., 60.],\n       [37., 60.]], dtype=float32), array([[123.,  37.],\n       [200.,  37.],\n       [200.,  59.],\n       [123.,  59.]], dtype=float32), array([[227.,  37.],\n       [391.,  37.],\n       [391.,  58.],\n       [227.,  58.]], dtype=float32), array([[416.,  36.],\n       [535.,  38.],\n       [535.,  61.],\n       [415.,  58.]], dtype=float32), array([[35., 73.],\n       [78., 73.],\n       [78., 92.],\n       [35., 92.]], dtype=float32), array([[287.,  73.],\n       [328.,  73.],\n       [328.,  92.],\n       [287.,  92.]], dtype=float32), array([[453.,  72.],\n       [495.,  72.],\n       [495.,  94.],\n       [453.,  94.]], dtype=float32), array([[ 17., 103.],\n       [ 94., 103.],\n       [ 94., 118.],\n       [ 17., 118.]], dtype=float32), array([[145., 104.],\n       [178., 104.],\n       [178., 118.],\n       [145., 118.]], dtype=float32), array([[277., 104.],\n       [337., 102.],\n       [338., 118.],\n       [278., 118.]], dtype=float32), array([[446., 102.],\n       [504., 104.],\n       [503., 118.],\n       [445., 118.]], dtype=float32)], 'rec_text': ['Dres', '\u200b\u8fde\u7eed\u200b\u5de5\u4f5c\u200b3', '\u200b\u53d6\u51fa\u200b\u6765\u200b\u653e\u5728\u200b\u7f51\u4e0a\u200b\uff0c\u200b\u6ca1\u200b\u60f3\u200b', '\u200b\u6c5f\u200b\u3001\u200b\u6574\u6c5f\u200b\u7b49\u200b\u516b\u5927\u200b', 'Abstr', 'rSrivi', '$709.', 'cludingGiv', '2.72', 'Ingcubic', '$744.78'], 'rec_score': [0.9934158325195312, 0.9990204572677612, 0.9967061877250671, 0.9375461935997009, 0.9947397112846375, 0.9972746968269348, 0.9904290437698364, 0.973427414894104, 0.9983080625534058, 0.993423342704773, 0.9964120984077454], 'input_path': 'table_recognition.jpg'}, 'table_result': [{'input_path': 'table_recognition.jpg', 'layout_bbox': [0, 21, 551, 118], 'bbox': array([[  4.395736 ,  25.238262 , 113.31014  ,  25.316246 , 115.454315 ,\n         71.8867   ,   3.7177477,  71.7937   ],\n       [110.727455 ,  25.94007  , 210.07187  ,  26.028755 , 209.66394  ,\n         65.96484  , 109.59861  ,  66.09809  ],\n       [214.45381  ,  26.027939 , 407.95276  ,  26.112846 , 409.6684   ,\n         66.91336  , 215.27292  ,  67.002014 ],\n       [402.81863  ,  26.123789 , 549.03656  ,  26.231564 , 549.19995  ,\n         66.88339  , 404.48068  ,  66.74034  ],\n       [  2.4458022,  64.68588  , 102.7665   ,  65.10228  , 105.79447  ,\n         96.051254 ,   2.5367072,  95.35514  ],\n       [108.85877  ,  65.80549  , 211.70216  ,  66.02091  , 210.79245  ,\n         94.75581  , 107.59308  ,  94.42664  ],\n       [217.05621  ,  64.98496  , 407.76328  ,  65.133484 , 406.8436   ,\n         96.00133  , 214.67896  ,  95.87226  ],\n       [401.73572  ,  64.60494  , 547.9967   ,  64.73921  , 548.19135  ,\n         96.09901  , 402.26733  ,  95.95529  ],\n       [  2.4882016,  93.589554 , 107.01325  ,  93.67592  , 107.8446   ,\n        120.13259  ,   2.508764 , 119.85027  ],\n       [110.773125 ,  93.98633  , 213.354    ,  94.08046  , 212.46033  ,\n        120.80207  , 109.29008  , 120.613045 ],\n       [216.08781  ,  94.19984  , 405.843    ,  94.28341  , 405.9974   ,\n        121.33152  , 215.10301  , 121.299034 ],\n       [403.92212  ,  94.44883  , 548.30963  ,  94.54982  , 548.4949   ,\n        122.610176 , 404.53433  , 122.49881  ]], dtype=float32), 'img_idx': 0, 'html': '<html><body><table><tr><td>Dres</td><td>\u200b\u8fde\u7eed\u200b\u5de5\u4f5c\u200b3</td><td>\u200b\u53d6\u51fa\u200b\u6765\u200b\u653e\u5728\u200b\u7f51\u4e0a\u200b\uff0c\u200b\u6ca1\u200b\u60f3\u200b</td><td>\u200b\u6c5f\u200b\u3001\u200b\u6574\u6c5f\u200b\u7b49\u200b\u516b\u5927\u200b</td></tr><tr><td>Abstr</td><td></td><td>rSrivi</td><td>$709.</td></tr><tr><td>cludingGiv</td><td>2.72</td><td>Ingcubic</td><td>$744.78</td></tr></table></body></html>'}]}\n

\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u9ed8\u8ba4\u200b\u4e0d\u200b\u8fdb\u884c\u200b\u4fdd\u5b58\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b --save_path \u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u968f\u540e\u200b\u6240\u6709\u200b\u7ed3\u679c\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u8def\u5f84\u200b\u4e0b\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-python","title":"2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"table_recognition\")\n\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200bhtml\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_img \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bimg\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u5176\u4e2d\u200b\uff0csave_to_img \u200b\u80fd\u591f\u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\uff08\u200b\u5305\u62ec\u200bOCR\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u56fe\u7247\u200b\uff09\uff0c save_to_html \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u76f4\u63a5\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\uff09\uff0csave_to_xlsx \u200b\u80fd\u591f\u200b\u5c06\u200b\u8868\u683c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bExcel\u200b\u683c\u5f0f\u6587\u4ef6\u200b\uff08\u200b\u5305\u62ec\u200b\u6587\u672c\u200b\u548c\u200b\u683c\u5f0f\u200b\uff09\u3002

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/table_recognition.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/table_recognition.yaml\")\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200bimg\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_xlsx(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n    res.save_to_html(\"./output/\") ## \u200b\u4fdd\u5b58\u200bhtml\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u8bc6\u522b\u200b\u56fe\u4e2d\u200b\u7684\u200b\u8868\u683c\u200b\u3002

POST /table-recognition

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b image string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002 \u200b\u662f\u200b inferenceParams object \u200b\u63a8\u7406\u200b\u53c2\u6570\u200b\u3002 \u200b\u5426\u200b

inferenceParams\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b maxLongSide integer \u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u82e5\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u5927\u4e8e\u200bmaxLongSide\uff0c\u200b\u5219\u200b\u5c06\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u7f29\u653e\u200b\uff0c\u200b\u4f7f\u200b\u5176\u200b\u8f83\u200b\u957f\u8fb9\u200b\u7684\u200b\u957f\u5ea6\u200b\u7b49\u4e8e\u200bmaxLongSide\u3002 \u200b\u5426\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b tables array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u548c\u200b\u5185\u5bb9\u200b\u3002 layoutImage string \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002 ocrImage string OCR\u200b\u7ed3\u679c\u200b\u56fe\u200b\u3002\u200b\u56fe\u50cf\u200b\u4e3a\u200bJPEG\u200b\u683c\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200bBase64\u200b\u7f16\u7801\u200b\u3002

tables\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u5143\u7d20\u200b\u4e3a\u200b\u4e00\u4e2a\u200bobject\uff0c\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b bbox array \u200b\u8868\u683c\u200b\u4f4d\u7f6e\u200b\u3002\u200b\u6570\u7ec4\u200b\u4e2d\u200b\u5143\u7d20\u200b\u4f9d\u6b21\u200b\u4e3a\u200b\u8fb9\u754c\u200b\u6846\u200b\u5de6\u4e0a\u89d2\u200bx\u200b\u5750\u6807\u200b\u3001\u200b\u5de6\u4e0a\u89d2\u200by\u200b\u5750\u6807\u200b\u3001\u200b\u53f3\u4e0b\u89d2\u200bx\u200b\u5750\u6807\u200b\u4ee5\u53ca\u200b\u53f3\u4e0b\u89d2\u200by\u200b\u5750\u6807\u200b\u3002 html string HTML\u200b\u683c\u5f0f\u200b\u7684\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u3002 \u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/table-recognition\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected tables:\")\nprint(result[\"tables\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/table-recognition\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto tables = result[\"tables\"];\n        std::cout << \"\\nDetected tables:\" << std::endl;\n        for (const auto& table : tables) {\n            std::cout << table << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/table-recognition\"; // \u200b\u670d\u52a1\u200bURL\n        String imagePath = \"./demo.jpg\"; // \u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode tables = result.get(\"tables\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected tables: \" + tables.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/table-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Tables []map[string]interface{} `json:\"tables\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected tables:\")\n    for _, table := range respData.Result.Tables {\n        fmt.Println(table)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/table-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected tables:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"tables\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/table-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n  })\n};\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// \u200b\u8c03\u7528\u200bAPI\naxios.request(config)\n.then((response) => {\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected tables:\");\n    console.log(result[\"tables\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/table-recognition\"; // \u200b\u670d\u52a1\u200bURL\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected tables:\\n\";\nprint_r($result[\"tables\"]);\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u56db\u4e2a\u200b\u6a21\u5757\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\u53ef\u80fd\u200b\u6765\u81ea\u200b\u4e8e\u200b\u5176\u4e2d\u200b\u4efb\u4f55\u200b\u4e00\u4e2a\u200b\u6a21\u5757\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u5dee\u200b\u7684\u200b\u56fe\u7247\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\uff0c\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u89c4\u5219\u200b\u8fdb\u884c\u200b\u5206\u6790\u200b\u548c\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\uff1a

  • \u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u9519\u8bef\u200b\uff08\u200b\u5982\u200b\u884c\u5217\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\u3001\u200b\u5355\u5143\u683c\u200b\u4f4d\u7f6e\u200b\u9519\u8bef\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u8868\u683c\u200b\u533a\u57df\u200b\u5728\u200b\u6574\u4f53\u200b\u7248\u9762\u200b\u4e2d\u200b\u5b9a\u4f4d\u200b\u9519\u8bef\u200b\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u5757\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u6709\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u6587\u672c\u200b\u672a\u200b\u88ab\u200b\u68c0\u6d4b\u200b\u51fa\u6765\u200b\uff08\u200b\u5373\u200b\u6587\u672c\u200b\u6f0f\u68c0\u200b\u73b0\u8c61\u200b\uff09\uff0c\u200b\u90a3\u4e48\u200b\u53ef\u80fd\u200b\u662f\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u5b58\u5728\u200b\u4e0d\u8db3\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
  • \u200b\u5df2\u200b\u68c0\u6d4b\u200b\u5230\u200b\u7684\u200b\u6587\u672c\u200b\u4e2d\u200b\u51fa\u73b0\u200b\u8f83\u200b\u591a\u200b\u7684\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff08\u200b\u5373\u200b\u8bc6\u522b\u200b\u51fa\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0e\u200b\u5b9e\u9645\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u4e0d\u7b26\u200b\uff09\uff0c\u200b\u8fd9\u200b\u8868\u660e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9700\u8981\u200b\u8fdb\u4e00\u6b65\u200b\u6539\u8fdb\u200b\uff0c\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\u5bf9\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002
"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  table_model: SLANet  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_det_model: PP-OCRv4_mobile_det  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  text_rec_model: PP-OCRv4_mobile_rec  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200bnpu \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline table_recognition --input table_recognition.jpg --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#1","title":"1. \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u8bc6\u522b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u6a21\u5f0f\u200b\u6216\u200b\u884c\u4e3a\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7f51\u7edc\u5b89\u5168\u200b\u3001\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u548c\u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6b63\u5e38\u200b\u8d8b\u52bf\u200b\u548c\u200b\u89c4\u5f8b\u200b\uff0c\u200b\u6765\u200b\u53d1\u73b0\u200b\u4e0e\u200b\u9884\u671f\u200b\u884c\u4e3a\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u7a81\u7136\u200b\u589e\u52a0\u200b\u7684\u200b\u7f51\u7edc\u6d41\u91cf\u200b\u6216\u200b\u5f02\u5e38\u200b\u7684\u200b\u4ea4\u6613\u200b\u6d3b\u52a8\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u63d0\u4f9b\u200b\u5b9e\u65f6\u200b\u8b66\u62a5\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u53ca\u65f6\u200b\u5e94\u5bf9\u200b\u6f5c\u5728\u200b\u98ce\u9669\u200b\u548c\u200b\u95ee\u9898\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u4fdd\u969c\u7cfb\u7edf\u200b\u7a33\u5b9a\u6027\u200b\u548c\u200b\u5b89\u5168\u6027\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002

\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) AutoEncoder_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 99.36 84.36 91.25 52K DLinear_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.98 93.96 96.41 112K Nonstationary_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.55 88.95 93.51 1.8M PatchTST_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.78 90.70 94.57 320K TimesNet_ad\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 98.37 94.80 96.56 1.3M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PSM \u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config ts_ad\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config ts_ad --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b--pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ts_ad.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ts_ad.yaml --input ts_ad.cs --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'ts_ad.csv', 'anomaly':            label\ntimestamp\n220226         0\n220227         0\n220228         0\n220229         0\n220230         0\n...          ...\n220317         1\n220318         1\n220319         1\n220320         1\n220321         0\n\n[96 rows x 1 columns]}\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_ad\")\n\noutput = pipeline.predict(\"ts_ad.cs\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_csv \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bcsv\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/ts_ad.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_ad.yaml\")\noutput = pipeline.predict(\"ts_ad.cs\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3002

POST /time-series-anomaly-detection

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b csv string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200bCSV\u200b\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200bCSV\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002CSV\u200b\u6587\u4ef6\u200b\u9700\u8981\u200b\u4f7f\u7528\u200bUTF-8\u200b\u7f16\u7801\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b csv string CSV\u200b\u683c\u5f0f\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\u3002\u200b\u4f7f\u7528\u200bUTF-8+Base64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"csv\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-anomaly-detection\" # \u200b\u670d\u52a1\u200bURL\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/time-series-anomaly-detection\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        // \u200b\u4fdd\u5b58\u200b\u6570\u636e\u200b\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                // \u200b\u4fdd\u5b58\u200b\u8fd4\u56de\u200b\u7684\u200b\u6570\u636e\u200b\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-anomaly-detection\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    // \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    // \u200b\u5c06\u200bBase64\u200b\u7f16\u7801\u200b\u7684\u200bcsv\u200b\u6570\u636e\u200b\u89e3\u7801\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-anomaly-detection'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n  })\n};\n\n// \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8f6c\u6362\u200b\u4e3a\u200bBase64\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-anomaly-detection\"; // \u200b\u670d\u52a1\u200bURL\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: DLinear_ad  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  batch_size: 1\n  device: \"gpu:0\"\n......\n

\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline ts_ad --input ts_ad.cs --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b--device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline ts_ad --input ts_ad.cs --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#1","title":"1. \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u5f52\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u884c\u4e3a\u200b\u8bc6\u522b\u200b\u3001\u200b\u91d1\u878d\u200b\u8d8b\u52bf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5f0f\u200b\u6216\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5c06\u200b\u4e00\u6bb5\u200b\u8bed\u97f3\u200b\u4fe1\u53f7\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u95ee\u5019\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u8bf7\u6c42\u200b\u201d\uff0c\u200b\u6216\u200b\u5c06\u200b\u80a1\u7968\u4ef7\u683c\u200b\u8d70\u52bf\u200b\u5212\u5206\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u6355\u6349\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\u548c\u200b\u53d8\u5316\u89c4\u5f8b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u6570\u636e\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u76d1\u63a7\u200b\u3001\u200b\u5e02\u573a\u9884\u6d4b\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u8d77\u200b\u7740\u200b\u5173\u952e\u4f5c\u7528\u200b\u3002

\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) TimesNet_cls\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 87.5 792K

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b UWaveGestureLibrary \u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_yaml ts_cls\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path\uff09\uff1a

paddlex --get_pipeline_config ts_cls --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ts_cls.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ts_cls.yaml --input ts_cls.csv --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'ts_cls.csv', 'classification':         classid     score\nsample\n0             0  0.617688}\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_cls\")\n\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_csv \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bcsv\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/ts_cls.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_forecast.yaml\")\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\u3002

POST /time-series-classification

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b csv string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200bCSV\u200b\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200bCSV\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002CSV\u200b\u6587\u4ef6\u200b\u9700\u8981\u200b\u4f7f\u7528\u200bUTF-8\u200b\u7f16\u7801\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b label string \u200b\u7c7b\u522b\u200b\u6807\u7b7e\u200b\u3002 score number \u200b\u7c7b\u522b\u200b\u5f97\u5206\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"label\": \"running\",\n\"score\": 0.97\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-classification\" # \u200b\u670d\u52a1\u200bURL\ncsv_path = \"./test.csv\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(f\"label: {result['label']}, score: {result['score']}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/time-series-classification\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n        std::cout << \"label: \" << result[\"label\"] << \", score: \" << result[\"score\"] << std::endl;\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-classification\";\n        String csvPath = \"./test.csv\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                System.out.println(\"label: \" + result.get(\"label\").asText() + \", score: \" + result.get(\"score\").asText());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-classification\"\n    csvPath := \"./test.csv\";\n\n    // \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Label string `json:\"label\"`\n            Score string `json:\"score\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    fmt.Printf(\"label: %s, score: %s\\n\", respData.Result.Label, respData.Result.Score)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-classification\";\n    static readonly string csvPath = \"./test.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] csveBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csveBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string label = jsonResponse[\"result\"][\"label\"].ToString();\n        string score = jsonResponse[\"result\"][\"score\"].ToString();\n        Console.WriteLine($\"label: {label}, score: {score}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-classification'\nconst csvPath = \"./test.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n  })\n};\n\n// \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8f6c\u6362\u200b\u4e3a\u200bBase64\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    console.log(`label: ${result[\"label\"]}, score: ${result[\"score\"]}`);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-classification\"; // \u200b\u670d\u52a1\u200bURL\n$csv_path = \"./test.csv\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\necho \"label: \" . $result[\"label\"] . \", score: \" . $result[\"score\"];\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: TimesNet_cls  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 1\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u8fdb\u884c\u200b\u4fee\u6539\u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline ts_cls --input ts_cls.csv --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b","text":""},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#1","title":"1. \u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd","text":"

\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002

\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u5305\u542b\u200b\u4e86\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

\u200b\u6a21\u578b\u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) DLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.382 0.394 72K NLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.386 0.392 40K Nonstationary\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.600 0.515 55.5 M PatchTST\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.385 0.397 2.0M RLinear\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.384 0.392 40K TiDE\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.405 0.412 31.7M TimesNet\u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b 0.417 0.431 4.9M

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b ETTH1\u3002\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#2","title":"2. \u200b\u5feb\u901f\u200b\u5f00\u59cb","text":"

PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9884\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u53ef\u4ee5\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u6548\u679c\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u547d\u4ee4\u884c\u200b\u6216\u200b Python \u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#21","title":"2.1 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7528\u200b\u5b98\u65b9\u200b\u63d0\u4f9b\u200b\u7684\u200b demo \u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a

\u200b\u5982\u679c\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u8fd0\u884c\u200b\u7684\u200b\u6548\u679c\u200b\u6ee1\u610f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5bf9\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u96c6\u6210\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5982\u679c\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5229\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5bf9\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u5fae\u8c03\u200b\u3002

\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#22","title":"2.2 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#221","title":"2.2.1 \u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u4f53\u9a8c","text":"

\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\u5373\u53ef\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u6548\u679c\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b --input \u200b\u66ff\u6362\u200b\u4e3a\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\uff1a

--pipeline\uff1a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\n--input\uff1a\u200b\u5f85\u5904\u7406\u200b\u7684\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u6216\u200bURL\n--device \u200b\u4f7f\u7528\u200b\u7684\u200bGPU\u200b\u5e8f\u53f7\u200b\uff08\u200b\u4f8b\u5982\u200bgpu:0\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b0\u200b\u5757\u200bGPU\uff0cgpu:1,2\u200b\u8868\u793a\u200b\u4f7f\u7528\u200b\u7b2c\u200b1\u30012\u200b\u5757\u200bGPU\uff09\uff0c\u200b\u4e5f\u200b\u53ef\u200b\u9009\u62e9\u200b\u4f7f\u7528\u200bCPU\uff08--device cpu\uff09\n

\u200b\u5728\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u65f6\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u7684\u200b\u662f\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u81ea\u5b9a\u4e49\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\uff1a

\ud83d\udc49\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b
paddlex --get_pipeline_config ts_fc\n

\u200b\u6267\u884c\u200b\u540e\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5c06\u200b\u88ab\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u200b\u8def\u5f84\u200b\u3002\u200b\u82e5\u200b\u60a8\u200b\u5e0c\u671b\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u53ef\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u547d\u4ee4\u200b\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config ts_fc --save_path ./my_path\n

\u200b\u83b7\u53d6\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u5c06\u200b --pipeline \u200b\u66ff\u6362\u200b\u4e3a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u751f\u6548\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\u4e3a\u200b ./ts_fc.yaml\uff0c\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

paddlex --pipeline ./ts_fc.yaml --input ts_fc.csv --device gpu:0\n

\u200b\u5176\u4e2d\u200b\uff0c--model\u3001--device \u200b\u7b49\u200b\u53c2\u6570\u200b\u65e0\u9700\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5c06\u200b\u4f7f\u7528\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u53c2\u6570\u200b\u3002\u200b\u82e5\u200b\u4f9d\u7136\u200b\u6307\u5b9a\u200b\u4e86\u200b\u53c2\u6570\u200b\uff0c\u200b\u5c06\u200b\u4ee5\u200b\u6307\u5b9a\u200b\u7684\u200b\u53c2\u6570\u200b\u4e3a\u51c6\u200b\u3002

\u200b\u8fd0\u884c\u200b\u540e\u200b\uff0c\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e3a\u200b\uff1a

{'input_path': 'ts_fc.csv', 'forecast':                            OT\ndate\n2018-06-26 20:00:00  9.586131\n2018-06-26 21:00:00  9.379762\n2018-06-26 22:00:00  9.252275\n2018-06-26 23:00:00  9.249993\n2018-06-27 00:00:00  9.164998\n...                       ...\n2018-06-30 15:00:00  8.830340\n2018-06-30 16:00:00  9.291553\n2018-06-30 17:00:00  9.097666\n2018-06-30 18:00:00  8.905430\n2018-06-30 19:00:00  8.993793\n\n[96 rows x 1 columns]}\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#222-python","title":"2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u96c6\u6210","text":"

\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_fc\")\n\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
\u200b\u5f97\u5230\u200b\u7684\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u76f8\u540c\u200b\u3002

\u200b\u5728\u200b\u4e0a\u8ff0\u200b Python \u200b\u811a\u672c\u200b\u4e2d\u200b\uff0c\u200b\u6267\u884c\u200b\u4e86\u200b\u5982\u4e0b\u200b\u51e0\u4e2a\u200b\u6b65\u9aa4\u200b\uff1a

\uff081\uff09\u200b\u5b9e\u4f8b\u200b\u5316\u200b create_pipeline \u200b\u5b9e\u4f8b\u200b\u5316\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\uff1a\u200b\u5177\u4f53\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b \u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u9ed8\u8ba4\u503c\u200b pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u662f\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002\u200b\u5982\u4e3a\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b PaddleX \u200b\u6240\u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u3002 str \u200b\u65e0\u200b device \u200b\u4ea7\u7ebf\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u8bbe\u5907\u200b\u3002\u200b\u652f\u6301\u200b\uff1a\u201cgpu\u201d\uff0c\u201ccpu\u201d\u3002 str gpu use_hpip \u200b\u662f\u5426\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff0c\u200b\u4ec5\u200b\u5f53\u8be5\u200b\u4ea7\u7ebf\u200b\u652f\u6301\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u65f6\u200b\u53ef\u7528\u200b\u3002 bool False

\uff082\uff09\u200b\u8c03\u7528\u200b\u4ea7\u7ebf\u200b\u5bf9\u8c61\u200b\u7684\u200b predict \u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b\u4e3a\u200bx\uff0c\u200b\u7528\u4e8e\u200b\u8f93\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u200b\uff0c\u200b\u652f\u6301\u200b\u591a\u79cd\u200b\u8f93\u5165\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u5177\u4f53\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u53c2\u6570\u200b\u7c7b\u578b\u200b \u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b Python Var \u200b\u652f\u6301\u200b\u76f4\u63a5\u200b\u4f20\u5165\u200bPython\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200bnumpy.ndarray\u200b\u8868\u793a\u200b\u7684\u200b\u56fe\u50cf\u200b\u6570\u636e\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/img.jpg\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200bURL\uff0c\u200b\u5982\u200b\u56fe\u50cf\u6587\u4ef6\u200b\u7684\u200b\u7f51\u7edc\u200bURL\uff1a\u200b\u793a\u4f8b\u200b\u3002 str \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u672c\u5730\u200b\u76ee\u5f55\u200b\uff0c\u200b\u8be5\u200b\u76ee\u5f55\u200b\u4e0b\u200b\u9700\u200b\u5305\u542b\u200b\u5f85\u200b\u9884\u6d4b\u200b\u6570\u636e\u6587\u4ef6\u200b\uff0c\u200b\u5982\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\uff1a/root/data/\u3002 dict \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5b57\u5178\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bkey\u200b\u9700\u200b\u4e0e\u200b\u5177\u4f53\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\uff0c\u200b\u5982\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u5bf9\u5e94\u200b\\\"img\\\"\uff0c\u200b\u5b57\u5178\u200b\u7684\u200bval\u200b\u652f\u6301\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u4f8b\u5982\u200b\uff1a{\\\"img\\\": \\\"/root/data1\\\"}\u3002 list \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u5217\u8868\u200b\uff0c\u200b\u5217\u8868\u200b\u5143\u7d20\u200b\u9700\u4e3a\u200b\u4e0a\u8ff0\u200b\u7c7b\u578b\u200b\u6570\u636e\u200b\uff0c\u200b\u5982\u200b[numpy.ndarray, numpy.ndarray]\uff0c[\\\"/root/data/img1.jpg\\\", \\\"/root/data/img2.jpg\\\"]\uff0c[\\\"/root/data1\\\", \\\"/root/data2\\\"]\uff0c[{\\\"img\\\": \\\"/root/data1\\\"}, {\\\"img\\\": \\\"/root/data2/img.jpg\\\"}]\u3002

\uff083\uff09\u200b\u8c03\u7528\u200bpredict\u200b\u65b9\u6cd5\u200b\u83b7\u53d6\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff1apredict \u200b\u65b9\u6cd5\u200b\u4e3a\u200bgenerator\uff0c\u200b\u56e0\u6b64\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8c03\u7528\u200b\u83b7\u5f97\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0cpredict\u200b\u65b9\u6cd5\u200b\u4ee5\u200bbatch\u200b\u4e3a\u200b\u5355\u4f4d\u200b\u5bf9\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4e3a\u200blist\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u7684\u200b\u4e00\u7ec4\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002

\uff084\uff09\u200b\u5bf9\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u8fdb\u884c\u200b\u5904\u7406\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5747\u200b\u4e3a\u200bdict\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4e14\u200b\u652f\u6301\u200b\u6253\u5370\u200b\uff0c\u200b\u6216\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\uff0c\u200b\u652f\u6301\u200b\u4fdd\u5b58\u200b\u7684\u200b\u7c7b\u578b\u200b\u4e0e\u200b\u5177\u4f53\u200b\u4ea7\u7ebf\u200b\u76f8\u5173\u200b\uff0c\u200b\u5982\u200b\uff1a

\u200b\u65b9\u6cd5\u200b \u200b\u8bf4\u660e\u200b \u200b\u65b9\u6cd5\u200b\u53c2\u6570\u200b save_to_csv \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bcsv\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_html \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200bhtml\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b save_to_xlsx \u200b\u5c06\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u8868\u683c\u200b\u683c\u5f0f\u200b\u7684\u200b\u6587\u4ef6\u200b - save_path\uff1astr\u200b\u7c7b\u578b\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u7684\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u5f53\u4e3a\u200b\u76ee\u5f55\u200b\u65f6\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u6587\u4ef6\u200b\u547d\u540d\u200b\u4e0e\u200b\u8f93\u5165\u200b\u6587\u4ef6\u7c7b\u578b\u200b\u547d\u540d\u200b\u4e00\u81f4\u200b\uff1b

\u200b\u82e5\u200b\u60a8\u200b\u83b7\u53d6\u200b\u4e86\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u5373\u53ef\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u5404\u9879\u200b\u914d\u7f6e\u200b\u8fdb\u884c\u200b\u81ea\u5b9a\u4e49\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./my_path/ts_fc.yaml \uff0c\u200b\u5219\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_fc.yaml\")\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") ## \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#3","title":"3. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200bPython\u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b 2.2.2 Python\u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\u4e2d\u200b\u7684\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\u3002

\u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

\ud83d\ude80 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

\u2601\ufe0f \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u4e0b\u9762\u200b\u662f\u200bAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u591a\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff1a

API\u200b\u53c2\u8003\u200b

\u200b\u5bf9\u4e8e\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\uff1a

  • HTTP\u200b\u8bf7\u6c42\u200b\u65b9\u6cd5\u200b\u4e3a\u200bPOST\u3002
  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u548c\u200b\u54cd\u5e94\u200b\u4f53\u5747\u200b\u4e3a\u200bJSON\u200b\u6570\u636e\u200b\uff08JSON\u200b\u5bf9\u8c61\u200b\uff09\u3002
  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u4e3a\u200b200\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b0\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002\u200b\u56fa\u5b9a\u200b\u4e3a\u200b\"Success\"\u3002

\u200b\u54cd\u5e94\u200b\u4f53\u200b\u8fd8\u200b\u53ef\u80fd\u200b\u6709\u200bresult\u200b\u5c5e\u6027\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200bobject\uff0c\u200b\u5176\u4e2d\u200b\u5b58\u50a8\u200b\u64cd\u4f5c\u200b\u7ed3\u679c\u200b\u4fe1\u606f\u200b\u3002

  • \u200b\u5f53\u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u672a\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b errorCode integer \u200b\u9519\u8bef\u7801\u200b\u3002\u200b\u4e0e\u200b\u54cd\u5e94\u200b\u72b6\u6001\u200b\u7801\u200b\u76f8\u540c\u200b\u3002 errorMsg string \u200b\u9519\u8bef\u200b\u8bf4\u660e\u200b\u3002

\u200b\u670d\u52a1\u200b\u63d0\u4f9b\u200b\u7684\u200b\u4e3b\u8981\u200b\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

  • infer

\u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u3002

POST /time-series-forecasting

  • \u200b\u8bf7\u6c42\u200b\u4f53\u200b\u7684\u200b\u5c5e\u6027\u200b\u5982\u4e0b\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b \u200b\u662f\u5426\u200b\u5fc5\u586b\u200b csv string \u200b\u670d\u52a1\u200b\u53ef\u200b\u8bbf\u95ee\u200b\u7684\u200bCSV\u200b\u6587\u4ef6\u200b\u7684\u200bURL\u200b\u6216\u200bCSV\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u7684\u200bBase64\u200b\u7f16\u7801\u200b\u7ed3\u679c\u200b\u3002CSV\u200b\u6587\u4ef6\u200b\u9700\u8981\u200b\u4f7f\u7528\u200bUTF-8\u200b\u7f16\u7801\u200b\u3002 \u200b\u662f\u200b
  • \u200b\u8bf7\u6c42\u200b\u5904\u7406\u200b\u6210\u529f\u200b\u65f6\u200b\uff0c\u200b\u54cd\u5e94\u200b\u4f53\u200b\u7684\u200bresult\u200b\u5177\u6709\u200b\u5982\u4e0b\u200b\u5c5e\u6027\u200b\uff1a
\u200b\u540d\u79f0\u200b \u200b\u7c7b\u578b\u200b \u200b\u542b\u4e49\u200b csv string CSV\u200b\u683c\u5f0f\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002\u200b\u4f7f\u7528\u200bUTF-8+Base64\u200b\u7f16\u7801\u200b\u3002

result\u200b\u793a\u4f8b\u200b\u5982\u4e0b\u200b\uff1a

{\n\"csv\": \"xxxxxx\"\n}\n
\u200b\u591a\u200b\u8bed\u8a00\u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\u793a\u4f8b\u200b Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-forecasting\" # \u200b\u670d\u52a1\u200bURL\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // \u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    // \u200b\u8c03\u7528\u200bAPI\n    auto response = client.Post(\"/time-series-forecasting\", headers, body, \"application/json\");\n    // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        // \u200b\u4fdd\u5b58\u200b\u6570\u636e\u200b\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-forecasting\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        // \u200b\u521b\u5efa\u200b OkHttpClient \u200b\u5b9e\u4f8b\u200b\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // \u200b\u8c03\u7528\u200bAPI\u200b\u5e76\u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                // \u200b\u4fdd\u5b58\u200b\u8fd4\u56de\u200b\u7684\u200b\u6570\u636e\u200b\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-forecasting\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    // \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData} // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // \u200b\u8c03\u7528\u200bAPI\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // \u200b\u5904\u7406\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    // \u200b\u5c06\u200bBase64\u200b\u7f16\u7801\u200b\u7684\u200bcsv\u200b\u6570\u636e\u200b\u89e3\u7801\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u4e3a\u200b\u6587\u4ef6\u200b\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-forecasting\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        // \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } }; // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        // \u200b\u8c03\u7528\u200bAPI\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        // \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-forecasting'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)  // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n  })\n};\n\n// \u200b\u8bfb\u53d6\u200bcsv\u200b\u6587\u4ef6\u200b\u5e76\u200b\u8f6c\u6362\u200b\u4e3a\u200bBase64\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    // \u200b\u4fdd\u5b58\u200bcsv\u200b\u6587\u4ef6\u200b\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-forecasting\"; // \u200b\u670d\u52a1\u200bURL\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n// \u200b\u5bf9\u200b\u672c\u5730\u200bcsv\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data); // Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\n\n// \u200b\u8c03\u7528\u200bAPI\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n// \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#4","title":"4. \u200b\u4e8c\u6b21\u5f00\u53d1","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u63d0\u4f9b\u200b\u7684\u200b\u9ed8\u8ba4\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u6216\u200b\u901f\u5ea6\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5c1d\u8bd5\u200b\u5229\u7528\u200b\u60a8\u200b\u81ea\u5df1\u200b\u62e5\u6709\u200b\u7684\u200b\u7279\u5b9a\u200b\u9886\u57df\u200b\u6216\u200b\u5e94\u7528\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u5bf9\u200b\u73b0\u6709\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u5347\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u60a8\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u8bc6\u522b\u200b\u6548\u679c\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#41","title":"4.1 \u200b\u6a21\u578b\u200b\u5fae\u8c03","text":"

\u200b\u7531\u4e8e\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u90a3\u4e48\u200b\u60a8\u200b\u9700\u8981\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u7ae0\u8282\u200b\uff0c\u200b\u4f7f\u7528\u200b\u60a8\u200b\u7684\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u5bf9\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#42","title":"4.2 \u200b\u6a21\u578b\u200b\u5e94\u7528","text":"

\u200b\u5f53\u200b\u60a8\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u96c6\u200b\u5b8c\u6210\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u200b\u83b7\u5f97\u200b\u672c\u5730\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u3002

\u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u4f7f\u7528\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u505a\u200b\u4fee\u6539\u200b\uff0c\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\u66ff\u6362\u200b\u81f3\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u5bf9\u5e94\u200b\u4f4d\u7f6e\u200b\u5373\u53ef\u200b\uff1a

......\nPipeline:\n  model: DLinear  #\u200b\u53ef\u200b\u4fee\u6539\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u6a21\u578b\u200b\u7684\u200b\u672c\u5730\u200b\u8def\u5f84\u200b\n  device: \"gpu\"\n  batch_size: 0\n......\n
\u200b\u968f\u540e\u200b\uff0c \u200b\u53c2\u8003\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u4e2d\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u65b9\u5f0f\u200b\u6216\u200b Python \u200b\u811a\u672c\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u52a0\u8f7d\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5373\u53ef\u200b\u3002

"},{"location":"pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#5","title":"5. \u200b\u591a\u200b\u786c\u4ef6\u200b\u652f\u6301","text":"

PaddleX \u200b\u652f\u6301\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU\u3001\u200b\u6606\u4ed1\u200b\u82af\u200b XPU\u3001\u200b\u6607\u200b\u817e\u200b NPU\u200b\u548c\u200b\u5bd2\u6b66\u7eaa\u200b MLU \u200b\u7b49\u200b\u591a\u79cd\u200b\u4e3b\u6d41\u200b\u786c\u4ef6\u200b\u8bbe\u5907\u200b\uff0c\u200b\u4ec5\u200b\u9700\u200b\u4fee\u6539\u200b --device \u200b\u53c2\u6570\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4e0d\u540c\u200b\u786c\u4ef6\u200b\u4e4b\u95f4\u200b\u7684\u200b\u65e0\u7f1d\u200b\u5207\u6362\u200b\u3002

\u200b\u4f8b\u5982\u200b\uff0c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u82f1\u200b\u4f1f\u8fbe\u200b GPU \u200b\u8fdb\u884c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u63a8\u7406\u200b\uff0c\u200b\u4f7f\u7528\u200b\u7684\u200b Python \u200b\u547d\u4ee4\u200b\u4e3a\u200b\uff1a

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
\u200b\u6b64\u65f6\u200b\uff0c\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5c06\u200b\u786c\u4ef6\u200b\u5207\u6362\u200b\u4e3a\u200b\u6607\u200b\u817e\u200b NPU\uff0c\u200b\u4ec5\u200b\u9700\u200b\u5bf9\u200b Python \u200b\u547d\u4ee4\u200b\u4e2d\u200b\u7684\u200b --device \u200b\u4fee\u6539\u200b\u4e3a\u200b npu:0 \u200b\u5373\u53ef\u200b\uff1a

paddlex --pipeline ts_fc --input ts_fc.csv --device npu:0\n
\u200b\u82e5\u200b\u60a8\u200b\u60f3\u200b\u5728\u200b\u66f4\u200b\u591a\u200b\u79cd\u7c7b\u200b\u7684\u200b\u786c\u4ef6\u200b\u4e0a\u200b\u4f7f\u7528\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html","title":"Anomaly detection tutorial","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#paddlex-30","title":"PaddleX 3.0 \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4ee5\u4e0b\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u98df\u54c1\u200b\u699b\u5b50\u200b\u5916\u89c2\u200b\u5f02\u5e38\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08\u200b\u94c1\u4e1d\u7f51\u200b \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 1 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b STFPM 96.2 - - 21.5 M STFPM.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b **MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002**

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u98df\u54c1\u200b\u5916\u89c2\u200b\u8d28\u68c0\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 391\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 70\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff1a-o Train.epochs_iters=5000\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 4000\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 1\u3002
  2. \u200b\u57fa\u4e8e\u200b STFPM \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.01\uff0c0.1\uff0c0.4\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.4\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\u5230\u200b5000\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u8fbe\u5230\u200b\u66f4\u4f18\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 4000 0.01 1 4\u200b\u5361\u200b 0.9646 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 4000 0.1 1 4\u200b\u5361\u200b 0.9707 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 4000 0.4 1 4\u200b\u5361\u200b 0.9797 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 5000 0.4 1 4\u200b\u5361\u200b 0.9826

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200buad_hazelnut.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/anomaly_detection_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/anomaly_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200boutput/best_model/inference\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html","title":"Anomaly detection tutorial en","text":"

\u200b\u7b80\u4f53\u4e2d\u6587\u200b | English

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#paddlex-30-image-anomaly-detection-pipeline-food-appearance-quality-inspection-tutorial","title":"PaddleX 3.0 Image Anomaly Detection Pipeline \u2014 Food Appearance Quality Inspection Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a Food Appearance Quality Inspection task.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For Food Appearance Quality Inspection, this falls under the category of anomaly detection tasks, corresponding to PaddleX's Image Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers 1 ways to experience the pipeline: one is through the PaddleX wheel package locally.

  • Local Experience:
    paddlex --pipeline anomaly_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png \\\n    --save_path output\n

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 1 end-to-end anomaly detection models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) yaml file STFPM 96.2 - - 21.5 M STFPM.yaml

Note: The above accuracy metrics are measured on the MVTec AD dataset.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Food Appearance Quality Inspection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX anomaly detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/anomaly_detection_hazelnut.tar -P ./dataset\ntar -xf ./dataset/anomaly_detection_hazelnut.tar -C ./dataset/\n

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/294.png\",\n      \"check_dataset\\/demo_img\\/260.png\",\n      \"check_dataset\\/demo_img\\/297.png\",\n      \"check_dataset\\/demo_img\\/170.png\",\n      \"check_dataset\\/demo_img\\/068.png\",\n      \"check_dataset\\/demo_img\\/212.png\",\n      \"check_dataset\\/demo_img\\/204.png\",\n      \"check_dataset\\/demo_img\\/233.png\",\n      \"check_dataset\\/demo_img\\/367.png\",\n      \"check_dataset\\/demo_img\\/383.png\"\n    ],\n    \"train_samples\": 391,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/012.png\",\n      \"check_dataset\\/demo_img\\/017.png\",\n      \"check_dataset\\/demo_img\\/006.png\",\n      \"check_dataset\\/demo_img\\/013.png\",\n      \"check_dataset\\/demo_img\\/014.png\",\n      \"check_dataset\\/demo_img\\/010.png\",\n      \"check_dataset\\/demo_img\\/007.png\",\n      \"check_dataset\\/demo_img\\/001.png\",\n      \"check_dataset\\/demo_img\\/002.png\",\n      \"check_dataset\\/demo_img\\/009.png\"\n    ],\n    \"val_samples\": 70,\n    \"num_classes\": 1\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/hazelnut\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 391;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 70;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut \\\n    -o Train.epochs_iters=4000\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/anomaly_detection_hazelnut\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 4000 and the batch size at 1.
  2. Initiate three experiments based on the STFPM model, with learning rates of: 0.01, 0.1, 0.4.
  3. It can be observed that the configuration with the highest accuracy in Experiment 3 is a learning rate of 0.4. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 5000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 4000 0.01 1 4 0.9646 Experiment 2 4000 0.1 1 4 0.9707 Experiment 3 4000 0.4 1 4 0.9797

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 3 4000 0.4 1 4 0.9797 Experiment 3 with more epochs 5000 0.4 1 4 0.9826

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\"\n

The prediction results will be generated under ./output, where the prediction result for uad_hazelnut.png is shown below:

"},{"location":"practical_tutorials/anomaly_detection_tutorial_en.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the anomaly detection pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/anomaly_detection.yaml configuration file to your own model path output/best_model/inference:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/anomaly_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_hazelnut.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to Anomaly Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"practical_tutorials/deployment_tutorial.html","title":"PaddleX 3.0 \u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u6559\u7a0b","text":"

\u200b\u5728\u200b\u4f7f\u7528\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002

PaddleX \u200b\u7684\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002
  • \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  • \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u672c\u200b\u6559\u7a0b\u200b\u5c06\u4e3e\u200b\u4e09\u4e2a\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u6765\u200b\u4f9d\u6b21\u200b\u4ecb\u7ecd\u200b PaddleX \u200b\u7684\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#1","title":"1 \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u793a\u4f8b","text":""},{"location":"practical_tutorials/deployment_tutorial.html#11","title":"1.1 \u200b\u83b7\u53d6\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u6fc0\u6d3b","text":"

\u200b\u5728\u200b \u200b\u98de\u6868\u200bAI Studio\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b-\u200b\u4eba\u5de5\u667a\u80fd\u200b\u5b66\u4e60\u200b\u4e0e\u200b\u5b9e\u8bad\u200b\u793e\u533a\u200b \u200b\u9875\u9762\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u5e8f\u5217\u53f7\u200b\u54a8\u8be2\u200b\u4e0e\u200b\u83b7\u53d6\u200b\u201d\u200b\u90e8\u5206\u200b\u9009\u62e9\u200b\u201c\u200b\u7acb\u5373\u200b\u83b7\u53d6\u200b\u201d\uff0c\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a

\u200b\u9009\u62e9\u200b\u9700\u8981\u200b\u90e8\u7f72\u200b\u7684\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u5e76\u200b\u70b9\u51fb\u200b\u201c\u200b\u83b7\u53d6\u200b\u201d\u3002\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u9875\u9762\u200b\u4e0b\u65b9\u200b\u7684\u200b\u201c\u200b\u5f00\u6e90\u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200bSDK\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u201d\u200b\u90e8\u5206\u200b\u627e\u5230\u200b\u83b7\u53d6\u200b\u5230\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\uff1a

\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u540e\u200b\uff0c\u200b\u5373\u53ef\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002PaddleX \u200b\u63d0\u4f9b\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u548c\u200b\u5728\u7ebf\u200b\u6fc0\u6d3b\u200b\u4e24\u79cd\u200b\u65b9\u5f0f\u200b\uff08\u200b\u5747\u200b\u53ea\u200b\u652f\u6301\u200b Linux \u200b\u7cfb\u7edf\u200b\uff09\uff1a

  • \u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\uff0c\u200b\u901a\u8fc7\u200b\u53c2\u6570\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u53ca\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u4f7f\u200b\u7a0b\u5e8f\u200b\u81ea\u52a8\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002
  • \u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\uff1a\u200b\u6309\u7167\u200b\u5e8f\u5217\u53f7\u200b\u7ba1\u7406\u200b\u754c\u9762\u200b\u4e2d\u200b\u7684\u200b\u6307\u5f15\u200b\uff08\u200b\u70b9\u51fb\u200b\u201c\u200b\u64cd\u4f5c\u200b\u201d\u200b\u4e2d\u200b\u7684\u200b\u201c\u200b\u79bb\u7ebf\u200b\u6fc0\u6d3b\u200b\u201d\uff09\uff0c\u200b\u83b7\u53d6\u200b\u673a\u5668\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200b\u5e8f\u5217\u53f7\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\u7ed1\u5b9a\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u8bc1\u4e66\u200b\uff0c\u200b\u5b8c\u6210\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u4f7f\u7528\u200b\u8fd9\u79cd\u200b\u6fc0\u6d3b\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u9700\u8981\u200b\u624b\u52a8\u200b\u5c06\u200b\u8bc1\u4e66\u200b\u5b58\u653e\u200b\u5728\u200b\u673a\u5668\u200b\u7684\u200b ${HOME}/.baidu/paddlex/licenses \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff08\u200b\u5982\u679c\u200b\u76ee\u5f55\u200b\u4e0d\u200b\u5b58\u5728\u200b\uff0c\u200b\u9700\u8981\u200b\u521b\u5efa\u200b\u76ee\u5f55\u200b\uff09\uff0c\u200b\u5e76\u200b\u5728\u200b\u4f7f\u7528\u200b\u63a8\u7406\u200b API \u200b\u6216\u200b CLI \u200b\u65f6\u200b\u6307\u5b9a\u200b\u5e8f\u5217\u53f7\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff1a\u200b\u6bcf\u4e2a\u200b\u5e8f\u5217\u53f7\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u5230\u200b\u552f\u4e00\u200b\u7684\u200b\u8bbe\u5907\u200b\u6307\u7eb9\u200b\uff0c\u200b\u4e14\u200b\u53ea\u80fd\u200b\u7ed1\u5b9a\u200b\u4e00\u6b21\u200b\u3002\u200b\u8fd9\u200b\u610f\u5473\u7740\u200b\u7528\u6237\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u4e0d\u540c\u200b\u7684\u200b\u673a\u5668\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5219\u200b\u5fc5\u987b\u200b\u4e3a\u200b\u6bcf\u53f0\u200b\u673a\u5668\u200b\u51c6\u5907\u200b\u5355\u72ec\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002
"},{"location":"practical_tutorials/deployment_tutorial.html#12","title":"1.2 \u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u4e0b\u8868\u4e2d\u200b\u6839\u636e\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b\u3001\u200b\u64cd\u4f5c\u7cfb\u7edf\u200b\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u3001Python \u200b\u7248\u672c\u200b\u7b49\u200b\u4fe1\u606f\u200b\uff0c\u200b\u627e\u5230\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u5e76\u200b\u5728\u200b\u90e8\u7f72\u200b\u73af\u5883\u200b\u4e2d\u200b\u6267\u884c\u200b\uff1a

\u200b\u5904\u7406\u5668\u200b\u67b6\u6784\u200b \u200b\u64cd\u4f5c\u7cfb\u7edf\u200b \u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b Python \u200b\u7248\u672c\u200b \u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0\uff08CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6\uff09 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • \u200b\u5f53\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200b GPU \u200b\u65f6\u200b\uff0c\u200b\u8bf7\u200b\u4f7f\u7528\u200b\u4e0e\u200b\u73af\u5883\u200b\u5339\u914d\u200b\u7684\u200b CUDA \u200b\u548c\u200b cuDNN \u200b\u7248\u672c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5426\u5219\u200b\uff0c\u200b\u5c06\u200b\u65e0\u6cd5\u200b\u6b63\u5e38\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002
  • \u200b\u5bf9\u4e8e\u200b Linux \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u4f7f\u7528\u200b Bash \u200b\u6267\u884c\u200b\u5b89\u88c5\u200b\u6307\u4ee4\u200b\u3002
  • \u200b\u5f53\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200b CPU \u200b\u65f6\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4ec5\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\uff1b\u200b\u5bf9\u4e8e\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\uff0c\u200b\u5b89\u88c5\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5219\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b CPU \u200b\u6216\u200b\u5176\u4ed6\u200b\u8bbe\u5907\u200b\u8fdb\u884c\u200b\u63a8\u7406\u200b\u3002
"},{"location":"practical_tutorials/deployment_tutorial.html#13","title":"1.3 \u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6","text":"

\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63d2\u4ef6\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u200b\u5f53\u524d\u200b\u73af\u5883\u200b\u7684\u200b LD_LIBRARY_PATH \u200b\u6ca1\u6709\u200b\u6307\u5b9a\u200b TensorRT \u200b\u7684\u200b\u5171\u4eab\u200b\u5e93\u200b\u76ee\u5f55\u200b\uff0c\u200b\u56e0\u4e3a\u200b\u63d2\u4ef6\u200b\u4e2d\u200b\u5df2\u7ecf\u200b\u96c6\u6210\u200b\u4e86\u200b TensorRT\uff0c\u200b\u907f\u514d\u200b TensorRT \u200b\u7248\u672c\u200b\u51b2\u7a81\u200b\u5bfc\u81f4\u200b\u63d2\u4ef6\u200b\u65e0\u6cd5\u200b\u6b63\u5e38\u200b\u4f7f\u7528\u200b\u3002

\u200b\u5bf9\u4e8e\u200b PaddleX CLI\uff0c\u200b\u6307\u5b9a\u200b --use_hpip\uff0c\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u5e8f\u5217\u53f7\u200b\uff0c\u200b\u5373\u53ef\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002\u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\uff0c\u200b\u5728\u200b\u7b2c\u4e00\u6b21\u200b\u4f7f\u7528\u200b\u5e8f\u5217\u53f7\u200b\u65f6\u200b\uff0c\u200b\u9700\u200b\u6307\u5b9a\u200b --update_license\uff0c\u200b\u4ee5\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n\n# \u200b\u5982\u679c\u200b\u5e0c\u671b\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\npaddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --update_license \\\n    --serial_number {\u200b\u5e8f\u5217\u53f7\u200b}\n

\u200b\u5bf9\u4e8e\u200b PaddleX Python API\uff0c\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u7684\u200b\u65b9\u6cd5\u200b\u7c7b\u4f3c\u200b\u3002\u200b\u4ecd\u200b\u4ee5\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"OCR\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": xxx}\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \")\n

\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u5f97\u5230\u200b\u7684\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u4e0e\u200b\u672a\u200b\u542f\u7528\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u4e00\u81f4\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u9996\u6b21\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\uff0c\u200b\u53ef\u80fd\u200b\u9700\u8981\u200b\u82b1\u8d39\u200b\u8f83\u957f\u65f6\u95f4\u200b\u5b8c\u6210\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u6784\u5efa\u200b\u3002PaddleX \u200b\u5c06\u200b\u5728\u200b\u63a8\u7406\u200b\u5f15\u64ce\u200b\u7684\u200b\u7b2c\u4e00\u6b21\u200b\u6784\u5efa\u200b\u5b8c\u6210\u200b\u540e\u200b\u5c06\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7f13\u5b58\u200b\u5728\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b\u540e\u7eed\u200b\u590d\u7528\u200b\u7f13\u5b58\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\u4ee5\u200b\u63d0\u5347\u200b\u521d\u59cb\u5316\u200b\u901f\u5ea6\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#14","title":"1.4 \u200b\u63a8\u7406\u200b\u6b65\u9aa4","text":"

\u200b\u672c\u200b\u63a8\u7406\u200b\u6b65\u9aa4\u200b\u57fa\u4e8e\u200b PaddleX CLI\u3001\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\u5e8f\u5217\u53f7\u200b\u3001Python 3.10.0\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u4e3a\u200bCPU \u200b\u7684\u200b\u65b9\u5f0f\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5176\u4ed6\u200b\u4f7f\u7528\u200b\u65b9\u5f0f\u200b\uff08\u200b\u5982\u200b\u4e0d\u540c\u200b Python \u200b\u7248\u672c\u200b\u3001\u200b\u8bbe\u5907\u200b\u7c7b\u578b\u200b\u6216\u200b PaddleX Python API\uff09\u200b\u53ef\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b \u200b\u66ff\u6362\u200b\u76f8\u5e94\u200b\u7684\u200b\u6307\u4ee4\u200b\u3002

# \u200b\u5b89\u88c5\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\ncurl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310\n# \u200b\u786e\u4fdd\u200b\u5f53\u524d\u200b\u73af\u5883\u200b\u7684\u200b `LD_LIBRARY_PATH` \u200b\u6ca1\u6709\u200b\u6307\u5b9a\u200b TensorRT \u200b\u7684\u200b\u5171\u4eab\u200b\u5e93\u200b\u76ee\u5f55\u200b \u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b\u4e0b\u9762\u200b\u547d\u4ee4\u200b\u53bb\u9664\u200b\u6216\u200b\u624b\u52a8\u200b\u53bb\u9664\u200b\nexport LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\\n' | grep -v TensorRT | tr '\\n' ':' | sed 's/:*$//')\n# \u200b\u6267\u884c\u200b\u63a8\u7406\u200b\npaddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n

\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\uff1a

"},{"location":"practical_tutorials/deployment_tutorial.html#15","title":"1.5 \u200b\u66f4\u6362\u200b\u4ea7\u200b\u7ebf\u6216\u200b\u6a21\u578b","text":"
  • \u200b\u66f4\u6362\u200b\u4ea7\u7ebf\u200b\uff1a

\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u5219\u200b\u66ff\u6362\u200b --pipeline \u200b\u4f20\u5165\u200b\u7684\u200b\u503c\u200b\u5373\u53ef\u200b\uff0c\u200b\u4ee5\u4e0b\u200b\u4ee5\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n
  • \u200b\u66f4\u6362\u200b\u6a21\u578b\u200b\uff1a

OCR \u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PP-OCRv4_mobile_det\u3001PP-OCRv4_mobile_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b PP-OCRv4_server_det\u3001PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./OCR.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.text_det_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_det \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n#    \u200b\u5c06\u200b Pipeline.text_rec_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u6267\u884c\u200b\u63a8\u7406\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --pipeline ./OCR.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n

\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PicoDet-S \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b RT-DETR \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./object_detection.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b RT-DETR \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u6267\u884c\u200b\u63a8\u7406\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --pipeline ./object_detection.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {\u200b\u5e8f\u5217\u53f7\u200b} --update_license True --save_path ./output\n

\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u4e0e\u200b\u4e0a\u8ff0\u200b\u4e24\u6761\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200b\u7ec6\u8282\u200b\u53ef\u200b\u53c2\u8003\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#2","title":"2 \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u793a\u4f8b","text":""},{"location":"practical_tutorials/deployment_tutorial.html#21","title":"2.1 \u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6","text":"

\u200b\u6267\u884c\u200b\u5982\u4e0b\u200b\u6307\u4ee4\u200b\uff0c\u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6\u200b\uff1a

paddlex --install serving\n
"},{"location":"practical_tutorials/deployment_tutorial.html#22","title":"2.2 \u200b\u542f\u52a8\u200b\u670d\u52a1","text":"

\u200b\u901a\u8fc7\u200b PaddleX CLI \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\uff0c\u200b\u6307\u4ee4\u200b\u683c\u5f0f\u200b\u4e3a\u200b\uff1a

paddlex --serve --pipeline {\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b} [{\u200b\u5176\u4ed6\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b}]\n

\u200b\u4ee5\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --serve --pipeline OCR\n

\u200b\u670d\u52a1\u200b\u542f\u52a8\u200b\u6210\u529f\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\u7c7b\u4f3c\u200b\u5982\u4e0b\u200b\u5c55\u793a\u200b\u7684\u200b\u4fe1\u606f\u200b\uff1a

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline \u200b\u53ef\u200b\u6307\u5b9a\u200b\u4e3a\u200b\u5b98\u65b9\u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u200b\u672c\u5730\u4ea7\u200b\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002PaddleX \u200b\u4ee5\u6b64\u200b\u6784\u5efa\u200b\u4ea7\u7ebf\u200b\u5e76\u200b\u90e8\u7f72\u200b\u4e3a\u200b\u670d\u52a1\u200b\u3002\u200b\u5982\u9700\u200b\u8c03\u6574\u200b\u914d\u7f6e\u200b\uff08\u200b\u5982\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\u3001batch_size\u3001\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u7b49\u200b\uff09\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b \u201c\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u201d \u200b\u90e8\u5206\u200b\u3002 \u200b\u4e0e\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u76f8\u5173\u200b\u7684\u200b\u547d\u4ee4\u884c\u200b\u9009\u9879\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u540d\u79f0\u200b \u200b\u8bf4\u660e\u200b --pipeline \u200b\u4ea7\u7ebf\u200b\u540d\u79f0\u200b\u6216\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u3002 --device \u200b\u4ea7\u7ebf\u200b\u90e8\u7f72\u200b\u8bbe\u5907\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b cpu\uff08\u200b\u5982\u200b GPU \u200b\u4e0d\u53ef\u200b\u7528\u200b\uff09\u200b\u6216\u200b gpu\uff08\u200b\u5982\u200b GPU \u200b\u53ef\u7528\u200b\uff09\u3002 --host \u200b\u670d\u52a1\u5668\u200b\u7ed1\u5b9a\u200b\u7684\u200b\u4e3b\u673a\u540d\u200b\u6216\u200b IP \u200b\u5730\u5740\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b0.0.0.0\u3002 --port \u200b\u670d\u52a1\u5668\u200b\u76d1\u542c\u200b\u7684\u200b\u7aef\u53e3\u53f7\u200b\u3002\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b8080\u3002 --use_hpip \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u3002 --serial_number \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u4f7f\u7528\u200b\u7684\u200b\u5e8f\u5217\u53f7\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002 \u200b\u8bf7\u200b\u6ce8\u610f\u200b\uff0c\u200b\u5e76\u975e\u200b\u6240\u6709\u200b\u4ea7\u7ebf\u200b\u3001\u200b\u6a21\u578b\u200b\u90fd\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u652f\u6301\u200b\u60c5\u51b5\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002 --update_license \u200b\u5982\u679c\u200b\u6307\u5b9a\u200b\uff0c\u200b\u5219\u200b\u8fdb\u884c\u200b\u8054\u7f51\u200b\u6fc0\u6d3b\u200b\u3002\u200b\u53ea\u200b\u5728\u200b\u542f\u7528\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\u65f6\u200b\u751f\u6548\u200b\u3002"},{"location":"practical_tutorials/deployment_tutorial.html#23","title":"2.3 \u200b\u8c03\u7528\u200b\u670d\u52a1","text":"

\u200b\u6b64\u5904\u200b\u53ea\u200b\u5c55\u793a\u200b Python \u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\uff0cAPI\u200b\u53c2\u8003\u200b\u548c\u200b\u5176\u4ed6\u200b\u8bed\u8a00\u200b\u670d\u52a1\u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\u53ef\u200b\u53c2\u8003\u200b PaddleX\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b \u200b\u7684\u200b 1.3 \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b \u200b\u4e2d\u200b\u5404\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u7684\u200b \u201c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u201d \u200b\u90e8\u5206\u200b\u3002

import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # \u200b\u670d\u52a1\u200bURL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u56fe\u50cf\u200bURL\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
"},{"location":"practical_tutorials/deployment_tutorial.html#24","title":"2.4 \u200b\u90e8\u7f72\u200b\u6b65\u9aa4","text":"
# \u200b\u5b89\u88c5\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u63d2\u4ef6\u200b\npaddlex --install serving\n# \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\npaddlex --serve --pipeline OCR\n# \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b | fast_test.py \u200b\u4e2d\u200b\u4ee3\u7801\u200b\u4e3a\u200b\u4e0a\u200b\u4e00\u8282\u200b\u7684\u200b Python \u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

\u200b\u8fd0\u884c\u200b\u7ed3\u679c\u200b\uff1a

"},{"location":"practical_tutorials/deployment_tutorial.html#25","title":"2.5 \u200b\u66f4\u6362\u200b\u4ea7\u200b\u7ebf\u6216\u200b\u6a21\u578b","text":"
  • \u200b\u66f4\u6362\u200b\u4ea7\u7ebf\u200b\uff1a

\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u5219\u200b\u66ff\u6362\u200b --pipeline \u200b\u4f20\u5165\u200b\u7684\u200b\u503c\u200b\u5373\u53ef\u200b\uff0c\u200b\u4ee5\u4e0b\u200b\u4ee5\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e3a\u4f8b\u200b\uff1a

paddlex --serve --pipeline object_detection\n
  • \u200b\u66f4\u6362\u200b\u6a21\u578b\u200b\uff1a

OCR \u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PP-OCRv4_mobile_det\u3001PP-OCRv4_mobile_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b PP-OCRv4_server_det\u3001PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./OCR.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.text_det_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_det \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n#    \u200b\u5c06\u200b Pipeline.text_rec_model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --serve --pipeline ./OCR.yaml\n# 4. \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PicoDet-S \u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u60f3\u200b\u66f4\u6362\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b RT-DETR \u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5177\u4f53\u64cd\u4f5c\u200b\u5982\u4e0b\u200b\uff1a

# 1. \u200b\u83b7\u53d6\u200b OCR \u200b\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u5e76\u200b\u4fdd\u5b58\u200b\u5230\u200b ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. \u200b\u4fee\u6539\u200b ./object_detection.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\n#    \u200b\u5c06\u200b Pipeline.model \u200b\u7684\u200b\u503c\u200b\u6539\u4e3a\u200b RT-DETR \u200b\u6a21\u578b\u200b\u6240\u5728\u200b\u8def\u5f84\u200b\n\n# 3. \u200b\u542f\u52a8\u200b\u670d\u52a1\u200b\u65f6\u200b\u4f7f\u7528\u200b\u4fee\u6539\u200b\u540e\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\npaddlex --serve --pipeline ./object_detection.yaml\n# 4. \u200b\u8c03\u7528\u200b\u670d\u52a1\u200b | fast_test.py \u200b\u9700\u8981\u200b\u66ff\u6362\u200b\u4e3a\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b Python \u200b\u8c03\u7528\u200b\u793a\u4f8b\u200b\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

\u200b\u5176\u4ed6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u4e0e\u200b\u4e0a\u8ff0\u200b\u4e24\u6761\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u64cd\u4f5c\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u66f4\u200b\u591a\u200b\u7ec6\u8282\u200b\u53ef\u200b\u53c2\u8003\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/deployment_tutorial.html#3","title":"3 \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u793a\u4f8b","text":""},{"location":"practical_tutorials/deployment_tutorial.html#31","title":"3.1 \u200b\u73af\u5883\u200b\u51c6\u5907","text":"
  1. \u200b\u5728\u200b\u672c\u5730\u200b\u73af\u5883\u200b\u5b89\u88c5\u200b\u597d\u200b CMake \u200b\u7f16\u8bd1\u200b\u5de5\u5177\u200b\uff0c\u200b\u5e76\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b\u5f53\u524d\u200b\u7cfb\u7edf\u200b\u7b26\u5408\u8981\u6c42\u200b\u7684\u200b\u7248\u672c\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b Mac \u200b\u4e0a\u200b\u5f00\u53d1\u200b\uff0c\u200b\u9700\u8981\u200b\u5728\u200b Android NDK \u200b\u5b98\u7f51\u200b\u4e0b\u8f7d\u200b Mac \u200b\u5e73\u53f0\u200b\u7684\u200b NDK \u200b\u8f6f\u4ef6\u5305\u200b\u3002

    \u200b\u73af\u5883\u200b\u8981\u6c42\u200b - CMake >= 3.10\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b 3.20 \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09 - Android NDK >= r17c\uff08\u200b\u6700\u4f4e\u200b\u7248\u672c\u200b\u672a\u7ecf\u200b\u9a8c\u8bc1\u200b\uff0c\u200b\u63a8\u8350\u200b r20b \u200b\u53ca\u200b\u4ee5\u4e0a\u200b\uff09

    \u200b\u672c\u200b\u6307\u5357\u200b\u6240\u200b\u4f7f\u7528\u200b\u7684\u200b\u6d4b\u8bd5\u73af\u5883\u200b\uff1a - cmake == 3.20.0 - android-ndk == r20b

  2. \u200b\u51c6\u5907\u200b\u4e00\u90e8\u200b Android \u200b\u624b\u673a\u200b\uff0c\u200b\u5e76\u200b\u5f00\u542f\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002\u200b\u5f00\u542f\u200b\u65b9\u6cd5\u200b: \u200b\u624b\u673a\u200b\u8bbe\u7f6e\u200b -> \u200b\u67e5\u627e\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b -> \u200b\u6253\u5f00\u200b\u5f00\u53d1\u8005\u200b\u9009\u9879\u200b\u548c\u200b USB \u200b\u8c03\u8bd5\u6a21\u5f0f\u200b\u3002

  3. \u200b\u7535\u8111\u200b\u4e0a\u200b\u5b89\u88c5\u200b ADB \u200b\u5de5\u5177\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8c03\u8bd5\u200b\u3002ADB \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u5982\u4e0b\u200b\uff1a

    3.1. Mac \u200b\u7535\u8111\u200b\u5b89\u88c5\u200b ADB

     brew cask install android-platform-tools\n

    3.2. Linux \u200b\u5b89\u88c5\u200b ADB

     # debian\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo apt update\n sudo apt install -y wget adb\n\n # redhat\u200b\u7cfb\u200blinux\u200b\u53d1\u884c\u7248\u200b\u7684\u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\n sudo yum install adb\n

    3.3. Windows \u200b\u5b89\u88c5\u200b ADB

    win \u200b\u4e0a\u200b\u5b89\u88c5\u200b\u9700\u8981\u200b\u53bb\u200b\u8c37\u6b4c\u200b\u7684\u200b\u5b89\u5353\u200b\u5e73\u53f0\u200b\u4e0b\u8f7d\u200b ADB \u200b\u8f6f\u4ef6\u5305\u200b\u8fdb\u884c\u200b\u5b89\u88c5\u200b\uff1a\u200b\u94fe\u63a5\u200b

    \u200b\u6253\u5f00\u200b\u7ec8\u7aef\u200b\uff0c\u200b\u624b\u673a\u200b\u8fde\u63a5\u200b\u7535\u8111\u200b\uff0c\u200b\u5728\u200b\u7ec8\u7aef\u200b\u4e2d\u200b\u8f93\u5165\u200b

     adb devices\n

    \u200b\u5982\u679c\u200b\u6709\u200b device \u200b\u8f93\u51fa\u200b\uff0c\u200b\u5219\u200b\u8868\u793a\u200b\u5b89\u88c5\u200b\u6210\u529f\u200b\u3002

     List of devices attached\n 744be294    device\n
"},{"location":"practical_tutorials/deployment_tutorial.html#32","title":"3.2 \u200b\u7269\u6599\u200b\u51c6\u5907","text":"
  1. \u200b\u514b\u9686\u200b Paddle-Lite-Demo \u200b\u4ed3\u5e93\u200b\u7684\u200b feature/paddle-x \u200b\u5206\u652f\u200b\u5230\u200b PaddleX-Lite-Deploy \u200b\u76ee\u5f55\u200b\u3002

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. \u200b\u586b\u5199\u200b \u200b\u95ee\u5377\u200b \u200b\u4e0b\u8f7d\u200b\u538b\u7f29\u5305\u200b\uff0c\u200b\u5c06\u200b\u538b\u7f29\u5305\u200b\u653e\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\uff0c\u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\u540e\u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\u3002

    # 1. \u200b\u5207\u6362\u200b\u5230\u200b\u6307\u5b9a\u200b\u89e3\u538b\u200b\u76ee\u5f55\u200b\ncd PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo\n\n# 2. \u200b\u6267\u884c\u200b\u89e3\u538b\u200b\u547d\u4ee4\u200b\nunzip ocr.zip\n

"},{"location":"practical_tutorials/deployment_tutorial.html#33","title":"3.3 \u200b\u90e8\u7f72\u200b\u6b65\u9aa4","text":"
  1. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/libs \u200b\u76ee\u5f55\u200b\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\u3002\u200b\u6b64\u200b\u6b65\u9aa4\u200b\u53ea\u200b\u9700\u200b\u6267\u884c\u200b\u4e00\u6b21\u200b\uff0c\u200b\u5373\u53ef\u200b\u652f\u6301\u200b\u6bcf\u4e2a\u200b demo \u200b\u4f7f\u7528\u200b\u3002

  2. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/ocr/assets \u200b\u76ee\u5f55\u200b\uff0c\u200b\u8fd0\u884c\u200b download.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b \u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6587\u4ef6\u200b\u3002

  3. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo \u200b\u76ee\u5f55\u200b\uff0c\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\u3002

  4. \u200b\u5c06\u200b\u5de5\u4f5c\u200b\u76ee\u5f55\u200b\u5207\u6362\u200b\u5230\u200b PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo\uff0c\u200b\u8fd0\u884c\u200b run.sh \u200b\u811a\u672c\u200b\uff0c\u200b\u5b8c\u6210\u200b\u5728\u200b\u7aef\u4fa7\u200b\u7684\u200b\u9884\u6d4b\u200b\u3002

\u200b\u6ce8\u610f\u4e8b\u9879\u200b\uff1a - \u200b\u5728\u200b\u8fd0\u884c\u200b build.sh \u200b\u811a\u672c\u200b\u524d\u200b\uff0c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b NDK_ROOT \u200b\u6307\u5b9a\u200b\u7684\u200b\u8def\u5f84\u200b\u4e3a\u200b\u5b9e\u9645\u200b\u5b89\u88c5\u200b\u7684\u200b NDK \u200b\u8def\u5f84\u200b\u3002 - \u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u53ef\u4ee5\u200b\u4f7f\u7528\u200b Git Bash \u200b\u6267\u884c\u200b\u90e8\u7f72\u200b\u6b65\u9aa4\u200b\u3002 - \u200b\u82e5\u200b\u5728\u200b Windows \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b windows\u3002 - \u200b\u82e5\u200b\u5728\u200b Mac \u200b\u7cfb\u7edf\u200b\u4e0a\u200b\u7f16\u8bd1\u200b\uff0c\u200b\u9700\u8981\u200b\u5c06\u200b CMakeLists.txt \u200b\u4e2d\u200b\u7684\u200b CMAKE_SYSTEM_NAME \u200b\u8bbe\u7f6e\u200b\u4e3a\u200b darwin\u3002 - \u200b\u5728\u200b\u8fd0\u884c\u200b run.sh \u200b\u811a\u672c\u200b\u65f6\u9700\u200b\u4fdd\u6301\u200b ADB \u200b\u8fde\u63a5\u200b\u3002 - download.sh \u200b\u548c\u200b run.sh \u200b\u652f\u6301\u200b\u4f20\u5165\u200b\u53c2\u6570\u200b\u6765\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\uff0c\u200b\u82e5\u200b\u4e0d\u200b\u6307\u5b9a\u200b\u5219\u200b\u9ed8\u8ba4\u200b\u4f7f\u7528\u200b PP-OCRv4_mobile \u200b\u6a21\u578b\u200b\u3002\u200b\u76ee\u524d\u200b\u9002\u914d\u200b\u4e86\u200b 2 \u200b\u4e2a\u200b\u6a21\u578b\u200b\uff1a - PP-OCRv3_mobile - PP-OCRv4_mobile

\u200b\u4ee5\u4e0b\u200b\u4e3a\u200b\u5b9e\u9645\u64cd\u4f5c\u200b\u65f6\u200b\u7684\u200b\u793a\u4f8b\u200b\uff1a

 # 1. \u200b\u4e0b\u8f7d\u200b\u9700\u8981\u200b\u7684\u200b Paddle Lite \u200b\u9884\u6d4b\u200b\u5e93\u200b\n cd PaddleX-Lite-Deploy/libs\n sh download.sh\n\n # 2. \u200b\u4e0b\u8f7d\u200b paddle_lite_opt \u200b\u5de5\u5177\u200b\u4f18\u5316\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u6587\u4ef6\u200b\n cd ../ocr/assets\n sh download.sh PP-OCRv4_mobile\n\n # 3. \u200b\u5b8c\u6210\u200b\u53ef\u6267\u884c\u6587\u4ef6\u200b\u7684\u200b\u7f16\u8bd1\u200b\n cd ../android/shell/ppocr_demo\n sh build.sh\n\n# 4. \u200b\u9884\u6d4b\u200b\n sh run.sh PP-OCRv4_mobile\n

\u200b\u68c0\u6d4b\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\uff1a

The detection visualized image saved in ./test_img_result.jpg\n0       \u200b\u7eaf\u81fb\u200b\u8425\u517b\u200b\u62a4\u53d1\u7d20\u200b  0.993706\n1       \u200b\u4ea7\u54c1\u200b\u4fe1\u606f\u200b/\u200b\u53c2\u6570\u200b   0.991224\n2       \uff0845\u200b\u5143\u200b/\u200b\u6bcf\u516c\u65a4\u200b\uff0c100\u200b\u516c\u65a4\u200b\u8d77\u8ba2\u200b\uff09    0.938893\n3       \u200b\u6bcf\u74f6\u200b22\u200b\u5143\u200b\uff0c1000\u200b\u74f6\u200b\u8d77\u8ba2\u200b\uff09  0.988353\n4       \u3010\u200b\u54c1\u724c\u200b\u3011\uff1a\u200b\u4ee3\u52a0\u5de5\u200b\u65b9\u5f0f\u200b/OEMODM     0.97557\n5       \u3010\u200b\u54c1\u540d\u200b\u3011\uff1a\u200b\u7eaf\u81fb\u200b\u8425\u517b\u200b\u62a4\u53d1\u7d20\u200b        0.986914\n6       ODMOEM  0.929891\n7       \u3010\u200b\u4ea7\u54c1\u7f16\u53f7\u200b\u3011\uff1aYM-X-3011 0.964156\n8       \u3010\u200b\u51c0\u542b\u91cf\u200b\u3011\uff1a220ml       0.976404\n9       \u3010\u200b\u9002\u7528\u4eba\u7fa4\u200b\u3011\uff1a\u200b\u9002\u5408\u200b\u6240\u6709\u200b\u80a4\u8d28\u200b      0.987942\n10      \u3010\u200b\u4e3b\u8981\u200b\u6210\u5206\u200b\u3011\uff1a\u200b\u9cb8\u8721\u200b\u786c\u8102\u200b\u9187\u200b\u3001\u200b\u71d5\u9ea6\u200b\u03b2-\u200b\u8461\u805a\u200b    0.968315\n11      \u200b\u7cd6\u200b\u3001\u200b\u6930\u6cb9\u200b\u9170\u80fa\u200b\u4e19\u57fa\u200b\u751c\u83dc\u78b1\u200b\u3001\u200b\u6cdb\u9192\u200b    0.941537\n12      \uff08\u200b\u6210\u54c1\u200b\u5305\u6750\u200b\uff09    0.974796\n13      \u3010\u200b\u4e3b\u8981\u200b\u529f\u80fd\u200b\u3011\uff1a\u200b\u53ef\u200b\u7d27\u81f4\u200b\u5934\u53d1\u200b\u78f7\u5c42\u200b\uff0c\u200b\u4ece\u800c\u200b\u8fbe\u5230\u200b  0.988799\n14      \u200b\u5373\u65f6\u200b\u6301\u4e45\u200b\u6539\u5584\u200b\u5934\u53d1\u200b\u5149\u6cfd\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u7ed9\u200b\u5e72\u71e5\u200b\u7684\u200b\u5934\u200b  0.989547\n15      \u200b\u53d1\u200b\u8db3\u591f\u200b\u7684\u200b\u6ecb\u517b\u200b    0.998413\n
"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html","title":"PaddleX 3.0 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3_doc\uff09 -- \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u5b9e\u9645\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u4f17\u591a\u200b\u573a\u666f\u200b\u4e2d\u200b\u90fd\u200b\u6709\u7740\u200b\u5e7f\u6cdb\u200b\u7684\u200b\u5e94\u7528\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5b66\u672f\u7814\u7a76\u200b\u3001\u200b\u56fe\u4e66\u9986\u200b\u7ba1\u7406\u200b\u3001\u200b\u79d1\u6280\u200b\u60c5\u62a5\u5206\u6790\u200b\u3001\u200b\u6587\u732e\u200b\u7efc\u8ff0\u200b\u64b0\u5199\u200b\u7b49\u200b\u573a\u666f\u200b\u3002\u200b\u901a\u8fc7\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u6280\u672f\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u4ece\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u4e2d\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u51fa\u200b\u6807\u9898\u200b\u3001\u200b\u4f5c\u8005\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5173\u952e\u8bcd\u200b\u3001\u200b\u53d1\u8868\u200b\u5e74\u4efd\u200b\u3001\u200b\u671f\u520a\u200b\u540d\u79f0\u200b\u3001\u200b\u5f15\u7528\u200b\u4fe1\u606f\u200b\u7b49\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5e76\u200b\u4ee5\u200b\u7ed3\u6784\u5316\u200b\u7684\u200b\u5f62\u5f0f\u200b\u5b58\u50a8\u200b\uff0c\u200b\u4fbf\u4e8e\u200b\u540e\u7eed\u200b\u7684\u200b\u68c0\u7d22\u200b\u3001\u200b\u5206\u6790\u200b\u4e0e\u200b\u5e94\u7528\u200b\u3002\u200b\u8fd9\u200b\u4e0d\u4ec5\u200b\u63d0\u5347\u200b\u4e86\u200b\u79d1\u7814\u4eba\u5458\u200b\u7684\u200b\u5de5\u4f5c\u6548\u7387\u200b\uff0c\u200b\u4e5f\u200b\u4e3a\u200b\u5b66\u672f\u7814\u7a76\u200b\u7684\u200b\u6df1\u5165\u200b\u53d1\u5c55\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u6709\u529b\u200b\u7684\u200b\u652f\u6301\u200b\u3002

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u8282\u200b\u4ee5\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u7684\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5e0c\u671b\u200b\u62bd\u53d6\u200b\u51fa\u200b\u8bba\u6587\u200b\u4e2d\u200b\u7684\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#21","title":"2.1 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u4f7f\u7528\u200b\u5343\u5e06\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u9875\u7709\u200b\", \"\u200b\u8868\u683c\u200b\u6807\u9898\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u4ec5\u200b\u652f\u6301\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\u6216\u8005\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\u200b\u4e0a\u200b\u83b7\u53d6\u200b\u76f8\u5173\u200b\u7684\u200b ak/sk(access_token)\u3002\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bAK\u200b\u548c\u200bSK\u200b\u9274\u6743\u200b\u8c03\u7528\u200bAPI\u200b\u6d41\u7a0b\u200b \u200b\u83b7\u53d6\u200bak/sk\uff0c\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio \u200b\u8bbf\u95ee\u200b\u4ee4\u724c\u200b\u4e2d\u200b\u83b7\u53d6\u200b access_token\u3002

\u200b\u8f93\u51fa\u200b\u6253\u5370\u200b\u7684\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

The result has been saved in output/tmpfnss9sq9_layout.jpg.\nThe result has been saved in output/tmpfnss9sq9_ocr.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\n\n{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u8868\u683c\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

\u200b\u5728\u200boutput \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u4e86\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u3001OCR\u3001\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u4ee5\u53ca\u200b\u8868\u683c\u200bhtml\u200b\u548c\u200bxlsx\u200b\u7ed3\u679c\u200b\u3002

\u200b\u5176\u4e2d\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u901a\u8fc7\u200b\u4e0a\u9762\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7684\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b Badcase \u200b\u5206\u6790\u200b\uff0c\u200b\u53d1\u73b0\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u5f53\u524d\u200b\u9700\u6c42\u200b\u573a\u666f\u200b\u4e2d\u200b\u5b58\u5728\u200b\u4e0b\u9762\u200b\u7684\u200b\u95ee\u9898\u200b\uff1a\u200b\u7531\u4e8e\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u76ee\u524d\u200b\u53ea\u200b\u533a\u5206\u200b\u4e86\u200b\u56fe\u200b\uff0c\u200b\u8868\u683c\u200b\u548c\u200b\u5370\u7ae0\u200b\u4e09\u4e2a\u200b\u7c7b\u522b\u200b\uff0c\u200b\u56e0\u6b64\u200b\u76ee\u524d\u200b\u65e0\u6cd5\u200b\u51c6\u786e\u200b\u7684\u200b\u5b9a\u4f4d\u200b\u5e76\u200b\u62bd\u53d6\u200b\u51fa\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u7b49\u200b\u5176\u4ed6\u200b\u4fe1\u606f\u200b\uff0c\u200b\u5728\u200b{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u8868\u683c\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\u200b\u4e2d\u200b\u7684\u200b\u7ed3\u679c\u200b\u662f\u200b\u672a\u77e5\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u672c\u200b\u8282\u200b\u5de5\u4f5c\u200b\u805a\u7126\u200b\u4e8e\u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u7684\u200b\u573a\u666f\u200b\uff0c\u200b\u5229\u7528\u200b\u8bba\u6587\u200b\u6587\u6863\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4ee5\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5bf9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u7248\u9762\u200b\u5206\u6790\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ece\u800c\u200b\u8fbe\u5230\u200b\u80fd\u591f\u200b\u7cbe\u786e\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u4fe1\u606f\u200b\u7684\u200b\u80fd\u529b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#22","title":"2.2 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u70b9\u51fb\u200b\u94fe\u63a5\u200b\u4e0b\u8f7d\u200b \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4e0a\u4f20\u200b\u81f3\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u62bd\u53d6\u200b\u6548\u679c\u200b\u3002\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 4 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b mAP(0.5)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M\uff09 \u200b\u4ecb\u7ecd\u200b PicoDet_layout_1x 86.8 13.0 91.3 7.4 \u200b\u57fa\u4e8e\u200bPicoDet-1x\u200b\u5728\u200bPubLayNet\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u53ef\u200b\u5b9a\u4f4d\u200b\u5305\u542b\u200b\u6587\u5b57\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u56fe\u7247\u200b\u4ee5\u53ca\u200b\u5217\u8868\u200b\u8fd9\u200b5\u200b\u7c7b\u200b\u533a\u57df\u200b PicoDet-S_layout_3cls 87.1 13.5 45.8 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-S_layout_17cls 70.3 13.6 46.2 4.8 \u200b\u57fa\u4e8e\u200bPicoDet-S\u200b\u8f7b\u91cf\u200b\u6a21\u578b\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b PicoDet-L_layout_3cls 89.3 15.7 159.8 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b PicoDet-L_layout_17cls 79.9 17.2 160.2 22.6 \u200b\u57fa\u4e8e\u200bPicoDet-L\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u6548\u7387\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_3cls 95.9 114.6 3832.6 470.1 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b3\u200b\u4e2a\u200b\u7c7b\u522b\u200b\uff1a\u200b\u8868\u683c\u200b\uff0c\u200b\u56fe\u50cf\u200b\u548c\u200b\u5370\u7ae0\u200b RT-DETR-H_layout_17cls 92.6 115.1 3827.2 470.2 \u200b\u57fa\u4e8e\u200bRT-DETR-H\u200b\u5728\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u573a\u666f\u200b\u4e0a\u200b\u81ea\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u6a21\u578b\u200b\uff0c\u200b\u5305\u542b\u200b17\u200b\u4e2a\u200b\u7248\u9762\u200b\u5e38\u89c1\u200b\u7c7b\u522b\u200b\uff0c\u200b\u5206\u522b\u200b\u662f\u200b\uff1a\u200b\u6bb5\u843d\u200b\u6807\u9898\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u6587\u672c\u200b\u3001\u200b\u6570\u5b57\u200b\u3001\u200b\u6458\u8981\u200b\u3001\u200b\u5185\u5bb9\u200b\u3001\u200b\u56fe\u8868\u200b\u6807\u9898\u200b\u3001\u200b\u516c\u5f0f\u200b\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u3001\u200b\u53c2\u8003\u6587\u732e\u200b\u3001\u200b\u6587\u6863\u200b\u6807\u9898\u200b\u3001\u200b\u811a\u6ce8\u200b\u3001\u200b\u9875\u7709\u200b\u3001\u200b\u7b97\u6cd5\u200b\u3001\u200b\u9875\u811a\u200b\u3001\u200b\u5370\u7ae0\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b\u4e2d\u82f1\u6587\u200b\u8bba\u6587\u200b\u3001\u200b\u6742\u5fd7\u200b\u548c\u200b\u7814\u62a5\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b 1w \u200b\u5f20\u200b\u6587\u6863\u200b\u7c7b\u578b\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/paperlayout.tar -P ./dataset\ntar -xf ./dataset/paperlayout.tar -C ./dataset/\n

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/paperlayout/\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 4734,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/train_4612.jpg\",\n      \"check_dataset\\/demo_img\\/train_4844.jpg\",\n      \"check_dataset\\/demo_img\\/train_0084.jpg\",\n      \"check_dataset\\/demo_img\\/train_0448.jpg\",\n      \"check_dataset\\/demo_img\\/train_4703.jpg\",\n      \"check_dataset\\/demo_img\\/train_3572.jpg\",\n      \"check_dataset\\/demo_img\\/train_4516.jpg\",\n      \"check_dataset\\/demo_img\\/train_2836.jpg\",\n      \"check_dataset\\/demo_img\\/train_1353.jpg\",\n      \"check_dataset\\/demo_img\\/train_0225.jpg\"\n    ],\n    \"val_samples\": 928,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/val_0982.jpg\",\n      \"check_dataset\\/demo_img\\/val_0607.jpg\",\n      \"check_dataset\\/demo_img\\/val_0623.jpg\",\n      \"check_dataset\\/demo_img\\/val_0890.jpg\",\n      \"check_dataset\\/demo_img\\/val_0036.jpg\",\n      \"check_dataset\\/demo_img\\/val_0654.jpg\",\n      \"check_dataset\\/demo_img\\/val_0895.jpg\",\n      \"check_dataset\\/demo_img\\/val_0059.jpg\",\n      \"check_dataset\\/demo_img\\/val_0142.jpg\",\n      \"check_dataset\\/demo_img\\/val_0088.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/paperlayout\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 4734\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 928\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/paperlayout\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a 1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 30\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 4\u3002 2. \u200b\u57fa\u4e8e\u200b RT-DETR-H_layout_3cls \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u56db\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.001\uff0c0.0005\uff0c0.0001\uff0c0.00001\u3002 3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0001\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 50\u3001100\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b mAP@0.50:0.95 1 0.00001 88.90 2 0.0001 92.41 3 0.0005 92.27 4 0.001 90.66

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.001 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [2\uff0c4\uff0c5] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b mAP@0.50:0.95 2 30 92.41 4 50 92.63 5 100 92.88

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5b8c\u5168\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

\u200b\u5728\u200b\u9009\u62e9\u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b\u65f6\u200b\uff0c\u200b\u8981\u200b\u8003\u8651\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u548c\u200b\u603b\u200b batch_size\uff0c\u200b\u4ee5\u53ca\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u5173\u7cfb\u200b\u3002\u200b\u9996\u5148\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u4e58\u4ee5\u200b\u5355\u5361\u200b batch_size \u200b\u7b49\u4e8e\u200b\u603b\u200b batch_size\u3002\u200b\u5176\u6b21\u200b\uff0c\u200b\u603b\u200b batch_size \u200b\u548c\u200b\u5b66\u4e60\u200b\u7387\u200b\u662f\u200b\u76f8\u5173\u200b\u7684\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u5e94\u200b\u4e0e\u200b\u603b\u200b batch_size \u200b\u4fdd\u6301\u200b\u540c\u6b65\u200b\u8c03\u6574\u200b\u3002 \u200b\u76ee\u524d\u200b\u9ed8\u8ba4\u200b\u5b66\u4e60\u200b\u7387\u200b\u5bf9\u5e94\u200b\u57fa\u4e8e\u200b 4 \u200b\u5361\u200b\u8bad\u7ec3\u200b\u7684\u200b\u603b\u200b batch_size\uff0c\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b\u5355\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u9664\u4ee5\u200b 4\u3002\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b 8 \u200b\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u4e58\u4ee5\u200b 2\u3002

\u200b\u8c03\u6574\u200b\u4e0d\u540c\u200b\u53c2\u6570\u200b\u6267\u884c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u547d\u4ee4\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#54","title":"5.4 \u200b\u6a21\u578b\u200b\u6d4b\u8bd5","text":"

\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u5355\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200btest.jpg\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u8bba\u6587\u200b\u6587\u732e\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

\u200b\u9996\u5148\u200b\u83b7\u53d6\u200b\u5e76\u200b\u66f4\u65b0\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6267\u884c\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

\u200b\u5c06\u200bPP-ChatOCRv3-doc.yaml\u200b\u4e2d\u200b\u7684\u200bPipeline.layout_model\u200b\u5b57\u200b\u6bb5\u200b\u4fee\u6539\u200b\u4e3a\u200b\u4e0a\u9762\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u4fee\u6539\u200b\u540e\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a

Pipeline:\n  layout_model: ./output/best_model/inference\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5e94\u7528\u200b\u914d\u7f6e\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u9875\u7709\u200b\", \"\u200b\u8868\u683c\u200b\u6807\u9898\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output_ft\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u6253\u5370\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7ed3\u679c\u200b\uff1a

{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u7b2c\u200b43\u200b\u5377\u200b\\n \u200b\u822a\u7a7a\u200b\u53d1\u52a8\u673a\u200b\\n 44', '\u200b\u8868\u683c\u200b\u6807\u9898\u200b': '\u200b\u8868\u200b1\u200b\u6a21\u62df\u200b\u6765\u6d41\u200bMa=5\u200b\u98de\u884c\u200b\u7684\u200b\u7a7a\u6c14\u200b\u52a0\u70ed\u5668\u200b\u5de5\u4f5c\u200b\u53c2\u6570\u200b'}, 'prompt': ''}\n

\u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u4e4b\u540e\u200b\uff0c\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u5df2\u7ecf\u200b\u88ab\u200b\u6b63\u786e\u200b\u7684\u200b\u63d0\u53d6\u200b\u51fa\u6765\u200b\u3002

\u200b\u7248\u9762\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff0c\u200b\u5df2\u7ecf\u200b\u6b63\u786e\u200b\u589e\u52a0\u200b\u4e86\u200b\u9875\u7709\u200b\u548c\u200b\u8868\u683c\u200b\u6807\u9898\u200b\u7684\u200b\u533a\u57df\u200b\u5b9a\u4f4d\u200b\u80fd\u529b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u5982\u200b\u4e0b\u9762\u200b\u4ee3\u7801\u200b\u6240\u793a\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u9875\u7709\u200b\", \"\u200b\u8868\u683c\u200b\u6807\u9898\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html","title":"PaddleX 3.0 \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3_doc\uff09 \u2014\u2014 \u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u5370\u7ae0\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u8be5\u4ea7\u7ebf\u200b\u7684\u200b\u5728\u200b\u5b9e\u9645\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002\u200b\u91c7\u7528\u200b\u4eba\u5de5\u667a\u80fd\u200b\u6280\u672f\u200b\u8fdb\u884c\u200b\u5370\u7ae0\u200b\u81ea\u52a8\u8bc6\u522b\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u6709\u6548\u200b\u8282\u7701\u200b\u4eba\u529b\u200b\u6210\u672c\u200b\uff0c\u200b\u63d0\u9ad8\u6548\u7387\u200b\u3002

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u8282\u200b\u4e3a\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\uff0c\u200b\u4e0d\u96be\u200b\u53d1\u73b0\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u4e0e\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4efb\u52a1\u200b\u5b58\u5728\u200b\u7740\u200b\u7d27\u5bc6\u200b\u7684\u200b\u5173\u8054\u200b\u3002\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\uff0c\u200b\u5373\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\uff0c\u200b\u662f\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u9886\u57df\u200b\u7684\u200b\u4e00\u4e2a\u200b\u7ecf\u5178\u200b\u95ee\u9898\u200b\u3002\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u4e5f\u200b\u53ef\u4ee5\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b Python \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#21","title":"2.1 \u200b\u672c\u5730\u200b\u4f53\u9a8c","text":"

\u200b\u5728\u200b\u672c\u5730\u200b\u4f7f\u7528\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u6309\u7167\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u5b8c\u6210\u200b\u4e86\u200bPaddleX\u200b\u7684\u200bwheel\u200b\u5305\u200b\u5b89\u88c5\u200b\u3002\u200b\u51e0\u884c\u200b\u4ee3\u7801\u200b\u5373\u53ef\u200b\u5b8c\u6210\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5feb\u901f\u200b\u63a8\u7406\u200b\uff1a

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u4f7f\u7528\u200b\u5343\u5e06\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u6ce8\u200b\uff1a\u200b\u76ee\u524d\u200b\u4ec5\u200b\u652f\u6301\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\uff0c\u200b\u652f\u6301\u200b\u5728\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\u6216\u8005\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\u200b\u4e0a\u200b\u83b7\u53d6\u200b\u76f8\u5173\u200b\u7684\u200b ak/sk(access_token)\u3002\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u767e\u5ea6\u200b\u4e91\u5343\u5e06\u200b\u5e73\u53f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200bAK\u200b\u548c\u200bSK\u200b\u9274\u6743\u200b\u8c03\u7528\u200bAPI\u200b\u6d41\u7a0b\u200b \u200b\u83b7\u53d6\u200bak/sk\uff0c\u200b\u5982\u679c\u200b\u4f7f\u7528\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio\uff0c\u200b\u53ef\u4ee5\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b AIStudio \u200b\u8bbf\u95ee\u200b\u4ee4\u724c\u200b\u4e2d\u200b\u83b7\u53d6\u200b access_token\u3002

\u200b\u8f93\u51fa\u200b\u6253\u5370\u200b\u7684\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

The result has been saved in output/tmpx5tmgsem_curve_0.jpg.\nThe result has been saved in output/tmpx5tmgsem_layout.jpg.\nThe result has been saved in output/tmpx5tmgsem_ocr.jpg.\nThe retrieved vectorstore is not for PaddleX and will return vectorstore directly\n\n{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u51fb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

\u200b\u5728\u200boutput \u200b\u76ee\u5f55\u200b\u4e2d\u200b\uff0c\u200b\u4fdd\u5b58\u200b\u4e86\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u3001OCR\uff08\u200b\u5982\u200b\u6709\u200b\u8868\u683c\u200b\uff0c\u200b\u8fd8\u6709\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u4ee5\u53ca\u200b\u8868\u683c\u200bhtml\u200b\u548c\u200bxlsx\uff09\u200b\u7ed3\u679c\u200b\u3002

\u200b\u5176\u4e2d\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u901a\u8fc7\u200b\u4e0a\u9762\u200b\u7684\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7684\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u53ef\u4ee5\u200b\u8fdb\u884c\u200b Badcase \u200b\u5206\u6790\u200b\uff0c\u200b\u53d1\u73b0\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\uff0c\u200b\u5728\u200b\u5f53\u524d\u200b\u9700\u6c42\u200b\u573a\u666f\u200b\u4e2d\u200b\u5b58\u5728\u200b\u4e0b\u9762\u200b\u7684\u200b\u95ee\u9898\u200b\uff1a\u200b\u5728\u200bOCR\u200b\u8bc6\u522b\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u4e2d\u200b\uff0c\u200b\u5370\u7ae0\u200b\u7684\u200b\u6587\u672c\u200b\u5f2f\u66f2\u200b\u68c0\u6d4b\u200b\u6846\u6709\u200b\u504f\u5dee\u200b\uff0c\u200b\u5bfc\u81f4\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u9519\u8bef\u200b\uff1b\u200b\u5370\u7ae0\u200b\u7684\u200b\u4fe1\u606f\u200b\u6ca1\u6709\u200b\u88ab\u200b\u6b63\u786e\u200b\u7684\u200b\u62bd\u53d6\u200b\u51fa\u6765\u200b\u3002\u200b\u5728\u200b{'chat_res': {'\u200b\u5370\u7ae0\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\u200b\u4e2d\u200b\u7684\u200b\u7ed3\u679c\u200b\u662f\u200b\u672a\u77e5\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u672c\u200b\u8282\u200b\u5de5\u4f5c\u200b\u805a\u7126\u200b\u4e8e\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7684\u200b\u573a\u666f\u200b\uff0c\u200b\u5bf9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u5fae\u8c03\u200b\uff0c\u200b\u4ece\u800c\u200b\u8fbe\u5230\u200b\u80fd\u591f\u200b\u7cbe\u786e\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u7684\u200b\u80fd\u529b\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#22","title":"2.2 \u200b\u5728\u7ebf\u200b\u4f53\u9a8c","text":"

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4f53\u9a8c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u70b9\u51fb\u200b\u94fe\u63a5\u200b\u4e0b\u8f7d\u200b \u200b\u5370\u7ae0\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u4e0a\u4f20\u200b\u81f3\u200b\u5b98\u65b9\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u62bd\u53d6\u200b\u6548\u679c\u200b\u3002\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 2 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u5370\u7ae0\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/practical_seal.tar -P ./dataset\ntar -xf ./dataset/practical_seal.tar -C ./dataset/\n

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/practical_seal/\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u200b\u68c0\u6d4b\u200b\u6846\u200b\u957f\u5bbd\u200b\u6bd4\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 793,\n    \"train_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4055390_00006_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3712248_00008_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4227328_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3745965_00007_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3980931_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC5896212_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3838814_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4677212_00002_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4058803_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4925966_00001_seal_0_crop.png\"\n    ],\n    \"val_samples\": 277,\n    \"val_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/15.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/16.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/17.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/18.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/19.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/20.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/21.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/22.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/23.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/24.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/practical_seal\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 793\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 277\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u957f\u5bbd\u200b\u6bd4\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4 \\\n    -o Train.learning_rate=0.0001\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/practical_seal\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a 1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 30\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 4\u3002 2. \u200b\u57fa\u4e8e\u200b PP-OCRv4_server_seal_det \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.001\uff0c0.0001\uff0c0.00001\u3002 3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b1\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 100\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b \u200b\u68c0\u6d4b\u200b Hmean(%) 1 0.001 97.35 2 0.0001 93.32 3 0.00001 87.63

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.001 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [1\uff0c4] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b \u200b\u68c0\u6d4b\u200b Hmean(%) 1 30 97.35 4 100 98.13

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5b8c\u5168\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

\u200b\u5728\u200b\u9009\u62e9\u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b\u65f6\u200b\uff0c\u200b\u8981\u200b\u8003\u8651\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u548c\u200b\u603b\u200b batch_size\uff0c\u200b\u4ee5\u53ca\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u5173\u7cfb\u200b\u3002\u200b\u9996\u5148\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u4e58\u4ee5\u200b\u5355\u5361\u200b batch_size \u200b\u7b49\u4e8e\u200b\u603b\u200b batch_size\u3002\u200b\u5176\u6b21\u200b\uff0c\u200b\u603b\u200b batch_size \u200b\u548c\u200b\u5b66\u4e60\u200b\u7387\u200b\u662f\u200b\u76f8\u5173\u200b\u7684\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u5e94\u200b\u4e0e\u200b\u603b\u200b batch_size \u200b\u4fdd\u6301\u200b\u540c\u6b65\u200b\u8c03\u6574\u200b\u3002 \u200b\u76ee\u524d\u200b\u9ed8\u8ba4\u200b\u5b66\u4e60\u200b\u7387\u200b\u5bf9\u5e94\u200b\u57fa\u4e8e\u200b 4 \u200b\u5361\u200b\u8bad\u7ec3\u200b\u7684\u200b\u603b\u200b batch_size\uff0c\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b\u5355\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u9664\u4ee5\u200b 4\u3002\u200b\u82e5\u200b\u60a8\u200b\u6253\u7b97\u200b\u5728\u200b 8 \u200b\u5361\u200b\u73af\u5883\u200b\u4e0b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5219\u200b\u8bbe\u7f6e\u200b\u5b66\u4e60\u200b\u7387\u65f6\u200b\u9700\u200b\u76f8\u5e94\u200b\u4e58\u4ee5\u200b 2\u3002

\u200b\u8c03\u6574\u200b\u4e0d\u540c\u200b\u53c2\u6570\u200b\u6267\u884c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u547d\u4ee4\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\uff1a

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u5370\u7ae0\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

\u200b\u9996\u5148\u200b\u83b7\u53d6\u200b\u5e76\u200b\u66f4\u65b0\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6267\u884c\u200b\u4e0b\u9762\u200b\u7684\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\uff08\u200b\u5047\u8bbe\u200b\u81ea\u5b9a\u4e49\u200b\u4fdd\u5b58\u200b\u4f4d\u7f6e\u200b\u4e3a\u200b ./my_path \uff09\uff1a

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

\u200b\u5c06\u200bPP-ChatOCRv3-doc.yaml\u200b\u4e2d\u200b\u7684\u200bPipeline.seal_text_det_model\u200b\u5b57\u200b\u6bb5\u200b\u4fee\u6539\u200b\u4e3a\u200b\u4e0a\u9762\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff0c\u200b\u4fee\u6539\u200b\u540e\u200b\u914d\u7f6e\u200b\u5982\u4e0b\u200b\uff1a

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: ./output/best_accuracy/inference\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

\u200b\u4fee\u6539\u200b\u540e\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u4fee\u6539\u200b create_pipeline \u200b\u65b9\u6cd5\u200b\u4e2d\u200b\u7684\u200b pipeline \u200b\u53c2\u6570\u503c\u200b\u4e3a\u4ea7\u7ebf\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\u5373\u53ef\u200b\u5e94\u7528\u200b\u914d\u7f6e\u200b\u3002

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output_ft\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u6253\u5370\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u7ed3\u679c\u200b\uff1a

{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u5e7f\u5173\u5e02\u200b\u56fd\u58eb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

\u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u5fae\u8c03\u200b\u4e4b\u540e\u200b\uff0c\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u5df2\u7ecf\u200b\u88ab\u200b\u6b63\u786e\u200b\u7684\u200b\u63d0\u53d6\u200b\u51fa\u6765\u200b\u3002

\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u7684\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff0c\u200b\u5df2\u7ecf\u200b\u6b63\u786e\u200b\u62bd\u53d6\u200b\u5370\u7ae0\u200b\u4fe1\u606f\u200b\uff1a

"},{"location":"practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u5982\u200b\u4e0b\u9762\u200b\u4ee3\u7801\u200b\u6240\u793a\u200b\uff1a
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u5783\u573e\u200b\u7684\u200b\u5177\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08ImageNet-1k \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 80 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b Top1 Acc(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) PP-HGNetV2_B6 86.30 10.46 240.18 288 CLIP_vit_base_patch16_224 85.39 12.03 234.85 331 PP-HGNetV2_B4 83.57 2.45 38.10 76 SwinTransformer_base_patch4_window7_224 83.37 12.35 - 342 PP-HGNet_small 81.51 4.24 108.21 94 PP-HGNetV2_B0 77.77 0.68 6.41 23 ResNet50 76.50 3.12 50.90 98 PP-LCNet_x1_0 71.32 1.01 3.39 7 MobileNetV3_small_x1_0 68.24 1.09 3.65 12

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\uff0cGPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-LCNet_x1_0 \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u5783\u573e\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/trash40.tar -P ./dataset\ntar -xf ./dataset/trash40.tar -C ./dataset/\n

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/trash40/\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": ../../dataset/trash40/label.txt\",\n    \"num_classes\": 40,\n    \"train_samples\": 1605,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/img_14950.jpg\",\n      \"check_dataset/demo_img/img_12045.jpg\",\n    ],\n    \"val_samples\": 3558,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/img_198.jpg\",\n      \"check_dataset/demo_img/img_19627.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/trash40/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 40\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1605\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 3558\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/trash40 \\\n    -o Train.num_classes=40\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/trash40\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\uff0c\u200b\u56e0\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6570\u636e\u91cf\u200b\u8f83\u200b\u5c0f\u200b\uff0c\u200b\u6240\u4ee5\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 64\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-LCNet_x1_0 \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.01\uff0c0.001\uff0c0.1\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.01\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8f6e\u6b21\u200b\u5728\u200b 100epoch \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b Top1 Acc \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 20 0.01 64 4\u200b\u5361\u200b 73.83% \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 20 0.001 64 4\u200b\u5361\u200b 30.64% \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 20 0.1 64 4\u200b\u5361\u200b 71.53%

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b Top1 Acc \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 20 0.01 64 4\u200b\u5361\u200b 73.83% \u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 50 0.01 64 4\u200b\u5361\u200b 77.32% \u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 80 0.01 64 4\u200b\u5361\u200b 77.60% \u200b\u5b9e\u9a8c\u200b\u4e00\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.01 64 4\u200b\u5361\u200b 77.80%

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b \u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bgarbage_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/image_classification_garbage_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/image_classification.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/image_classification.yaml\")\noutput = pipeline.predict(\"./dataset/trash40/images/test/0/img_154.jpg\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5206\u5272\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline instance_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u5206\u5272\u200b\u51fa\u200b\u5730\u7406\u200b\u7a7a\u95f4\u200b\u5bf9\u8c61\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 15 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mAP(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) Mask-RT-DETR-H 48.8 61.40 486 Mask-RT-DETR-X 47.5 45.70 257 Mask-RT-DETR-L 45.7 37.40 123 Mask-RT-DETR-S 40.9 32.40 57

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\uff0cGPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA V100 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b Mask-RT-DETR-H \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/intseg_remote_sense_coco.tar -P ./dataset\ntar -xf ./dataset/intseg_remote_sense_coco.tar -C ./dataset/\n

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 2989,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/524.jpg\",\n      \"check_dataset/demo_img/024.jpg\",\n    ],\n    \"val_samples\": 932,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/326.jpg\",\n      \"check_dataset/demo_img/596.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/intseg_remote_sense_coco/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 10\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 2989\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 932\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco \\\n    -o Train.num_classes=10\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 80\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 2\u3002
  2. \u200b\u57fa\u4e8e\u200b Mask-RT-DETR-H \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.0005\uff0c0.005\uff0c0.0001
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0001\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 80 0.0005 2 4\u200b\u5361\u200b 0.695 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 80 0.0001 2 4\u200b\u5361\u200b 0.825 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 80 0.00005 2 4\u200b\u5361\u200b 0.706

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 80 0.0001 2 4\u200b\u5361\u200b 0.825 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 30 0.0001 2 4\u200b\u5361\u200b 0.287 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 50 0.0001 2 4\u200b\u5361\u200b 0.545 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.0001 2 4\u200b\u5361\u200b 0.813

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bremotesensing_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/instance_segmentation.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/instance_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u68c0\u6d4b\u200b\u884c\u4eba\u200b\u662f\u5426\u200b\u8dcc\u5012\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 37 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mAP(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200bPP-YOLOE_plus-S\u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/object_detection_fall_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u884c\u4eba\u200b\u8dcc\u5012\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/fall_det.tar -P ./dataset\ntar -xf ./dataset/fall_det.tar -C ./dataset/\n

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/fall_det\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 1224,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/fall_1168.jpg\",\n      \"check_dataset/demo_img/fall_1113.jpg\"\n    ],\n    \"val_samples\": 216,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/fall_349.jpg\",\n      \"check_dataset/demo_img/fall_394.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/fall_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 1\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1224\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 216\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/object_detection_fall_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/fall_det \\\n    -o Train.num_classes=1\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/fall_det\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 10\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 8\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-YOLOE_plus-S \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.00002\uff0c0.0001\uff0c0.0005\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0001\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8f6e\u6b21\u200b\u5728\u200b 100epoch \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 10 0.00002 8 4\u200b\u5361\u200b 0.880 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 10 0.0001 8 4\u200b\u5361\u200b 0.910 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 10 0.0005 8 4\u200b\u5361\u200b 0.888

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 10 0.0001 8 4\u200b\u5361\u200b 0.910 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 50 0.0001 8 4\u200b\u5361\u200b 0.944 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.0001 8 4\u200b\u5361\u200b 0.947

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bfall.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/object_detection_fall_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/object_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u80fd\u200b\u68c0\u6d4b\u200b\u51fa\u200b\u65f6\u5c1a\u200b\u670d\u88c5\u200b\u5143\u7d20\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08COCO \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 37 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mAP(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PicoDet-L \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u670d\u88c5\u200b\u65f6\u5c1a\u200b\u5143\u7d20\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_mini_fashion_pedia_coco.tar -P ./dataset\ntar -xf ./dataset/det_mini_fashion_pedia_coco.tar -C ./dataset/\n

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 15,\n    \"train_samples\": 4000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/297ea597f7dfa6d710b2e8176cb3b913.jpg\",\n      \"check_dataset/demo_img/2d8b75ce472dbebd41ca8527f0a292f3.jpg\"\n    ],\n    \"val_samples\": 800,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/40e13ebcfa281567c92fc9842510abea.jpg\",\n      \"check_dataset/demo_img/87808e379034ac2344f5132d3dccc6e6.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_mini_fashion_pedia_coco\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 15\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 4000\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 800\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco \\\n    -o Train.num_classes=15\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 50\uff1a-o Train.epochs_iters=50\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/best_model.pdparams\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 50\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\u3002
  2. \u200b\u57fa\u4e8e\u200b PicoDet-L \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.02\uff0c0.04\uff0c0.08\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.04\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8f6e\u6b21\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8f6e\u6b21\u200b\u5728\u200b 80epoch \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 50 0.02 16 4\u200b\u5361\u200b 0.428 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 50 0.04 16 4\u200b\u5361\u200b 0.471 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 50 0.08 16 4\u200b\u5361\u200b 0.440

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mAP@0.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 50 0.04 16 4\u200b\u5361\u200b 0.471 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 30 0.04 16 4\u200b\u5361\u200b 0.425 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 80 0.04 16 4\u200b\u5361\u200b 0.491 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b 100 0.04 16 4\u200b\u5361\u200b 0.459

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bFashionPedia_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/object_detection_fashion_pedia_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/object_detection.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200bOCR\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200bOCR\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 2 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b \u200b\u68c0\u6d4b\u200bHmean(%) \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleOCR \u200b\u81ea\u200b\u5efa\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u68c0\u6d4b\u200bHmean \u200b\u548c\u200b \u200b\u8bc6\u522b\u200b Avg Accuracy\uff0cGPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002 \u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-OCRv4_server \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ocr_det_license_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u8f66\u724c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ccpd_text_det.tar -P ./dataset\ntar -xf ./dataset/ccpd_text_det.tar -C ./dataset/\n

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 5769,\n    \"train_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/0274305555556-90_266-204&460_520&548-516&548_209&547_204&464_520&460-0_0_3_25_24_24_24_26-63-89.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0126171875-90_267-294&424_498&486-498&486_296&485_294&425_496&424-0_0_3_24_33_32_30_31-157-29.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0371516927083-89_254-178&423_517&534-517&534_204&525_178&431_496&423-1_0_3_24_33_31_29_31-117-667.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/03349609375-90_268-211&469_526&576-526&567_214&576_211&473_520&469-0_0_3_27_31_32_29_32-174-48.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0388454861111-90_269-138&409_496&518-496&518_138&517_139&410_491&409-0_0_3_24_27_26_26_30-174-148.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0198741319444-89_112-208&517_449&600-423&593_208&600_233&517_449&518-0_0_3_24_28_26_26_26-87-268.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3027782118055555555-91_92-186&493_532&574-529&574_199&565_186&497_532&493-0_0_3_27_26_30_33_32-73-336.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/034375-90_258-168&449_528&546-528&542_186&546_168&449_525&449-0_0_3_26_30_30_26_33-94-221.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0286501736111-89_92-290&486_577&587-576&577_290&587_292&491_577&486-0_0_3_17_25_28_30_33-134-122.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/02001953125-92_103-212&486_458&569-458&569_224&555_212&486_446&494-0_0_3_24_24_25_24_24-88-24.jpg\"\n    ],\n    \"val_samples\": 1001,\n    \"val_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/3056141493055555554-88_93-205&455_603&597-603&575_207&597_205&468_595&455-0_0_3_24_32_27_31_33-90-213.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0680295138889-88_94-120&474_581&623-577&605_126&623_120&483_581&474-0_0_5_24_31_24_24_24-116-518.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0482421875-87_265-154&388_496&530-490&495_154&530_156&411_496&388-0_0_5_25_33_33_33_33-84-104.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0347504340278-105_106-235&443_474&589-474&589_240&518_235&443_473&503-0_0_3_25_30_33_27_30-162-4.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0205338541667-93_262-182&428_410&519-410&519_187&499_182&428_402&442-0_0_3_24_26_29_32_24-83-63.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0380913628472-97_250-234&403_529&534-529&534_250&480_234&403_528&446-0_0_3_25_25_24_25_25-185-85.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/020598958333333334-93_267-256&471_482&563-478&563_256&546_262&471_482&484-0_0_3_26_24_25_32_24-102-115.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3030323350694444445-86_131-170&495_484&593-434&569_170&593_226&511_484&495-11_0_5_30_30_31_33_24-118-59.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3016158854166666667-86_97-243&471_462&546-462&527_245&546_243&479_453&471-0_0_3_24_30_27_24_29-98-40.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0340831163194-89_264-177&412_488&523-477&506_177&523_185&420_488&412-0_0_3_24_30_29_31_31-109-46.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/ccpd_text_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 5769\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 1001\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ocr_det_license_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 10\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 8\uff0c\u200b\u5361\u6570\u200b\u9009\u62e9\u200b 4 \u200b\u5361\u200b\uff0c\u200b\u603b\u6279\u200b\u5927\u5c0f\u200b\u662f\u200b 32\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-OCRv4_server_det \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u56db\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.00005\uff0c0.0001\uff0c0.0005\uff0c0.001\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b 4 \u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b0.001\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b \u200b\u68c0\u6d4b\u200bHmean(%) 1 0.00005 99.06 2 0.0001 99.55 3 0.0005 99.60 4 0.001 99.70

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.001 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [4\uff0c5] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002 \u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b \u200b\u68c0\u6d4b\u200b Hmean(%) 4 10 99.70 5 20 99.80

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir output/best_accuracy/inference None \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bcase1.jpg\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/ocr_det_license_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/OCR.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200bOCR\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u624b\u5199\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u624b\u5199\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u624b\u5199\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200bOCR\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200bOCR\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 4 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200bOCR\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200b benchmark \u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b \u200b\u68c0\u6d4b\u200bHmean(%) \u200b\u8bc6\u522b\u200b Avg Accuracy(%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

\u200b\u6ce8\u200b\uff1a\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b1.1w\u200b\u5f20\u200b\u56fe\u7247\u200b\uff0c\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b500\u200b\u5f20\u200b\u56fe\u7247\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b 8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32 \u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-OCRv4_server \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u624b\u5199\u4f53\u200b\u4e2d\u6587\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b/\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/handwrite_chinese_text_rec.tar -P ./dataset\ntar -xf ./dataset/handwrite_chinese_text_rec.tar -C ./dataset/\n

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 23965,\n    \"train_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/64957.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/138926.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/86760.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/83191.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/79882.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/58639.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1187-P16_1.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/8199.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1225-P19_9.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/183335.png\"\n    ],\n    \"val_samples\": 17259,\n    \"val_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/11.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/12.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/13.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/14.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/15.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/16.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/17.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/18.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/19.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/20.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/handwrite_chinese_text_rec\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 23965\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 17259\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u65f6\u200b\uff0c\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdopt\u3001.pdstates\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 8, \u200b\u5361\u6570\u200b\u9009\u62e9\u200b 4 \u200b\u5361\u200b\uff0c\u200b\u603b\u6279\u200b\u5927\u5c0f\u200b\u662f\u200b 32\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-OCRv4_server_rec \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u56db\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.001\uff0c0.005\uff0c0.0002\uff0c0.0001.
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b 3 \u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.0002\uff0c\u200b\u540c\u65f6\u200b\u89c2\u5bdf\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u5206\u6570\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u5728\u200b\u6700\u540e\u200b\u51e0\u8f6e\u200b\u4ecd\u200b\u5728\u200b\u4e0a\u6da8\u200b\u3002\u200b\u56e0\u6b64\u200b\u53ef\u4ee5\u200b\u63d0\u5347\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 30\u300150 \u200b\u548c\u200b 80\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u4f1a\u200b\u6709\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200bID \u200b\u5b66\u4e60\u200b\u7387\u200b \u200b\u8bc6\u522b\u200b Acc (%) 1 0.001 43.28 2 0.005 32.63 3 0.0002 49.64 4 0.0001 46.32

\u200b\u63a5\u4e0b\u6765\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u5728\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0.0002 \u200b\u7684\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u589e\u52a0\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u5bf9\u6bd4\u200b\u4e0b\u9762\u200b\u5b9e\u9a8c\u200b [4, 5, 6, 7] \u200b\u53ef\u77e5\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u589e\u5927\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u6709\u200b\u4e86\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u63d0\u5347\u200b\u3002 \u200b\u5b9e\u9a8c\u200bID \u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b \u200b\u8bc6\u522b\u200b Acc (%) 4 20 49.64 5 30 52.03 6 50 54.15 7 80 54.35

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b 4 \u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b 1 \u200b\u5f20\u200b GPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir None output/best_accuracy/inference \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bcase.jpg\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/ocr_rec_chinese_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/OCR.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b OCR \u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html","title":"PaddleX 3.0 \u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u5b89\u88c5\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6b64\u5904\u200b\u4e3a\u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\uff0c\u200b\u9700\u8981\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX wheel \u200b\u5305\u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a

    paddlex --pipeline semantic_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\n

  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u524d\u5f80\u200bAI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\uff0c\u200b\u70b9\u51fb\u200b\u3010\u200b\u521b\u5efa\u200b\u4ea7\u7ebf\u200b\u3011\uff0c\u200b\u521b\u5efa\u200b\u3010\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u3011\u200b\u4ea7\u7ebf\u200b\u8fdb\u884c\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff1b

\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\u4ea7\u51fa\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u793a\u4f8b\u200b\uff1a

\u200b\u5f53\u200b\u4f53\u9a8c\u200b\u5b8c\u8be5\u200b\u4ea7\u7ebf\u200b\u4e4b\u540e\u200b\uff0c\u200b\u9700\u8981\u200b\u786e\u5b9a\u200b\u4ea7\u7ebf\u200b\u662f\u5426\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff08\u200b\u5305\u542b\u200b\u7cbe\u5ea6\u200b\u3001\u200b\u901f\u5ea6\u200b\u7b49\u200b\uff09\uff0c\u200b\u4ea7\u7ebf\u200b\u5305\u542b\u200b\u7684\u200b\u6a21\u578b\u200b\u662f\u5426\u200b\u9700\u8981\u200b\u7ee7\u7eed\u200b\u5fae\u8c03\u200b\uff0c\u200b\u5982\u679c\u200b\u6a21\u578b\u200b\u7684\u200b\u901f\u5ea6\u200b\u6216\u8005\u200b\u7cbe\u5ea6\u200b\u4e0d\u200b\u7b26\u5408\u200b\u9884\u671f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u6a21\u578b\u200b\u9009\u62e9\u200b\u9009\u62e9\u200b\u53ef\u200b\u66ff\u6362\u200b\u7684\u200b\u6a21\u578b\u200b\u7ee7\u7eed\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u786e\u5b9a\u200b\u6548\u679c\u200b\u662f\u5426\u200b\u6ee1\u610f\u200b\u3002\u200b\u5982\u679c\u200b\u6700\u7ec8\u200b\u6548\u679c\u200b\u5747\u200b\u4e0d\u200b\u6ee1\u610f\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u5e0c\u671b\u200b\u4ea7\u51fa\u200b\u5206\u5272\u200b\u51fa\u200b\u8f66\u9053\u200b\u7ebf\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u663e\u7136\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\uff08Cityscapes \u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\uff09\u200b\u65e0\u6cd5\u200b\u6ee1\u8db3\u8981\u6c42\u200b\uff0c\u200b\u9700\u8981\u200b\u91c7\u96c6\u200b\u548c\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\uff0c\u200b\u7136\u540e\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\u5fae\u8c03\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b 18 \u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u90e8\u5206\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u5217\u8868\u200b mIoU (%) GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) CPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b(ms) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) OCRNet_HRNet-W48 82.15 87.97 2180.76 270 PP-LiteSeg-T 77.04 5.98 140.02 31

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b\u3002GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

\u200b\u7b80\u5355\u200b\u6765\u8bf4\u200b\uff0c\u200b\u8868\u683c\u200b\u4ece\u4e0a\u5230\u4e0b\u200b\uff0c\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u66f4\u200b\u5feb\u200b\uff0c\u200b\u4ece\u4e0b\u5230\u4e0a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u66f4\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4ee5\u200b PP-LiteSeg-T \u200b\u6a21\u578b\u200b\u4e3a\u4f8b\u200b\uff0c\u200b\u5b8c\u6210\u200b\u4e00\u6b21\u200b\u6a21\u578b\u200b\u5168\u200b\u6d41\u7a0b\u200b\u5f00\u53d1\u200b\u3002\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u672c\u200b\u6559\u7a0b\u200b\u91c7\u7528\u200b \u200b\u8f66\u9053\u200b\u7ebf\u200b\u5206\u5272\u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u4f5c\u4e3a\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5982\u679c\u200b\u60a8\u200b\u4f7f\u7528\u200b\u81ea\u5907\u200b\u7684\u200b\u5df2\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u9700\u8981\u200b\u6309\u7167\u200b PaddleX \u200b\u7684\u200b\u683c\u5f0f\u200b\u8981\u6c42\u200b\u5bf9\u200b\u81ea\u5907\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u6ee1\u8db3\u200b PaddleX \u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u8981\u6c42\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b PaddleX \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4efb\u52a1\u200b\u6a21\u5757\u200b\u6570\u636e\u200b\u6807\u6ce8\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/semantic-segmentation-makassaridn-road-dataset.tar -P ./dataset\ntar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./dataset/\n

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u53ef\u89c6\u5316\u200b\u7684\u200b\u793a\u4f8b\u200b\u6837\u672c\u200b\u56fe\u7247\u200b\u548c\u200b\u6837\u672c\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 300,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/20220311151733_0060_040.jpg\",\n      \"check_dataset/demo_img/20220311153115_0023_039.jpg\"\n    ],\n    \"val_samples\": 74,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/20220311152033_0060_007.jpg\",\n      \"check_dataset/demo_img/20220311144930_0060_026.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/semantic-segmentation-makassaridn-road-dataset\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.num_classes\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7c7b\u522b\u200b\u6570\u4e3a\u200b 4\uff0c\u200b\u6b64\u5904\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\u4e3a\u200b\u540e\u7eed\u200b\u8bad\u7ec3\u200b\u9700\u8981\u200b\u4f20\u5165\u200b\u7684\u200b\u7c7b\u522b\u200b\u6570\u91cf\u200b\uff1b
  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 300\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 74\uff1b
  • attributes.train_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b
  • attributes.val_sample_paths\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u7247\u200b\u76f8\u5bf9\u8def\u5f84\u200b\u5217\u8868\u200b\uff1b

\u200b\u53e6\u5916\u200b\uff0c\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u8fd8\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u6240\u6709\u200b\u7c7b\u522b\u200b\u7684\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u5206\u5e03\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5206\u6790\u200b\uff0c\u200b\u5e76\u200b\u7ed8\u5236\u200b\u4e86\u200b\u5206\u5e03\u200b\u76f4\u65b9\u56fe\u200b\uff08histogram.png\uff09\uff1a

\u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b CheckDataset \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • CheckDataset:
    • convert:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False;
      • src_dataset_type: \u200b\u5982\u679c\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u5219\u200b\u9700\u200b\u8bbe\u7f6e\u200b\u6e90\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\uff0c\u200b\u6570\u636e\u200b\u53ef\u9009\u6e90\u200b\u683c\u5f0f\u200b\u4e3a\u200b LabelMe \u200b\u548c\u200b VOC\uff1b
    • split:
      • enable: \u200b\u662f\u5426\u200b\u8fdb\u884c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u4e3a\u200b True \u200b\u65f6\u200b\u8fdb\u884c\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b False\uff1b
      • train_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b val_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b
      • val_percent: \u200b\u5982\u679c\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5219\u200b\u9700\u8981\u200b\u8bbe\u7f6e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7684\u200b\u767e\u5206\u6bd4\u200b\uff0c\u200b\u7c7b\u578b\u200b\u4e3a\u200b 0-100 \u200b\u4e4b\u95f4\u200b\u7684\u200b\u4efb\u610f\u200b\u6574\u6570\u200b\uff0c\u200b\u9700\u8981\u200b\u4fdd\u8bc1\u200b\u548c\u200b train_percent \u200b\u503c\u52a0\u200b\u548c\u200b\u4e3a\u200b 100\uff1b

\u200b\u6570\u636e\u200b\u8f6c\u6362\u200b\u548c\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u652f\u6301\u200b\u540c\u65f6\u200b\u5f00\u542f\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u6570\u636e\u200b\u5212\u5206\u200b\u539f\u6709\u200b\u6807\u6ce8\u200b\u6587\u4ef6\u200b\u4f1a\u200b\u88ab\u200b\u5728\u200b\u539f\u200b\u8def\u5f84\u200b\u4e0b\u200b\u91cd\u547d\u540d\u200b\u4e3a\u200b xxx.bak\uff0c\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u4f8b\u5982\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\u5e76\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u4e0e\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6bd4\u4f8b\u200b\uff1a-o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \\\n    -o Train.num_classes=4\n

\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b/\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
    • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\uff1b
    • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff0c\u200b\u9664\u200b cpu \u200b\u5916\u200b\uff0c\u200b\u591a\u5361\u200b\u8bad\u7ec3\u200b\u53ef\u200b\u6307\u5b9a\u200b\u5361\u53f7\u200b\uff0c\u200b\u5982\u200b\uff1agpu:0,1,2,3\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
    • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
    • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b

\u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u901a\u7528\u200b\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a - \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 2 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0,1\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff1a-o Train.epochs_iters=5000\u3002 - \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b - PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • .pdparams\u3001.pdema\u3001.pdopt.pdstate\u3001.pdiparams\u3001.pdmodel\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001EMA\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u7f51\u7edc\u7ed3\u6784\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u4e3a\u200b 5000\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 2\u3002
  2. \u200b\u57fa\u4e8e\u200b PP-LiteSeg-T \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.006\uff0c0.008\uff0c0.01\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u7684\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.008\uff0c\u200b\u5728\u200b\u8be5\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u57fa\u7840\u200b\u4e0a\u200b\uff0c\u200b\u6539\u53d8\u200b\u8bad\u7ec3\u200b\u8bba\u200b\u6b21\u6570\u200b\uff0c\u200b\u89c2\u5bdf\u200b\u4e0d\u540c\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u7ed3\u679c\u200b\uff0c\u200b\u53d1\u73b0\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b\u5728\u200b 80000 \u200b\u65f6\u200b\u57fa\u672c\u200b\u8fbe\u5230\u200b\u4e86\u200b\u6700\u4f73\u200b\u7cbe\u5ea6\u200b\u3002

\u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5000 0.006 2 4\u200b\u5361\u200b 0.623 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5000 0.008 2 4\u200b\u5361\u200b 0.629 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5000 0.01 2 4\u200b\u5361\u200b 0.619

\u200b\u6539\u53d8\u200b epoch \u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a \u200b\u5b9e\u9a8c\u200b \u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b mIoU \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5000 0.008 2 4\u200b\u5361\u200b 0.629 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u51cf\u5c11\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 10000 0.008 2 4\u200b\u5361\u200b 0.773 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 40000 0.008 2 4\u200b\u5361\u200b 0.855 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8fed\u4ee3\u200b\u6b21\u6570\u200b 80000 0.008 2 4\u200b\u5361\u200b 0.863

\u200b\u6ce8\u200b\uff1a\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e3a\u200b4\u200b\u5361\u200b\u6559\u7a0b\u200b\uff0c\u200b\u5982\u679c\u200b\u60a8\u200b\u53ea\u6709\u200b1\u200b\u5f20\u200bGPU\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u5361\u6570\u200b\u5b8c\u6210\u200b\u672c\u6b21\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u4f46\u200b\u6700\u7ec8\u200b\u6307\u6807\u200b\u672a\u5fc5\u200b\u548c\u200b\u4e0a\u8ff0\u200b\u6307\u6807\u200b\u5bf9\u9f50\u200b\uff0c\u200b\u5c5e\u200b\u6b63\u5e38\u200b\u60c5\u51b5\u200b\u3002

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u5982\u200b\uff1a

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\"\n

\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200bmakassaridn-road_demo.png\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u5982\u4e0b\u200b\uff1a

"},{"location":"practical_tutorials/semantic_segmentation_road_tutorial.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002 1. \u200b\u76f4\u63a5\u200b\u5c06\u200b\u8bad\u7ec3\u200b\u597d\u200b\u7684\u200b\u6a21\u578b\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff0c\u200b\u5e76\u200b\u5c06\u200bpaddlex/pipelines/semantic_segmentation.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bPipeline.model\u200b\u4fee\u6539\u200b\u4e3a\u200b\u81ea\u5df1\u200b\u7684\u200b\u6a21\u578b\u200b\u8def\u5f84\u200b\uff1a

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u7ed3\u679c\u200b\u53ef\u89c6\u5316\u200b\u56fe\u50cf\u200b\n    res.save_to_json(\"./output/\") # \u200b\u4fdd\u5b58\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n
\u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  1. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5176\u4ed6\u200b\u4e09\u79cd\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  2. \u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\uff1a\u200b\u5728\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\uff0c\u200b\u8bb8\u591a\u200b\u5e94\u7528\u200b\u5bf9\u200b\u90e8\u7f72\u200b\u7b56\u7565\u200b\u7684\u200b\u6027\u80fd\u6307\u6807\u200b\uff08\u200b\u5c24\u5176\u200b\u662f\u200b\u54cd\u5e94\u901f\u5ea6\u200b\uff09\u200b\u6709\u7740\u200b\u8f83\u200b\u4e25\u82db\u200b\u7684\u200b\u6807\u51c6\u200b\uff0c\u200b\u4ee5\u200b\u786e\u4fdd\u200b\u7cfb\u7edf\u200b\u7684\u200b\u9ad8\u6548\u200b\u8fd0\u884c\u200b\u4e0e\u200b\u7528\u6237\u200b\u4f53\u9a8c\u200b\u7684\u200b\u6d41\u7545\u6027\u200b\u3002\u200b\u4e3a\u6b64\u200b\uff0cPaddleX \u200b\u63d0\u4f9b\u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u63d2\u4ef6\u200b\uff0c\u200b\u65e8\u5728\u200b\u5bf9\u6a21\u578b\u200b\u63a8\u7406\u200b\u53ca\u200b\u524d\u540e\u200b\u5904\u7406\u200b\u8fdb\u884c\u200b\u6df1\u5ea6\u200b\u6027\u80fd\u200b\u4f18\u5316\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u7aef\u5230\u200b\u7aef\u200b\u6d41\u7a0b\u200b\u7684\u200b\u663e\u8457\u200b\u63d0\u901f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u9ad8\u6027\u80fd\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u9ad8\u6027\u80fd\u200b\u63a8\u7406\u200b\u6307\u5357\u200b\u3002

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002
  4. \u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\uff1a\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u8ba1\u7b97\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u529f\u80fd\u200b\u653e\u5728\u200b\u7528\u6237\u200b\u8bbe\u5907\u200b\u672c\u8eab\u200b\u4e0a\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8bbe\u5907\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u5904\u7406\u200b\u6570\u636e\u200b\uff0c\u200b\u800c\u200b\u4e0d\u200b\u9700\u8981\u200b\u4f9d\u8d56\u200b\u8fdc\u7a0b\u200b\u7684\u200b\u670d\u52a1\u5668\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u5c06\u200b\u6a21\u578b\u200b\u90e8\u7f72\u200b\u5728\u200b Android \u200b\u7b49\u200b\u7aef\u4fa7\u200b\u8bbe\u5907\u200b\u4e0a\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u7aef\u4fa7\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002

\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html","title":"PaddleX 3.0 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u8bbe\u5907\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u5e94\u7528\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u8bbe\u5907\u200b\u8282\u70b9\u200b\u7684\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u200b\u4efb\u52a1\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u548c\u200b\u6807\u8bb0\u200b\u51fa\u200b\u8bbe\u5907\u200b\u8282\u70b9\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u884c\u4e3a\u200b\u6216\u200b\u5f02\u5e38\u200b\u72b6\u6001\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u548c\u200b\u89e3\u51b3\u200b\u5e94\u7528\u670d\u52a1\u5668\u200b\u8282\u70b9\u200b\u4e2d\u200b\u7684\u200b\u95ee\u9898\u200b\uff0c\u200b\u63d0\u9ad8\u200b\u7cfb\u7edf\u200b\u7684\u200b\u53ef\u9760\u6027\u200b\u548c\u200b\u53ef\u7528\u6027\u200b\u3002\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200bPaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)\u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX \u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    from paddlex import create_model\nmodel = create_model(\"PatchTST_ad\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u53ef\u4ee5\u200b\u8fdb\u5165\u200b \u200b\u5b98\u65b9\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u80fd\u529b\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002
"},{"location":"practical_tutorials/ts_anomaly_detection.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b5\u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear_ad 0.9898 0.9396 0.9641 72.8K DLinear_ad\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b Nonstationary_ad 0.9855 0.8895 0.9351 1.5MB \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b AutoEncoder_ad 0.9936 0.8436 0.9125 32K AutoEncoder_ad\u200b\u662f\u200b\u7ecf\u5178\u200b\u7684\u200b\u81ea\u200b\u7f16\u7801\u200b\u7ed3\u6784\u200b\u7684\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b PatchTST_ad 0.9878 0.9070 0.9457 164K PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b TimesNet_ad 0.9837 0.9480 0.9656 732K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPSM\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u957f\u5ea6\u200b\u4e3a\u200b100\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ts_anomaly_detection.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u4e3a\u4e86\u200b\u6f14\u793a\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4efb\u52a1\u200b\u6574\u4e2a\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u200b\u4f7f\u7528\u200b\u516c\u5f00\u200b\u7684\u200b MSL \u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u53ca\u200b\u9a8c\u8bc1\u200b\u3002PSM\uff08\u200b\u706b\u661f\u200b\u79d1\u5b66\u200b\u5b9e\u9a8c\u5ba4\u200b\uff09\u200b\u6570\u636e\u200b\u96c6\u7531\u200b\u6765\u81ea\u200b\u7f8e\u56fd\u56fd\u5bb6\u822a\u7a7a\u822a\u5929\u5c40\u200b\uff0c\u200b\u5177\u6709\u200b 55 \u200b\u4e2a\u200b\u7ef4\u5ea6\u200b\uff0c\u200b\u5176\u4e2d\u200b\u5305\u542b\u200b\u6765\u81ea\u200b\u822a\u5929\u5668\u200b\u76d1\u6d4b\u200b\u7cfb\u7edf\u200b\u7684\u200b\u610f\u5916\u4e8b\u4ef6\u200b\u5f02\u5e38\u200b\uff08ISA\uff09\u200b\u62a5\u544a\u200b\u7684\u200b\u9065\u6d4b\u200b\u5f02\u5e38\u200b\u6570\u636e\u200b\u3002\u200b\u5177\u6709\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u80cc\u666f\u200b\uff0c\u200b\u80fd\u591f\u200b\u66f4\u597d\u200b\u5730\u200b\u53cd\u6620\u200b\u771f\u5b9e\u200b\u573a\u666f\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff0c\u200b\u901a\u5e38\u200b\u7528\u4e8e\u200b\u6d4b\u8bd5\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u3002

\u200b\u6211\u4eec\u200b\u5df2\u7ecf\u200b\u5c06\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u6807\u51c6\u200b\u6570\u636e\u683c\u5f0f\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/msl.tar -P ./dataset\ntar -xf ./dataset/msl.tar -C ./dataset/\n
* \u200b\u6570\u636e\u200b\u6ce8\u610f\u4e8b\u9879\u200b * \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65e0\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b\u4efb\u52a1\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4e0d\u200b\u9700\u8981\u200b\u6807\u6ce8\u200b\u8bad\u7ec3\u200b\u6570\u636e\u200b\u3002\u200b\u6536\u96c6\u200b\u7684\u200b\u8bad\u7ec3\u6837\u672c\u200b\u5c3d\u53ef\u80fd\u200b\u4fdd\u8bc1\u200b\u90fd\u200b\u662f\u200b\u6b63\u5e38\u200b\u6570\u636e\u200b\uff0c\u200b\u5373\u200b\u6ca1\u6709\u200b\u5f02\u5e38\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u7684\u200b\u6807\u7b7e\u200b\u5217\u5747\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 0\uff0c\u200b\u6216\u8005\u200b\u4e0d\u200b\u8bbe\u7f6e\u200b\u6807\u7b7e\u200b\u5217\u200b\u4e5f\u200b\u662f\u200b\u53ef\u4ee5\u200b\u7684\u200b\u3002\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u4e3a\u4e86\u200b\u9a8c\u8bc1\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u9700\u8981\u200b\u8fdb\u884c\u200b\u6807\u6ce8\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u67d0\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u200b\u5f02\u5e38\u200b\u7684\u200b\u70b9\u200b\uff0c\u200b\u8be5\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b 1\uff0c\u200b\u6b63\u5e38\u200b\u7684\u200b\u65f6\u95f4\u200b\u70b9\u200b\u7684\u200b\u6807\u7b7e\u200b\u4e3a\u200b 0\u3002 * \u200b\u7f3a\u5931\u200b\u503c\u200b\u5904\u7406\u200b\uff1a\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002 * \u200b\u975e\u200b\u91cd\u590d\u6027\u200b\uff1a\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u662f\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u987a\u5e8f\u200b\u6309\u884c\u200b\u6536\u96c6\u200b\u7684\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u4e0d\u80fd\u200b\u91cd\u590d\u200b\u51fa\u73b0\u200b\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/msl\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 58317,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"0\",\n        \"1\",\n        \"2\",\n        \"...\"\n      ]\n      [\n        \"...\"\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/msl\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\u6570\u636e\u200b\u90e8\u5206\u200b\u5df2\u200b\u7701\u7565\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 58317
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 73729
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"practical_tutorials/ts_anomaly_detection.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b4.1.3\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ts_anomaly_detection.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

  python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/msl \\\n    -o Train.epochs_iters=5 \\\n    -o Train.batch_size=16 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.time_col=timestamp \\\n    -o Train.feature_cols=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 \\\n    -o Train.freq=1 \\\n    -o Train.label_col=label \\\n    -o Train.seq_len=96\n
\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b(\u200b\u65f6\u5e8f\u200b\u6a21\u578b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b)\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
  • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\u3001\u200b\u5355\u4f8b\u200b\u6d4b\u8bd5\u200b\uff08predict\uff09\uff1b
  • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\uff1b\u200b\u53ef\u200b\u5728\u200b PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u200b\u540c\u7ea7\u200b\u76ee\u5f55\u200b\u7684\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u67e5\u770b\u200b\u4e0d\u540c\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
  • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
  • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b
  • batch_size\uff1a\u200b\u8bad\u7ec3\u200b\u5355\u5361\u200b\u6279\u200b\u5927\u5c0f\u200b\u8bbe\u7f6e\u200b\uff1b
  • time_col: \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff1b
  • feature_cols:\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u8868\u793a\u200b\u80fd\u591f\u200b\u5224\u65ad\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u76f8\u5173\u200b\u53d8\u91cf\u200b\uff0c\u200b\u4f8b\u5982\u200b\u8bbe\u5907\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\uff0c\u200b\u53ef\u80fd\u200b\u4e0e\u200b\u8bbe\u5907\u200b\u8fd0\u8f6c\u200b\u65f6\u200b\u7684\u200b\u6563\u70ed\u91cf\u200b\u6709\u5173\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u8bbe\u7f6e\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u540d\u200b\u6709\u200b 55 \u200b\u4e2a\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200b\uff1a0, 1 \u200b\u7b49\u200b\uff1b
  • freq\uff1a\u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\uff1b
  • input_len: \u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff0c\u200b\u4f1a\u200b\u6309\u7167\u200b\u8be5\u200b\u957f\u5ea6\u200b\u5bf9\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5207\u7247\u200b\uff0c\u200b\u9884\u6d4b\u200b\u8be5\u200b\u957f\u5ea6\u200b\u4e0b\u200b\u8fd9\u200b\u4e00\u6bb5\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u8003\u8651\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\u3002\u200b\u8868\u793a\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b 96 \u200b\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u6709\u200b\u5f02\u5e38\u200b\uff1b
  • label\uff1a\u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u65f6\u95f4\u200b\u70b9\u200b\u662f\u5426\u200b\u5f02\u5e38\u200b\u7684\u200b\u7f16\u53f7\u200b\uff0c\u200b\u5f02\u5e38\u200b\u70b9\u4e3a\u200b 1\uff0c\u200b\u6b63\u5e38\u200b\u70b9\u4e3a\u200b 0\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u76d1\u63a7\u200b\u6570\u636e\u200b\u96c6\u200b\u4e3a\u200b label\u3002 \u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002\u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 1 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\u3002
\u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference*\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ts_anomaly_detection.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/msl\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u4f1a\u200b\u4ea7\u51fa\u200bevaluate_result.json\uff0c\u200b\u5176\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u7684\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5177\u4f53\u6765\u8bf4\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bc4\u4f30\u200b\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u6a21\u578b\u200b\u7684\u200b\u8bc4\u4f30\u200b\u6307\u6807\u200b\uff0c\u200b\u5305\u542b\u200b f1\u3001recall \u200b\u548c\u200b precision\u3002

"},{"location":"practical_tutorials/ts_anomaly_detection.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u57fa\u4e8e\u200b\u63a7\u5236\u53d8\u91cf\u200b\u7684\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5728\u200b\u521d\u59cb\u200b\u9636\u6bb5\u200b\u57fa\u4e8e\u200b\u56fa\u5b9a\u200b\u7684\u200b\u8f83\u200b\u5c0f\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u591a\u6b21\u200b\u8c03\u6574\u200b\u5b66\u4e60\u200b\u7387\u200b\uff0c\u200b\u4ece\u800c\u200b\u627e\u5230\u200b\u8f83\u4f18\u200b\u5b66\u4e60\u200b\u7387\u200b\uff1b\u200b\u4e4b\u540e\u200b\u518d\u6b21\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u4e0b\u9762\u200b\u6211\u4eec\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7684\u200b\u8c03\u53c2\u200b\u65b9\u6cd5\u200b:

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 5\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\uff0c\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\u3002
  2. \u200b\u57fa\u4e8e\u200b PatchTST_ad \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.0001\uff0c0.0005\uff0c0.001\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\uff0c\u200b\u5176\u200b\u914d\u7f6e\u200b\u4e3a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\u3002\u200b\u56e0\u6b64\u200b\u5b66\u4e60\u200b\u7387\u200b\u56fa\u5b9a\u200b\u4e3a\u200b 0.001\uff0c\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 20\u3002
  4. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u56db\u200b\u4e0e\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u4e00\u81f4\u200b\uff0c\u200b\u8bf4\u660e\u200b\u65e0\u9700\u200b\u518d\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u3002 \u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a
\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200bF1 score (%) \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5 0.0001 16 96 1\u200b\u5361\u200b 79.5 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.0005 16 96 1\u200b\u5361\u200b 80.1 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.001 16 96 1\u200b\u5361\u200b 80.9

\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200bF1 score (%) \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.0005 16 96 1\u200b\u5361\u200b 80.9 \u200b\u5b9e\u9a8c\u200b\u56db\u200b 20 0.0005 16 96 1\u200b\u5361\u200b 80.9"},{"location":"practical_tutorials/ts_anomaly_detection.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/test.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bPatchTST_ad.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"practical_tutorials/ts_anomaly_detection.html#7","title":"7.\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff1a

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
    \u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

  2. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html","title":"PaddleX 3.0 \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u5fc3\u8df3\u200b\u76d1\u6d4b\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u5206\u7c7b\u200b\u5e94\u7528\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u5fc3\u8df3\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u7684\u200b\u5206\u7c7b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ts_classification.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u200b\u4efb\u52a1\u200b\u76ee\u6807\u200b\u5c31\u662f\u200b\u57fa\u4e8e\u200b\u5fc3\u8df3\u200b\u76d1\u6d4b\u6570\u636e\u200b\u5bf9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u5fc3\u8df3\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u72b6\u51b5\u200b\u7684\u200b\u5206\u7c7b\u200b\u3002\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU) \u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ts_classification.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX \u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u53ef\u4ee5\u200b\u8fdb\u5165\u200b \u200b\u5b98\u65b9\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u7684\u200b\u80fd\u529b\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b1\u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b TimesNet_cls 87.5 792K \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b UWaveGestureLibrary\u3002

"},{"location":"practical_tutorials/ts_classification.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ts_classification.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u4e3a\u4e86\u200b\u6f14\u793a\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\u6574\u4e2a\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u200b\u4f7f\u7528\u200b\u516c\u5f00\u200b\u7684\u200b Heartbeat \u200b\u6570\u636e\u200b\u96c6\u200b \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u53ca\u200b\u9a8c\u8bc1\u200b\u3002Heartbeat \u200b\u6570\u636e\u200b\u96c6\u662f\u200b UEA \u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5206\u7c7b\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u573a\u666f\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u6d89\u53ca\u200b\u5230\u200b\u5fc3\u8df3\u200b\u76d1\u6d4b\u200b\u533b\u5b66\u200b\u8bca\u65ad\u200b\u8fd9\u4e00\u200b\u5b9e\u9645\u200b\u4efb\u52a1\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u7531\u200b\u591a\u7ec4\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7ec4\u6210\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6570\u636e\u200b\u70b9\u200b\u7531\u200b\u6807\u7b7e\u200b\u53d8\u91cf\u200b\u3001\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u548c\u200b 61 \u200b\u4e2a\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\u7ec4\u6210\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u901a\u5e38\u200b\u7528\u4e8e\u200b\u6d4b\u8bd5\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u65f6\u95f4\u200b\u5206\u7c7b\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\u3002

\u200b\u6211\u4eec\u200b\u5df2\u7ecf\u200b\u5c06\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u6807\u51c6\u200b\u6570\u636e\u683c\u5f0f\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
* \u200b\u6570\u636e\u200b\u6ce8\u610f\u4e8b\u9879\u200b * \u200b\u57fa\u4e8e\u200b\u6536\u96c6\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u660e\u786e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u7684\u200b\u5206\u7c7b\u200b\u76ee\u6807\u200b\uff0c\u200b\u5e76\u200b\u5b9a\u4e49\u200b\u76f8\u5e94\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u80a1\u7968\u4ef7\u683c\u200b\u5206\u7c7b\u200b\u4e2d\u200b\uff0c\u200b\u6807\u7b7e\u200b\u53ef\u80fd\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u5b9a\u4e49\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6807\u7b7e\u200b\uff1b\u200b\u5bf9\u4e8e\u200b\u5728\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u662f\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4f5c\u4e3a\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\uff08group\uff09\uff0c\u200b\u5373\u200b\u8fd9\u200b\u6bb5\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6bcf\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u90fd\u200b\u5177\u6709\u200b\u5171\u540c\u200b\u7684\u200b group_id, \u200b\u6807\u7b7e\u200b\u5217\u200b\u6211\u4eec\u200b\u90fd\u200b\u5b9a\u4e49\u200b\u4e3a\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u200b\u6807\u7b7e\u200b\u3002\u200b\u6bcf\u200b\u4e00\u4e2a\u200b group\uff0c\u200b\u5c31\u662f\u200b\u4e00\u4e2a\u200b\u5206\u7c7b\u200b\u6837\u672c\u200b\u3002 * \u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\u4e00\u81f4\u200b\uff1a\u200b\u786e\u4fdd\u200b\u6240\u6709\u200b\u6570\u636e\u200b\u5e8f\u5217\u200b\u7684\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\u4e00\u81f4\u200b\uff0c\u200b\u5982\u200b\u6bcf\u200b\u5c0f\u65f6\u200b\u3001\u200b\u6bcf\u65e5\u200b\u6216\u200b\u6bcf\u5468\u200b\uff0c\u200b\u5bf9\u4e8e\u200b\u4e0d\u200b\u4e00\u81f4\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u91cd\u200b\u91c7\u6837\u200b\u65b9\u6cd5\u200b\u8c03\u6574\u200b\u5230\u200b\u7edf\u4e00\u200b\u7684\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\u3002 * \u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u4e00\u81f4\u200b\uff1a\u200b\u786e\u4fdd\u200b\u6bcf\u200b\u4e00\u4e2a\u200bgroup\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u5ea6\u200b\u4e00\u81f4\u200b\u3002 * \u200b\u7f3a\u5931\u200b\u503c\u200b\u5904\u7406\u200b\uff1a\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002 * \u200b\u975e\u200b\u91cd\u590d\u6027\u200b\uff1a\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u662f\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u987a\u5e8f\u200b\u6309\u884c\u200b\u6536\u96c6\u200b\u7684\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u4e0d\u80fd\u200b\u91cd\u590d\u200b\u51fa\u73b0\u200b\u3002

"},{"location":"practical_tutorials/ts_classification.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [ ...\n    ],\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [ ...\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\u6570\u636e\u200b\u90e8\u5206\u200b\u5df2\u200b\u7701\u7565\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 82620
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 83025
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u7684\u200b4.1.3\u3002

"},{"location":"practical_tutorials/ts_classification.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ts_classification.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Train.epochs_iters=5 \\\n    -o Train.batch_size=16 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.time_col=time \\\n    -o Train.target_cols=dim_0,dim_1,dim_2 \\\n    -o Train.freq=1 \\\n    -o Train.group_id=group_id \\\n    -o Train.static_cov_cols=label\n
\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b(\u200b\u65f6\u5e8f\u200b\u6a21\u578b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b)\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
  • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\u3001\u200b\u5355\u4f8b\u200b\u6d4b\u8bd5\u200b\uff08predict\uff09\uff1b
  • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\uff1b\u200b\u53ef\u200b\u5728\u200b\u8be5\u200b\u8def\u5f84\u200b\u4e0b\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5217\u8868\u200b\u7684\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u67e5\u770b\u200b\u4e0d\u540c\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
  • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
  • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b
  • batch_size\uff1a\u200b\u8bad\u7ec3\u200b\u5355\u5361\u200b\u6279\u200b\u5927\u5c0f\u200b\u8bbe\u7f6e\u200b\uff1b
  • time_col: \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff1b
  • target_cols:\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\u3002\u200b\u4e00\u822c\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u548c\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b\u7684\u200b\u76ee\u6807\u200b\u8d8a\u200b\u76f8\u5173\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u9ad8\u200b\u3002\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u5fc3\u200b\u8df3\u200b\u76d1\u63a7\u200b\u6570\u636e\u200b\u96c6\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u540d\u200b\u6709\u200b 61 \u200b\u4e2a\u200b\u7279\u5f81\u200b\u53d8\u91cf\u200b\uff0c\u200b\u5982\u200b\uff1adim_0, dim_1 \u200b\u7b49\u200b\uff1b
  • freq\uff1a\u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\uff1b
  • group_id\uff1a\u200b\u4e00\u4e2a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u8868\u793a\u200b\u7684\u200b\u662f\u200b\u4e00\u4e2a\u200b\u65f6\u5e8f\u200b\u6837\u672c\u200b\uff0c\u200b\u76f8\u540c\u200b\u7f16\u53f7\u200b\u7684\u200b\u65f6\u5e8f\u200b\u5e8f\u5217\u200b\u7ec4\u6210\u200b\u4e00\u4e2a\u200b\u6837\u672c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u6307\u5b9a\u200b\u7fa4\u7ec4\u200b\u7f16\u53f7\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b, \u200b\u5982\u200b\uff1agroup_id\uff1b
  • static_cov_cols\uff1a\u200b\u4ee3\u8868\u200b\u65f6\u5e8f\u200b\u7684\u200b\u7c7b\u522b\u200b\u7f16\u53f7\u200b\u5217\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u6837\u672c\u200b\u7684\u200b\u6807\u7b7e\u200b\u76f8\u540c\u200b\u3002\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u7c7b\u522b\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u5982\u200b\uff1alabel\u3002 \u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a

  • \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 1 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\uff1b
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u3002
\u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference*\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7b49\u200b\uff1b
"},{"location":"practical_tutorials/ts_classification.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Evaluate.weight_path=./output/best_model/model.pdparams\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff1a-o Global.mode=evaluate
  • \u200b\u6307\u5b9a\u200b\u9a8c\u8bc1\u200b\u6570\u636e\u200b\u96c6\u200b\u8def\u5f84\u200b\uff1a-o Global.dataset_dir \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bEvaluate\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/ts_classification.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002 \u200b\u57fa\u4e8e\u200b\u63a7\u5236\u53d8\u91cf\u200b\u7684\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5728\u200b\u521d\u59cb\u200b\u9636\u6bb5\u200b\u57fa\u4e8e\u200b\u56fa\u5b9a\u200b\u7684\u200b\u8f83\u200b\u5c0f\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u591a\u6b21\u200b\u8c03\u6574\u200b\u5b66\u4e60\u200b\u7387\u200b\uff0c\u200b\u4ece\u800c\u200b\u627e\u5230\u200b\u8f83\u4f18\u200b\u5b66\u4e60\u200b\u7387\u200b\uff1b\u200b\u4e4b\u540e\u200b\u518d\u6b21\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u4e0b\u9762\u200b\u6211\u4eec\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u7684\u200b\u8c03\u53c2\u200b\u65b9\u6cd5\u200b:

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 5\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\u3002
  2. \u200b\u57fa\u4e8e\u200b TimesNet_cls \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.00001\uff0c0.0001\uff0c0.001\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e09\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u3002\u200b\u56e0\u6b64\u200b\u56fa\u5b9a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\uff0c\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5230\u200b 30\u3002\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u5185\u7f6e\u200b\u7684\u200b earlystop \u200b\u673a\u5236\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u5728\u200b 10 \u200b\u4e2a\u200b patience epoch\uff08\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff09\u200b\u540e\u200b\u6ca1\u6709\u200b\u63d0\u5347\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u3002\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b\u65e9\u505c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u624b\u52a8\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b patience \u200b\u7684\u200b\u503c\u200b\u3002 \u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a
\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u51c6\u786e\u7387\u200b \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5 0.00001 16 1\u200b\u5361\u200b 72.20% \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.0001 16 1\u200b\u5361\u200b 72.20% \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.001 16 1\u200b\u5361\u200b 73.20%

\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200b \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u51c6\u786e\u7387\u200b \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.001 16 1\u200b\u5361\u200b 73.20% \u200b\u5b9e\u9a8c\u200b\u56db\u200b 30 0.001 16 1\u200b\u5361\u200b 75.10%"},{"location":"practical_tutorials/ts_classification.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u200b\u6a21\u578b\u200b\u76ee\u5f55\u200b\u8bbe\u7f6e\u200b\u4e3a\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b\u6d4b\u8bd5\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_classification/test.csv\"\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bTimesNet_cls.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"practical_tutorials/ts_classification.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff1a

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
    \u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b

  2. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html","title":"PaddleX 3.0 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u2014\u2014\u2014\u200b\u7528\u7535\u91cf\u200b\u957f\u671f\u200b\u9884\u6d4b\u200b\u5e94\u7528\u200b\u6559\u7a0b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e30\u5bcc\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u7531\u200b\u4e00\u4e2a\u200b\u6216\u200b\u591a\u4e2a\u200b\u6a21\u578b\u200b\u7ec4\u5408\u200b\u5b9e\u73b0\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u80fd\u591f\u200b\u89e3\u51b3\u200b\u7279\u5b9a\u200b\u7684\u200b\u573a\u666f\u200b\u4efb\u52a1\u200b\u95ee\u9898\u200b\u3002PaddleX \u200b\u6240\u200b\u63d0\u4f9b\u200b\u7684\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5747\u200b\u652f\u6301\u200b\u5feb\u901f\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u5982\u679c\u200b\u6548\u679c\u200b\u4e0d\u53ca\u200b\u9884\u671f\u200b\uff0c\u200b\u4e5f\u200b\u540c\u6837\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u79c1\u6709\u200b\u6570\u636e\u200b\u5fae\u8c03\u200b\u6a21\u578b\u200b\uff0c\u200b\u5e76\u4e14\u200b PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b Python API\uff0c\u200b\u65b9\u4fbf\u200b\u5c06\u4ea7\u7ebf\u200b\u96c6\u6210\u200b\u5230\u200b\u4e2a\u4eba\u200b\u9879\u76ee\u200b\u4e2d\u200b\u3002\u200b\u5728\u200b\u4f7f\u7528\u200b\u4e4b\u524d\u200b\uff0c\u200b\u60a8\u200b\u9996\u5148\u200b\u9700\u8981\u200b\u5b89\u88c5\u200b PaddleX\uff0c \u200b\u5b89\u88c5\u200b\u65b9\u5f0f\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u672c\u5730\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b\u3002\u200b\u6b64\u5904\u200b\u4ee5\u200b\u4e00\u4e2a\u200b\u7528\u7535\u91cf\u200b\u957f\u671f\u200b\u9884\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u4e3a\u200b\u4f8b\u5b50\u200b\uff0c\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\u5de5\u5177\u200b\u7684\u200b\u4f7f\u7528\u200b\u6d41\u7a0b\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#1","title":"1. \u200b\u9009\u62e9\u200b\u4ea7\u7ebf","text":"

\u200b\u9996\u5148\u200b\uff0c\u200b\u9700\u8981\u200b\u6839\u636e\u200b\u60a8\u200b\u7684\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u9009\u62e9\u200b\u5bf9\u5e94\u200b\u7684\u200b PaddleX \u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u672c\u200b\u4efb\u52a1\u200b\u76ee\u6807\u200b\u662f\u200b\u57fa\u4e8e\u200b\u5386\u53f2\u6570\u636e\u200b\u5bf9\u200b\u672a\u6765\u200b\u4e00\u6bb5\u65f6\u95f4\u200b\u7535\u529b\u200b\u6d88\u8017\u91cf\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u3002\u200b\u4e86\u89e3\u200b\u5230\u200b\u8fd9\u4e2a\u200b\u4efb\u52a1\u200b\u5c5e\u4e8e\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u5e94\u200b PaddleX \u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u3002\u200b\u5982\u679c\u200b\u65e0\u6cd5\u200b\u786e\u5b9a\u200b\u4efb\u52a1\u200b\u548c\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u5728\u200b PaddleX \u200b\u652f\u6301\u200b\u7684\u200b PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU) \u200b\u4e2d\u200b\u4e86\u89e3\u200b\u76f8\u5173\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u80fd\u529b\u200b\u4ecb\u7ecd\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#2","title":"2. \u200b\u5feb\u901f\u200b\u4f53\u9a8c","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b\u4e24\u79cd\u200b\u4f53\u9a8c\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u901a\u8fc7\u200b PaddleX \u200b\u5728\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\uff0c\u200b\u53e6\u5916\u200b\u4e00\u79cd\u200b\u662f\u200b\u53ef\u4ee5\u200b\u5728\u200b AI Studio \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b \u200b\u4e0a\u200b\u4f53\u9a8c\u200b\u3002

  • \u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a
    from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\uff1a\u200b\u53ef\u4ee5\u200b\u8fdb\u5165\u200b \u200b\u5b98\u65b9\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u5e94\u7528\u200b \u200b\u4f53\u9a8c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u7684\u200b\u80fd\u529b\u200b\u3002 \u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u6570\u636e\u200b\u548c\u200b\u573a\u666f\u200b\u7d27\u5bc6\u200b\u76f8\u5173\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u7684\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u5185\u7f6e\u200b\u6a21\u578b\u200b\u4ec5\u200b\u662f\u200b\u5728\u200b\u4e00\u4e2a\u200b\u7279\u5b9a\u200b\u573a\u666f\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u975e\u200b\u901a\u7528\u200b\u65b9\u6848\u200b\uff0c\u200b\u4e0d\u200b\u9002\u7528\u200b\u5176\u4ed6\u200b\u573a\u666f\u200b\uff0c\u200b\u56e0\u6b64\u200b\u4f53\u9a8c\u200b\u65b9\u5f0f\u200b\u4e0d\u200b\u652f\u6301\u200b\u4f7f\u7528\u200b\u4efb\u610f\u200b\u7684\u200b\u6587\u4ef6\u200b\u6765\u200b\u4f53\u9a8c\u200b\u5b98\u65b9\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\u6548\u679c\u200b\u3002\u200b\u4f46\u662f\u200b\uff0c\u200b\u5728\u200b\u5b8c\u6210\u200b\u81ea\u5df1\u200b\u573a\u666f\u200b\u6570\u636e\u200b\u4e0b\u200b\u7684\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u4e4b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u9009\u62e9\u200b\u81ea\u5df1\u200b\u8bad\u7ec3\u200b\u7684\u200b\u6a21\u578b\u200b\u65b9\u6848\u200b\uff0c\u200b\u5e76\u200b\u4f7f\u7528\u200b\u5bf9\u5e94\u200b\u573a\u666f\u200b\u7684\u200b\u6570\u636e\u200b\u8fdb\u884c\u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#3","title":"3. \u200b\u9009\u62e9\u200b\u6a21\u578b","text":"

PaddleX \u200b\u63d0\u4f9b\u200b\u4e86\u200b5\u200b\u4e2a\u7aef\u200b\u5230\u200b\u7aef\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u53ef\u200b\u53c2\u8003\u200b \u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6a21\u578b\u200b\u7684\u200bbenchmark\u200b\u5982\u4e0b\u200b\uff1a

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u4ecb\u7ecd\u200b DLinear 0.382 0.394 76k DLinear\u200b\u7ed3\u6784\u200b\u7b80\u5355\u200b\uff0c\u200b\u6548\u7387\u9ad8\u200b\u4e14\u200b\u6613\u7528\u200b\u7684\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b Nonstationary 0.600 0.515 60.3M \u200b\u57fa\u4e8e\u200btransformer\u200b\u7ed3\u6784\u200b\uff0c\u200b\u9488\u5bf9\u6027\u200b\u4f18\u5316\u200b\u975e\u200b\u5e73\u7a33\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b PatchTST 0.385 0.397 2.2M PatchTST\u200b\u662f\u200b\u517c\u987e\u200b\u5c40\u90e8\u200b\u6a21\u5f0f\u200b\u548c\u200b\u5168\u5c40\u200b\u4f9d\u8d56\u200b\u5173\u7cfb\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u957f\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b TiDE 0.405 0.412 34.9M TiDE\u200b\u662f\u200b\u9002\u7528\u200b\u4e8e\u200b\u5904\u7406\u200b\u591a\u200b\u53d8\u91cf\u200b\u3001\u200b\u957f\u671f\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u9884\u6d4b\u200b\u95ee\u9898\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u6a21\u578b\u200b TimesNet 0.417 0.431 5.2M \u200b\u901a\u8fc7\u200b\u591a\u200b\u5468\u671f\u200b\u5206\u6790\u200b\uff0cTimesNet\u200b\u662f\u200b\u9002\u5e94\u6027\u200b\u5f3a\u200b\u7684\u200b\u9ad8\u7cbe\u5ea6\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u5206\u6790\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6d4b\u8bd5\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8f93\u5165\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u4e3a\u200b96\uff0c\u200b\u9884\u6d4b\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\u9664\u200b TiDE \u200b\u5916\u4e3a\u200b96\uff0cTiDE\u200b\u4e3a\u200b720 \u3002

\u200b\u4f60\u200b\u53ef\u4ee5\u200b\u4f9d\u636e\u200b\u81ea\u5df1\u200b\u7684\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\uff0c\u200b\u5224\u65ad\u200b\u5e76\u200b\u9009\u62e9\u200b\u4e00\u4e2a\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u505a\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u8bad\u7ec3\u200b\u5b8c\u6210\u200b\u540e\u200b\u53ef\u200b\u5728\u200b\u4ea7\u7ebf\u200b\u5185\u200b\u8bc4\u4f30\u200b\u5408\u9002\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\uff0c\u200b\u5e76\u200b\u6700\u7ec8\u200b\u7528\u4e8e\u200b\u5b9e\u9645\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u4e2d\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#4","title":"4. \u200b\u6570\u636e\u200b\u51c6\u5907\u200b\u548c\u6821\u9a8c","text":""},{"location":"practical_tutorials/ts_forecast.html#41","title":"4.1 \u200b\u6570\u636e\u200b\u51c6\u5907","text":"

\u200b\u4e3a\u4e86\u200b\u6f14\u793a\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6574\u4e2a\u200b\u6d41\u7a0b\u200b\uff0c\u200b\u6211\u4eec\u200b\u5c06\u200b\u4f7f\u7528\u200b\u7535\u529b\u200b Electricity \u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u53ca\u200b\u9a8c\u8bc1\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u91c7\u96c6\u200b\u4e86\u200b 2012 - 2014 \u200b\u5e74\u200b\u7684\u200b\u67d0\u200b\u8282\u70b9\u200b\u8017\u7535\u91cf\u200b\uff0c\u200b\u6bcf\u200b\u95f4\u8ddd\u200b 1 \u200b\u5c0f\u65f6\u200b\u91c7\u96c6\u200b\u4e00\u6b21\u200b\u6570\u636e\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6570\u636e\u200b\u70b9\u200b\u7531\u200b\u5f53\u524d\u200b\u65f6\u95f4\u200b\u70b9\u200b\u548c\u200b\u5bf9\u5e94\u200b\u7684\u200b\u8017\u7535\u91cf\u200b\u7ec4\u6210\u200b\u3002\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u901a\u5e38\u200b\u7528\u4e8e\u200b\u6d4b\u8bd5\u200b\u548c\u200b\u9a8c\u8bc1\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u9884\u6d4b\u200b\u6a21\u578b\u200b\u7684\u200b\u6027\u80fd\u200b\u3002

\u200b\u672c\u200b\u6559\u7a0b\u200b\u4e2d\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b 96 \u200b\u5c0f\u65f6\u200b\u7684\u200b\u8017\u7535\u91cf\u200b\u3002\u200b\u6211\u4eec\u200b\u5df2\u7ecf\u200b\u5c06\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8f6c\u5316\u200b\u4e3a\u200b\u6807\u51c6\u200b\u6570\u636e\u683c\u5f0f\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4ee5\u4e0b\u200b\u547d\u4ee4\u200b\u83b7\u53d6\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002\u200b\u5173\u4e8e\u200b\u6570\u636e\u683c\u5f0f\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u3002

\u200b\u6570\u636e\u200b\u96c6\u200b\u83b7\u53d6\u200b\u547d\u4ee4\u200b\uff1a

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/electricity.tar -P ./dataset\ntar -xf ./dataset/electricity.tar -C ./dataset/\n
* \u200b\u6570\u636e\u200b\u6ce8\u610f\u4e8b\u9879\u200b * \u200b\u4e3a\u4e86\u200b\u8bad\u7ec3\u200b\u51fa\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u8d34\u8fd1\u200b\u5b9e\u9645\u200b\u573a\u666f\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\u5c24\u4e3a\u200b\u5173\u952e\u200b\uff0c\u200b\u56e0\u6b64\u200b\u901a\u5e38\u200b\u9700\u8981\u200b\u4e00\u6279\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\u52a0\u5165\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u3002 * \u200b\u6807\u6ce8\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\u6570\u636e\u200b\u65f6\u200b\uff0c\u200b\u57fa\u4e8e\u200b\u6536\u96c6\u200b\u7684\u200b\u771f\u5b9e\u200b\u6570\u636e\u200b\uff0c\u200b\u5c06\u200b\u6240\u6709\u200b\u6570\u636e\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u7684\u200b\u987a\u5e8f\u6392\u5217\u200b\u5373\u53ef\u200b\u3002\u200b\u8bad\u7ec3\u200b\u65f6\u200b\u5c06\u200b\u6570\u636e\u200b\u81ea\u52a8\u200b\u5206\u4e3a\u200b\u591a\u4e2a\u200b\u65f6\u95f4\u200b\u7247\u6bb5\u200b\uff0c\u200b\u5386\u53f2\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u548c\u200b\u672a\u6765\u200b\u7684\u200b\u5e8f\u5217\u200b\u5206\u522b\u200b\u8868\u793a\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u548c\u200b\u5176\u200b\u5bf9\u5e94\u200b\u7684\u200b\u9884\u6d4b\u200b\u76ee\u6807\u200b\uff0c\u200b\u6784\u6210\u200b\u4e86\u200b\u4e00\u7ec4\u200b\u8bad\u7ec3\u6837\u672c\u200b\u3002 * \u200b\u7f3a\u5931\u200b\u503c\u200b\u5904\u7406\u200b\uff1a\u200b\u4e3a\u4e86\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u7684\u200b\u8d28\u91cf\u200b\u548c\u200b\u5b8c\u6574\u6027\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u57fa\u4e8e\u200b\u4e13\u5bb6\u200b\u7ecf\u9a8c\u200b\u6216\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u8fdb\u884c\u200b\u7f3a\u5931\u200b\u503c\u200b\u586b\u5145\u200b\u3002 * \u200b\u975e\u200b\u91cd\u590d\u6027\u200b\uff1a\u200b\u4fdd\u8bc1\u6570\u636e\u200b\u662f\u200b\u6309\u7167\u200b\u65f6\u95f4\u200b\u987a\u5e8f\u200b\u6309\u884c\u200b\u6536\u96c6\u200b\u7684\u200b\uff0c\u200b\u540c\u4e00\u4e2a\u200b\u65f6\u95f4\u200b\u70b9\u200b\u4e0d\u80fd\u200b\u91cd\u590d\u200b\u51fa\u73b0\u200b\u3002

"},{"location":"practical_tutorials/ts_forecast.html#42","title":"4.2 \u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c","text":"

\u200b\u5728\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u6821\u9a8c\u200b\u65f6\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/electricity\n
\u200b\u6267\u884c\u200b\u4e0a\u8ff0\u200b\u547d\u4ee4\u200b\u540e\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u6821\u9a8c\u200b\uff0c\u200b\u5e76\u200b\u7edf\u8ba1\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u57fa\u672c\u200b\u4fe1\u606f\u200b\u3002\u200b\u547d\u4ee4\u200b\u8fd0\u884c\u200b\u6210\u529f\u200b\u540e\u4f1a\u200b\u5728\u200b log \u200b\u4e2d\u200b\u6253\u5370\u200b\u51fa\u200b Check dataset passed ! \u200b\u4fe1\u606f\u200b\uff0c\u200b\u540c\u65f6\u200b\u76f8\u5173\u200b\u4ea7\u51fa\u200b\u4f1a\u200b\u4fdd\u5b58\u200b\u5728\u200b\u5f53\u524d\u76ee\u5f55\u200b\u7684\u200b ./output/check_dataset \u200b\u76ee\u5f55\u200b\u4e0b\u200b\uff0c\u200b\u4ea7\u51fa\u200b\u76ee\u5f55\u200b\u4e2d\u200b\u5305\u62ec\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\u3002\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u4fdd\u5b58\u200b\u5728\u200b ./output/check_dataset_result.json\uff0c\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u6587\u4ef6\u200b\u5177\u4f53\u5185\u5bb9\u200b\u4e3a\u200b

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22880,\n    \"train_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2012-01-01 00:00:00\",\n        2162.0\n      ],\n      [\n        \"2012-01-01 01:00:00\",\n        2835.0\n      ],\n      [\n        \"2012-01-01 02:00:00\",\n        2764.0\n      ],\n      [\n        \"2012-01-01 03:00:00\",\n        2735.0\n      ],\n      [\n        \"2012-01-01 04:00:00\",\n        2721.0\n      ],\n      [\n        \"2012-01-01 05:00:00\",\n        2742.0\n      ],\n      [\n        \"2012-01-01 06:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 07:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 08:00:00\",\n        2680.0\n      ],\n      [\n        \"2012-01-01 09:00:00\",\n        2581.0\n      ]\n    ],\n    \"val_samples\": 3424,\n    \"val_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2014-08-11 08:00:00\",\n        3528.0\n      ],\n      [\n        \"2014-08-11 09:00:00\",\n        3800.0\n      ],\n      [\n        \"2014-08-11 10:00:00\",\n        3889.0\n      ],\n      [\n        \"2014-08-11 11:00:00\",\n        4340.0\n      ],\n      [\n        \"2014-08-11 12:00:00\",\n        4321.0\n      ],\n      [\n        \"2014-08-11 13:00:00\",\n        4293.0\n      ],\n      [\n        \"2014-08-11 14:00:00\",\n        4393.0\n      ],\n      [\n        \"2014-08-11 15:00:00\",\n        4384.0\n      ],\n      [\n        \"2014-08-11 16:00:00\",\n        4495.0\n      ],\n      [\n        \"2014-08-11 17:00:00\",\n        4374.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/electricity\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n
\u200b\u4e0a\u8ff0\u200b\u6821\u9a8c\u200b\u7ed3\u679c\u200b\u4e2d\u200b\uff0ccheck_pass \u200b\u4e3a\u200b True \u200b\u8868\u793a\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u7b26\u5408\u8981\u6c42\u200b\uff0c\u200b\u5176\u4ed6\u200b\u90e8\u5206\u200b\u6307\u6807\u200b\u7684\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • attributes.train_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 22880\uff1b
  • attributes.val_samples\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u6570\u91cf\u200b\u4e3a\u200b 3424\uff1b
  • attributes.train_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u8bad\u7ec3\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b
  • attributes.val_table\uff1a\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u6837\u672c\u200b\u793a\u4f8b\u200b\u6570\u636e\u200b\u884c\u200b\uff1b \u200b\u6ce8\u200b\uff1a\u200b\u53ea\u6709\u200b\u901a\u8fc7\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\u7684\u200b\u6570\u636e\u200b\u624d\u200b\u53ef\u4ee5\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#43","title":"4.3 \u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8f6c\u6362\u200b/\u200b\u6570\u636e\u200b\u96c6\u200b\u5212\u5206\u200b\uff08\u200b\u975e\u200b\u5fc5\u9009\u200b\uff09","text":"

\u200b\u5982\u9700\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u683c\u5f0f\u200b\u8fdb\u884c\u200b\u8f6c\u6362\u200b\u6216\u662f\u200b\u91cd\u65b0\u200b\u5212\u5206\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u662f\u200b\u8ffd\u52a0\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b\u5f00\u53d1\u200b\u6559\u7a0b\u200b\u4e2d\u200b4.1.3\u3002

"},{"location":"practical_tutorials/ts_forecast.html#5","title":"5. \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30","text":""},{"location":"practical_tutorials/ts_forecast.html#51","title":"5.1 \u200b\u6a21\u578b\u200b\u8bad\u7ec3","text":"

\u200b\u5728\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u8bf7\u200b\u786e\u4fdd\u60a8\u200b\u5df2\u7ecf\u200b\u5bf9\u200b\u6570\u636e\u200b\u96c6\u200b\u8fdb\u884c\u200b\u4e86\u200b\u6821\u9a8c\u200b\u3002\u200b\u5b8c\u6210\u200b PaddleX \u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u5982\u4e0b\u200b\u4e00\u6761\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/electricity \\\n    -o Train.epochs_iters=5 \\\n    -o Train.batch_size=16 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.time_col=date \\\n    -o Train.target_cols=OT \\\n    -o Train.freq=1h \\\n    -o Train.input_len=96 \\\n    -o Train.predict_len=96\n
\u200b\u5728\u200b PaddleX \u200b\u4e2d\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u652f\u6301\u200b\uff1a\u200b\u4fee\u6539\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u200b\u3001\u200b\u5355\u673a\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b(\u200b\u65f6\u5e8f\u200b\u6a21\u578b\u200b\u4ec5\u200b\u652f\u6301\u200b\u5355\u5361\u200b\u8bad\u7ec3\u200b)\u200b\u7b49\u200b\u529f\u80fd\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u3002

PaddleX \u200b\u4e2d\u200b\u6bcf\u4e2a\u200b\u6a21\u578b\u200b\u90fd\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u6a21\u578b\u200b\u5f00\u53d1\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u7528\u4e8e\u200b\u8bbe\u7f6e\u200b\u76f8\u5173\u200b\u53c2\u6570\u200b\u3002\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u76f8\u5173\u200b\u7684\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b Train \u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90e8\u5206\u200b\u53c2\u6570\u200b\u7684\u200b\u793a\u4f8b\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  • Global\uff1a
  • mode\uff1a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u652f\u6301\u200b\u6570\u636e\u200b\u6821\u9a8c\u200b\uff08check_dataset\uff09\u3001\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff08train\uff09\u3001\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff08evaluate\uff09\u3001\u200b\u5355\u4f8b\u200b\u6d4b\u8bd5\u200b\uff08predict\uff09\uff1b
  • device\uff1a\u200b\u8bad\u7ec3\u200b\u8bbe\u5907\u200b\uff0c\u200b\u53ef\u200b\u9009\u200bcpu\u3001gpu\u3001xpu\u3001npu\u3001mlu\uff1b\u200b\u53ef\u200b\u5728\u200b\u8be5\u200b\u8def\u5f84\u200b\u4e0b\u200b\u6a21\u578b\u200b\u652f\u6301\u200b\u5217\u8868\u200b\u7684\u200b\u6587\u6863\u200b\u4e2d\u200b\uff0c\u200b\u67e5\u770b\u200b\u4e0d\u540c\u200b\u8bbe\u5907\u200b\u4e0a\u200b\u652f\u6301\u200b\u7684\u200b\u6a21\u578b\u200b\uff1b
  • Train\uff1a\u200b\u8bad\u7ec3\u200b\u8d85\u200b\u53c2\u6570\u8bbe\u7f6e\u200b\uff1b
  • epochs_iters\uff1a\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u8bbe\u7f6e\u200b\uff1b
  • learning_rate\uff1a\u200b\u8bad\u7ec3\u200b\u5b66\u4e60\u200b\u7387\u200b\u8bbe\u7f6e\u200b\uff1b
  • batch_size\uff1a\u200b\u8bad\u7ec3\u200b\u5355\u5361\u200b\u6279\u200b\u5927\u5c0f\u200b\u8bbe\u7f6e\u200b\uff1b
  • time_col: \u200b\u65f6\u95f4\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u65f6\u95f4\u200b\u5217\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff1b
  • target_cols:\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u5217\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b\u76ee\u6807\u200b\u53d8\u91cf\u200b\u7684\u200b\u5217\u200b\u540d\u79f0\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u4e3a\u200b\u591a\u4e2a\u200b\uff0c\u200b\u591a\u4e2a\u200b\u4e4b\u95f4\u200b\u7528\u200b','\u200b\u5206\u9694\u200b\uff1b
  • freq\uff1a\u200b\u9891\u7387\u200b\uff0c\u200b\u987b\u200b\u7ed3\u5408\u200b\u81ea\u5df1\u200b\u7684\u200b\u6570\u636e\u200b\u8bbe\u7f6e\u200b\u65f6\u95f4\u200b\u9891\u7387\u200b\uff0c\u200b\u5982\u200b\uff1a1min\u30015min\u30011h\uff1b
  • input_len: \u200b\u8f93\u5165\u200b\u7ed9\u200b\u6a21\u578b\u200b\u7684\u200b\u5386\u53f2\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u957f\u5ea6\u200b\uff1b\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u53ca\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u80fd\u591f\u200b\u53c2\u8003\u200b\u7684\u200b\u5386\u53f2\u200b\u4fe1\u606f\u200b\u8d8a\u200b\u591a\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u9ad8\u200b\uff1b
  • predict_len:\u200b\u5e0c\u671b\u200b\u6a21\u578b\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u7684\u200b\u957f\u5ea6\u200b\uff1b\u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b\u5efa\u8bae\u200b\u7ed3\u5408\u5b9e\u9645\u200b\u573a\u666f\u200b\u7efc\u5408\u200b\u8003\u8651\u200b\uff0c\u200b\u4e00\u822c\u6765\u8bf4\u200b\u8bbe\u7f6e\u200b\u7684\u200b\u8d8a\u200b\u5927\u200b\uff0c\u200b\u5e0c\u671b\u200b\u9884\u6d4b\u200b\u7684\u200b\u672a\u6765\u200b\u5e8f\u5217\u200b\u8d8a\u957f\u200b\uff0c\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u901a\u5e38\u200b\u8d8a\u4f4e\u200b\uff1b
  • patience\uff1aearly stop\u200b\u673a\u5236\u200b\u53c2\u6570\u200b\uff0c\u200b\u6307\u5728\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u4e4b\u524d\u200b\uff0c\u200b\u5bb9\u5fcd\u200b\u6a21\u578b\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u7684\u200b\u6027\u80fd\u200b\u591a\u5c11\u200b\u6b21\u8fde\u7eed\u200b\u6ca1\u6709\u200b\u6539\u8fdb\u200b\uff1b\u200b\u8010\u5fc3\u200b\u503c\u8d8a\u200b\u5927\u200b\uff0c\u200b\u4e00\u822c\u200b\u8bad\u7ec3\u200b\u65f6\u95f4\u200b\u8d8a\u957f\u200b\u3002 \u200b\u66f4\u591a\u8d85\u200b\u53c2\u6570\u200b\u4ecb\u7ecd\u200b\uff0c\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002

  • \u200b\u4ee5\u4e0a\u200b\u53c2\u6570\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u5982\u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\uff1a-o Global.mode=train\uff1b\u200b\u6307\u5b9a\u200b\u524d\u200b 1 \u200b\u5361\u200b gpu \u200b\u8bad\u7ec3\u200b\uff1a-o Global.device=gpu:0\uff1b\u200b\u8bbe\u7f6e\u200b\u8bad\u7ec3\u200b\u8f6e\u200b\u6b21\u6570\u200b\u4e3a\u200b 10\uff1a-o Train.epochs_iters=10\uff1b

  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u3002
\u200b\u66f4\u200b\u591a\u200b\u8bf4\u660e\u200b\uff08\u200b\u70b9\u51fb\u200b\u5c55\u5f00\u200b\uff09
  • \u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0cPaddleX \u200b\u4f1a\u200b\u81ea\u52a8\u200b\u4fdd\u5b58\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u4e3a\u200boutput\uff0c\u200b\u5982\u9700\u200b\u6307\u5b9a\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u53ef\u200b\u901a\u8fc7\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b -o Global.output \u200b\u5b57\u200b\u6bb5\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u3002
  • PaddleX \u200b\u5bf9\u200b\u60a8\u200b\u5c4f\u853d\u200b\u4e86\u200b\u52a8\u6001\u56fe\u200b\u6743\u91cd\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7684\u200b\u6982\u5ff5\u200b\u3002\u200b\u5728\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\uff0c\u200b\u4f1a\u200b\u540c\u65f6\u200b\u4ea7\u51fa\u200b\u52a8\u6001\u56fe\u200b\u548c\u200b\u9759\u6001\u200b\u56fe\u200b\u7684\u200b\u6743\u91cd\u200b\uff0c\u200b\u5728\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u65f6\u200b\uff0c\u200b\u9ed8\u8ba4\u200b\u9009\u62e9\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u63a8\u7406\u200b\u3002
  • \u200b\u8bad\u7ec3\u200b\u5176\u4ed6\u200b\u6a21\u578b\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u7684\u200b\u6307\u5b9a\u200b\u76f8\u5e94\u200b\u7684\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u6a21\u578b\u200b\u548c\u200b\u914d\u7f6e\u200b\u7684\u200b\u6587\u4ef6\u200b\u7684\u200b\u5bf9\u5e94\u200b\u5173\u7cfb\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u67e5\u9605\u200bPaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09\u3002 \u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

\u200b\u8bad\u7ec3\u200b\u4ea7\u51fa\u200b\u89e3\u91ca\u200b:

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u6240\u6709\u200b\u4ea7\u51fa\u200b\u4fdd\u5b58\u200b\u5728\u200b\u6307\u5b9a\u200b\u7684\u200b\u8f93\u51fa\u200b\u76ee\u5f55\u200b\uff08\u200b\u9ed8\u8ba4\u200b\u4e3a\u200b./output/\uff09\u200b\u4e0b\u200b\uff0c\u200b\u901a\u5e38\u200b\u6709\u200b\u4ee5\u4e0b\u200b\u4ea7\u51fa\u200b\uff1a

  • train_result.json\uff1a\u200b\u8bad\u7ec3\u200b\u7ed3\u679c\u200b\u8bb0\u5f55\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u4efb\u52a1\u200b\u662f\u5426\u200b\u6b63\u5e38\u200b\u5b8c\u6210\u200b\uff0c\u200b\u4ee5\u53ca\u200b\u4ea7\u51fa\u200b\u7684\u200b\u6743\u91cd\u200b\u6307\u6807\u200b\u3001\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\u7b49\u200b\uff1b
  • train.log\uff1a\u200b\u8bad\u7ec3\u200b\u65e5\u5fd7\u200b\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u8bad\u7ec3\u200b\u8fc7\u7a0b\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u6307\u6807\u200b\u53d8\u5316\u200b\u3001loss \u200b\u53d8\u5316\u200b\u7b49\u200b\uff1b
  • config.yaml\uff1a\u200b\u8bad\u7ec3\u200b\u914d\u7f6e\u6587\u4ef6\u200b\uff0c\u200b\u8bb0\u5f55\u200b\u4e86\u200b\u672c\u6b21\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b\u7684\u200b\u914d\u7f6e\u200b\uff1b
  • best_accuracy.pdparams.tar\u3001scaler.pkl\u3001.checkpoints \u3001.inference\uff1a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u76f8\u5173\u200b\u6587\u4ef6\u200b\uff0c\u200b\u5305\u62ec\u200b\u7f51\u7edc\u200b\u53c2\u6570\u200b\u3001\u200b\u4f18\u5316\u200b\u5668\u200b\u3001\u200b\u9759\u6001\u200b\u56fe\u200b\u6743\u91cd\u200b\u7b49\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#52","title":"5.2 \u200b\u6a21\u578b\u200b\u8bc4\u4f30","text":"

\u200b\u5728\u200b\u5b8c\u6210\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u5bf9\u200b\u6307\u5b9a\u200b\u7684\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u5728\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\u8fdb\u884c\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u4f7f\u7528\u200b PaddleX \u200b\u8fdb\u884c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\uff0c\u200b\u53ea\u200b\u9700\u200b\u4e00\u884c\u200b\u547d\u4ee4\u200b\uff1a

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/electricity \\\n
\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u652f\u6301\u200b\u4fee\u6539\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u6216\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u65b9\u5f0f\u200b\u8bbe\u7f6e\u200b\u3002

\u200b\u6ce8\u200b\uff1a \u200b\u5728\u200b\u6a21\u578b\u200b\u8bc4\u4f30\u200b\u65f6\u200b\uff0c\u200b\u9700\u8981\u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u90fd\u200b\u5185\u7f6e\u200b\u4e86\u200b\u9ed8\u8ba4\u200b\u7684\u200b\u6743\u91cd\u200b\u4fdd\u5b58\u200b\u8def\u5f84\u200b\uff0c\u200b\u5982\u200b\u9700\u8981\u200b\u6539\u53d8\u200b\uff0c\u200b\u53ea\u200b\u9700\u8981\u200b\u901a\u8fc7\u200b\u8ffd\u52a0\u200b\u547d\u4ee4\u884c\u200b\u53c2\u6570\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\u5373\u53ef\u200b\uff0c\u200b\u5982\u200b-o Evaluate.weight_path=./output/best_model/model.pdparams\u3002

"},{"location":"practical_tutorials/ts_forecast.html#53","title":"5.3 \u200b\u6a21\u578b\u200b\u8c03\u4f18","text":"

\u200b\u5728\u200b\u5b66\u4e60\u200b\u4e86\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u540e\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u8c03\u6574\u200b\u8d85\u200b\u53c2\u6570\u200b\u6765\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u901a\u8fc7\u200b\u5408\u7406\u200b\u8c03\u6574\u200b\u8bad\u7ec3\u200b\u8f6e\u6570\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u63a7\u5236\u200b\u6a21\u578b\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6df1\u5ea6\u200b\uff0c\u200b\u907f\u514d\u200b\u8fc7\u200b\u62df\u5408\u200b\u6216\u200b\u6b20\u200b\u62df\u5408\u200b\uff1b\u200b\u800c\u200b\u5b66\u4e60\u200b\u7387\u200b\u7684\u200b\u8bbe\u7f6e\u200b\u5219\u200b\u5173\u4e4e\u200b\u6a21\u578b\u200b\u6536\u655b\u200b\u7684\u200b\u901f\u5ea6\u200b\u548c\u200b\u7a33\u5b9a\u6027\u200b\u3002\u200b\u56e0\u6b64\u200b\uff0c\u200b\u5728\u200b\u4f18\u5316\u200b\u6a21\u578b\u200b\u6027\u80fd\u200b\u65f6\u200b\uff0c\u200b\u52a1\u5fc5\u200b\u5ba1\u614e\u8003\u8651\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u53c2\u6570\u200b\u7684\u200b\u53d6\u503c\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5b9e\u9645\u200b\u60c5\u51b5\u200b\u8fdb\u884c\u200b\u7075\u6d3b\u200b\u8c03\u6574\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u5f97\u6700\u4f73\u200b\u7684\u200b\u8bad\u7ec3\u200b\u6548\u679c\u200b\u3002

\u200b\u57fa\u4e8e\u200b\u63a7\u5236\u53d8\u91cf\u200b\u7684\u200b\u65b9\u6cd5\u200b\uff0c\u200b\u6211\u4eec\u200b\u53ef\u4ee5\u200b\u91c7\u7528\u200b\u5728\u200b\u521d\u59cb\u200b\u9636\u6bb5\u200b\u57fa\u4e8e\u200b\u56fa\u5b9a\u200b\u7684\u200b\u8f83\u200b\u5c0f\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u591a\u6b21\u200b\u8c03\u6574\u200b\u5b66\u4e60\u200b\u7387\u200b\uff0c\u200b\u4ece\u800c\u200b\u627e\u5230\u200b\u8f83\u4f18\u200b\u5b66\u4e60\u200b\u7387\u200b\uff1b\u200b\u4e4b\u540e\u200b\u518d\u6b21\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u8fdb\u4e00\u6b65\u200b\u63d0\u5347\u200b\u6548\u679c\u200b\u3002\u200b\u5bf9\u4e8e\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u51b3\u5b9a\u200b\u4e86\u200b\u6a21\u578b\u200b\u5728\u200b\u505a\u51fa\u200b\u9884\u6d4b\u200b\u65f6\u200b\u5c06\u200b\u8003\u8651\u200b\u5386\u53f2\u6570\u636e\u200b\u7684\u200b\u591a\u5c11\u200b\uff0c\u200b\u4e5f\u200b\u5c24\u4e3a\u200b\u7684\u200b\u91cd\u8981\u200b\u3002\u200b\u4e0b\u9762\u200b\u6211\u4eec\u200b\u8be6\u7ec6\u200b\u4ecb\u7ecd\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u8c03\u53c2\u200b\u65b9\u6cd5\u200b:

\u200b\u63a8\u8350\u200b\u5728\u200b\u8c03\u8bd5\u200b\u53c2\u6570\u200b\u65f6\u200b\u9075\u5faa\u200b\u63a7\u5236\u53d8\u91cf\u200b\u6cd5\u200b\uff1a

  1. \u200b\u9996\u5148\u200b\u56fa\u5b9a\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u4e3a\u200b 5\uff0c\u200b\u6279\u200b\u5927\u5c0f\u200b\u4e3a\u200b 16\uff0c\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u4e3a\u200b 96\u3002
  2. \u200b\u57fa\u4e8e\u200b DLinear \u200b\u6a21\u578b\u200b\u542f\u52a8\u200b\u4e09\u4e2a\u200b\u5b9e\u9a8c\u200b\uff0c\u200b\u5b66\u4e60\u200b\u7387\u200b\u5206\u522b\u200b\u4e3a\u200b\uff1a0.0001\uff0c0.001\uff0c0.01\u3002
  3. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u5b9e\u9a8c\u200b\u4e8c\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\u3002\u200b\u56e0\u6b64\u200b\u56fa\u5b9a\u200b\u5b66\u4e60\u200b\u7387\u4e3a\u200b 0.001\uff0c\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5230\u200b 30\u3002\u200b\u6ce8\u200b\uff1a\u200b\u7531\u4e8e\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u200b\u5185\u7f6e\u200b\u7684\u200b earlystop \u200b\u673a\u5236\u200b\uff0c\u200b\u9a8c\u8bc1\u200b\u96c6\u200b\u7cbe\u5ea6\u200b\u5728\u200b 10 \u200b\u4e2a\u200b patience epoch\uff08\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff09\u200b\u540e\u200b\u6ca1\u6709\u200b\u63d0\u5347\u200b\u65f6\u200b\uff0c\u200b\u4f1a\u200b\u81ea\u52a8\u200b\u505c\u6b62\u200b\u8bad\u7ec3\u200b\u3002\u200b\u5982\u679c\u200b\u9700\u8981\u200b\u66f4\u6539\u200b\u65e9\u505c\u200b\u8bad\u7ec3\u200b\u7684\u200b\u8010\u5fc3\u200b\u8f6e\u6b21\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u624b\u52a8\u200b\u9ad8\u7ea7\u200b\u914d\u7f6e\u200b\u4e2d\u200b\u7684\u200b\u8d85\u200b\u53c2\u6570\u200b patience \u200b\u7684\u200b\u503c\u200b\u3002
  4. \u200b\u53ef\u4ee5\u200b\u53d1\u73b0\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u540e\u200b\u5b9e\u9a8c\u200b\u56db\u200b\u7cbe\u5ea6\u200b\u6700\u9ad8\u200b\uff0c\u200b\u63a5\u4e0b\u6765\u200b\u5c1d\u8bd5\u200b\u589e\u5927\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5230\u200b 144\uff0c\u200b\u4e5f\u200b\u5c31\u662f\u200b\u7528\u200b\u5386\u53f2\u200b 144 \u200b\u5c0f\u65f6\u200b\u7684\u200b\u6570\u636e\u200b\uff0c\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b 96 \u200b\u5c0f\u65f6\u200b\uff0c\u200b\u5f97\u5230\u200b\u5b9e\u9a8c\u200b\u4e94\u200b\u7684\u200b\u6307\u6807\u200b\u3002\u200b\u7cbe\u5ea6\u200b\u8fbe\u5230\u200b 0.188\u3002 \u200b\u5b66\u4e60\u200b\u7387\u200b\u63a2\u5bfb\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a
\u200b\u5b9e\u9a8c\u200bid \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mse \u200b\u5b9e\u9a8c\u200b\u4e00\u200b 5 0.0001 16 96 96 1\u200b\u5361\u200b 0.314 \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.001 16 96 96 1\u200b\u5361\u200b 0.302 \u200b\u5b9e\u9a8c\u200b\u4e09\u200b 5 0.01 16 96 96 1\u200b\u5361\u200b 0.320

\u200b\u589e\u5927\u200b\u8bad\u7ec3\u200b\u8f6e\u6b21\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bid \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mse \u200b\u5b9e\u9a8c\u200b\u4e8c\u200b 5 0.001 16 96 96 1\u200b\u5361\u200b 0.302 \u200b\u5b9e\u9a8c\u200b\u56db\u200b 30 0.001 16 96 96 1\u200b\u5361\u200b 0.301

\u200b\u589e\u5927\u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b\u5b9e\u9a8c\u200b\u7ed3\u679c\u200b\uff1a

\u200b\u5b9e\u9a8c\u200bid \u200b\u8f6e\u6b21\u200b \u200b\u5b66\u4e60\u200b\u7387\u200b batch_size \u200b\u8f93\u5165\u200b\u957f\u5ea6\u200b \u200b\u9884\u6d4b\u200b\u957f\u5ea6\u200b \u200b\u8bad\u7ec3\u200b\u73af\u5883\u200b \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mse \u200b\u5b9e\u9a8c\u200b\u56db\u200b 30 0.001 16 96 96 1\u200b\u5361\u200b 0.301 \u200b\u5b9e\u9a8c\u200b\u4e94\u200b 30 0.001 16 144 96 1\u200b\u5361\u200b 0.188"},{"location":"practical_tutorials/ts_forecast.html#6","title":"6. \u200b\u4ea7\u7ebf\u200b\u6d4b\u8bd5","text":"

\u200b\u5c06\u4ea7\u7ebf\u200b\u4e2d\u200b\u7684\u200b\u6a21\u578b\u200b\u66ff\u6362\u200b\u4e3a\u200b\u5fae\u8c03\u200b\u540e\u200b\u7684\u200b\u6a21\u578b\u200b\u8fdb\u884c\u200b\u6d4b\u8bd5\u200b\uff0c\u200b\u4f7f\u7528\u200b\u672c\u200b\u6848\u4f8b\u200b\u4e2d\u200b\u7684\u200b\u7535\u529b\u200b\u6d4b\u8bd5\u6570\u636e\u200b\uff0c\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\uff1a

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/test.csv\n
\u200b\u901a\u8fc7\u200b\u4e0a\u8ff0\u200b\u53ef\u200b\u5728\u200b./output\u200b\u4e0b\u200b\u751f\u6210\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\uff0c\u200b\u5176\u4e2d\u200btest.csv\u200b\u7684\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u4fdd\u5b58\u200b\u5728\u200bresult.csv\u200b\u4e2d\u200b\u3002

\u200b\u4e0e\u200b\u6a21\u578b\u200b\u8bad\u7ec3\u200b\u548c\u200b\u8bc4\u4f30\u200b\u7c7b\u4f3c\u200b\uff0c\u200b\u9700\u8981\u200b\u5982\u4e0b\u200b\u51e0\u6b65\u200b\uff1a

  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u7684\u200b.yaml \u200b\u914d\u7f6e\u6587\u4ef6\u200b\u8def\u5f84\u200b\uff08\u200b\u6b64\u5904\u200b\u4e3a\u200bDLinear.yaml\uff09
  • \u200b\u6307\u5b9a\u200b\u6a21\u5f0f\u200b\u4e3a\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u9884\u6d4b\u200b\uff1a-o Global.mode=predict
  • \u200b\u6307\u5b9a\u200b\u6a21\u578b\u200b\u6743\u91cd\u200b\u8def\u5f84\u200b\uff1a-o Predict.model_dir=\"./output/inference\"
  • \u200b\u6307\u5b9a\u200b\u8f93\u5165\u200b\u6570\u636e\u200b\u8def\u5f84\u200b\uff1a-o Predict.input=\"...\" \u200b\u5176\u4ed6\u200b\u76f8\u5173\u200b\u53c2\u6570\u5747\u200b\u53ef\u200b\u901a\u8fc7\u200b\u4fee\u6539\u200b.yaml\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u4e2d\u200b\u7684\u200bGlobal\u200b\u548c\u200bPredict\u200b\u4e0b\u200b\u7684\u200b\u5b57\u200b\u6bb5\u200b\u6765\u200b\u8fdb\u884c\u200b\u8bbe\u7f6e\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf7\u200b\u53c2\u8003\u200bPaddleX\u200b\u65f6\u5e8f\u200b\u4efb\u52a1\u6a21\u578b\u200b\u914d\u7f6e\u6587\u4ef6\u200b\u53c2\u6570\u200b\u8bf4\u660e\u200b\u3002
"},{"location":"practical_tutorials/ts_forecast.html#7","title":"7. \u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72","text":"

\u200b\u5982\u679c\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u53ef\u4ee5\u200b\u8fbe\u5230\u200b\u60a8\u200b\u5bf9\u200b\u4ea7\u7ebf\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u548c\u200b\u7cbe\u5ea6\u200b\u7684\u200b\u8981\u6c42\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u76f4\u63a5\u200b\u8fdb\u884c\u200b\u5f00\u53d1\u200b\u96c6\u6210\u200b/\u200b\u90e8\u7f72\u200b\u3002

  1. \u200b\u82e5\u200b\u60a8\u200b\u9700\u8981\u200b\u5c06\u200b\u901a\u7528\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u76f4\u63a5\u200b\u5e94\u7528\u200b\u5728\u200b\u60a8\u200b\u7684\u200b Python \u200b\u9879\u76ee\u200b\u4e2d\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u53c2\u8003\u200b \u200b\u5982\u4e0b\u200b\u793a\u4f8b\u200b\u4ee3\u7801\u200b\uff1a

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_forecast\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n
    \u200b\u66f4\u200b\u591a\u200b\u53c2\u6570\u200b\u8bf7\u200b\u53c2\u8003\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4f7f\u7528\u200b\u6559\u7a0b\u200b\u3002

  2. \u200b\u6b64\u5916\u200b\uff0cPaddleX \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u4ea7\u7ebf\u200b\u4e5f\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u8bf4\u660e\u200b\u5982\u4e0b\u200b\uff1a

  3. \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff1a\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u662f\u200b\u5b9e\u9645\u200b\u751f\u4ea7\u200b\u73af\u5883\u200b\u4e2d\u200b\u5e38\u89c1\u200b\u7684\u200b\u4e00\u79cd\u200b\u90e8\u7f72\u200b\u5f62\u5f0f\u200b\u3002\u200b\u901a\u8fc7\u200b\u5c06\u200b\u63a8\u7406\u200b\u529f\u80fd\u200b\u5c01\u88c5\u200b\u4e3a\u200b\u670d\u52a1\u200b\uff0c\u200b\u5ba2\u6237\u7aef\u200b\u53ef\u4ee5\u200b\u901a\u8fc7\u200b\u7f51\u7edc\u200b\u8bf7\u6c42\u200b\u6765\u200b\u8bbf\u95ee\u200b\u8fd9\u4e9b\u200b\u670d\u52a1\u200b\uff0c\u200b\u4ee5\u200b\u83b7\u53d6\u200b\u63a8\u7406\u200b\u7ed3\u679c\u200b\u3002PaddleX \u200b\u652f\u6301\u200b\u7528\u6237\u200b\u4ee5\u200b\u4f4e\u6210\u672c\u200b\u5b9e\u73b0\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\uff0c\u200b\u8be6\u7ec6\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6d41\u7a0b\u200b\u8bf7\u200b\u53c2\u8003\u200b PaddleX \u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u6307\u5357\u200b\u3002 \u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u9700\u8981\u200b\u9009\u62e9\u200b\u5408\u9002\u200b\u7684\u200b\u65b9\u5f0f\u200b\u90e8\u7f72\u200b\u6a21\u578b\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u8fdb\u800c\u200b\u8fdb\u884c\u200b\u540e\u7eed\u200b\u7684\u200b AI \u200b\u5e94\u7528\u200b\u96c6\u6210\u200b\u3002
"},{"location":"support_list/model_list_dcu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6d77\u5149\u200b DCU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_dcu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_dcu.html#_2","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Deeplabv3_Plus-R50 80.36 94.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3_Plus-R101 81.10 162.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_mlu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u5bd2\u6b66\u7eaa\u200b MLU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MobileNetV3_large_x0_5 69.2 9.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 7.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 14.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 19.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 26.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 6.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 6.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 8.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 13.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 86.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 6.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 5.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 8.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 16.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 23.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 32.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_mlu.html#_2","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet-L 42.6 20.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 4.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 185.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 83.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 28.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 349.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_mlu.html#_3","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LiteSeg-T 73.10 28.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_mlu.html#_4","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 4.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det 82.69 100.1M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_5","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 10.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 71.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_6","title":"\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 7.4M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_mlu.html#_7","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/model_list_npu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6607\u200b\u817e\u200b NPU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_224 85.36 306.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CLIP_vit_large_patch14_224 88.1 1.04 G \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_224 83.84 313.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_384 84.90 313.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_224 84.26 700.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_384 85.27 700.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_small 83.13 178.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_tiny 82.03 101.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_5 63.5 4.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_25 51.4 1.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_75 68.8 9.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x1_0 71.0 15.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_5 65.0 7.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_25 53.2 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_0 72.2 12.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_5 74.1 25.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x2_0 75.2 41.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_5 69.2 9.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 7.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 14.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 19.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 26.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 6.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 6.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 8.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 13.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_large 83.4 125.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_medium 79.9 37.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_small 74.6 14.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_base 85.0 249.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 86.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_tiny 79.83 52.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0 77.77 21.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B1 79.18 22.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B2 81.74 39.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B3 82.98 57.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B4 83.57 70.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B5 84.75 140.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6 86.30 268.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 6.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 5.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 8.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 16.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 23.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 32.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_base 77.05 23.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_large 78.51 37.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_small 73.97 14.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18_vd 72.3 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34_vd 76.0 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_vd 79.1 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101_vd 80.2 158.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152_vd 80.6 214.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet200_vd 80.9 266.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window7_224 83.37 310.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window12_384 84.17 311.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window7_224 86.19 694.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window12_384 87.06 696.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_small_patch4_window7_224 83.21 175.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_tiny_patch4_window7_224 81.10 100.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_npu.html#_2","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_448_ML 89.15 325.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0_ML 80.98 39.6 M PP-HGNetV2-B4_ML 87.96 88.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6_ML 91.25 286.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"support_list/model_list_npu.html#_3","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Cascade-FasterRCNN-ResNet50-FPN 41.1 245.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 246.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-DLA-34 37.6 75.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-ResNet50 38.9 319.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DETR-R50 42.3 159.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet34-FPN 37.8 137.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50 36.7 120.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-FPN 38.4 148.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-FPN 39.5 148.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 148.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101 39.0 188.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101-FPN 41.4 216.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNeXt101-vd-FPN 43.4 360.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-Swin-Tiny-FPN 42.6 159.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FCOS-ResNet50 39.6 124.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L 42.6 20.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-M 37.5 16.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 4.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-XS 26.2 5.7M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 185.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 83.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 28.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 349.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H 56.3 435.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-L 53.0 113.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R18 46.5 70.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R50 53.1 149.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-X 54.8 232.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-DarkNet53 39.1 219.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-MobileNetV3 31.4 83.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-ResNet50_vd_DCN 40.6 163.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_4","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE_plus_SOD-S 25.1 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-L 31.9 325.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-largesize-L 42.7 340.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_5","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_human 48.0 196.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_human 42.5 28.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_6","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Deeplabv3_Plus-R50 80.36 94.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3_Plus-R101 81.10 162.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R50 79.90 138.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R101 80.85 205.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b OCRNet_HRNet-W48 82.15 249.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LiteSeg-T 73.10 28.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_npu.html#_7","title":"\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Mask AP \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask-RT-DETR-H 50.6 449.9 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-L 45.7 113.6 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-M 42.7 66.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-S 41.0 51.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-X 47.5 237.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-FPN 36.3 254.8 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 254.7 \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-FPN 35.6 157.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-vd-FPN 36.4 157.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50 32.8 127.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-FPN 36.6 225.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-vd-FPN 38.1 225.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNeXt101-vd-FPN 39.5 370.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_seg-S 32.5 31.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_8","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_rec_CLIP_vit_base 88.69 306.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec_CLIP_vit_large 91.03 1.05 G \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"support_list/model_list_npu.html#_9","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_det 41.5 27.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_10","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_vehicle 63.9 196.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_vehicle 61.3 28.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_npu.html#_11","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b STFPM 96.2 21.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_12","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 4.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det 82.69 100.1M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_13","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 10.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 71.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_SVTRv2_rec 68.81 73.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_RepSVTR_rec 65.07 22.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_14","title":"\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b SLANet 76.31 6.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPubtabNet\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_15","title":"\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 7.4M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L_layout_3cls 89.3 22.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_3cls 95.9 470.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_17cls 92.6 470.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_16","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary 0.600 0.515 55.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST 0.385 0.397 2.0M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TiDE 0.405 0.412 31.7M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet 0.417 0.431 4.9M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/model_list_npu.html#_17","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AutoEncoder_ad 99.36 84.36 91.25 52K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DLinear_ad 98.98 93.96 96.41 112K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary_ad 98.55 88.95 93.51 1.8M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST_ad 98.78 90.70 94.57 320K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet_ad 98.37 94.80 96.56 1.3M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bPSM\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/model_list_npu.html#_18","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b TimesNet_cls 87.5 792K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bUWaveGestureLibrary\uff1a\u200b\u8bad\u7ec3\u200b\u3001\u200b\u8bc4\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/model_list_xpu.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6606\u4ed1\u200b XPU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MobileNetV3_large_x0_5 69.2 9.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 7.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 14.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 19.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 26.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 6.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 6.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 8.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 13.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 86.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 6.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 5.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 5.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 8.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 10.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 16.0 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 23.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 32.1 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 41.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 77.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 90.8 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 158.7 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 214.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bImageNet-1k\u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/model_list_xpu.html#_2","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet-L 42.6 20.9 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 4.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 185.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 83.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 28.3 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 349.4 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCOCO2017\u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/model_list_xpu.html#_3","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LiteSeg-T 73.10 28.5 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200bCityscapes\u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

"},{"location":"support_list/model_list_xpu.html#_4","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 4.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det \uff09 82.69 100.1M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_5","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 10.6 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 71.2 M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_6","title":"\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 7.4M \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u5206\u6790\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/model_list_xpu.html#_7","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff08M) \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40K \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200bETTH1\u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/models_list.html","title":"PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08CPU/GPU\uff09","text":"

PaddleX \u200b\u5185\u7f6e\u200b\u4e86\u200b\u591a\u6761\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u6bcf\u6761\u200b\u4ea7\u7ebf\u200b\u90fd\u200b\u5305\u542b\u200b\u4e86\u200b\u82e5\u5e72\u200b\u6a21\u5757\u200b\uff0c\u200b\u6bcf\u4e2a\u200b\u6a21\u5757\u200b\u5305\u542b\u200b\u82e5\u5e72\u200b\u6a21\u578b\u200b\uff0c\u200b\u5177\u4f53\u200b\u4f7f\u7528\u200b\u54ea\u4e9b\u200b\u6a21\u578b\u200b\uff0c\u200b\u60a8\u200b\u53ef\u4ee5\u200b\u6839\u636e\u200b\u4e0b\u8fb9\u200b\u7684\u200b benchmark \u200b\u6570\u636e\u200b\u6765\u200b\u9009\u62e9\u200b\u3002\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u7cbe\u5ea6\u200b\u8f83\u200b\u9ad8\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u8f83\u200b\u5feb\u200b\u7684\u200b\u6a21\u578b\u200b\uff0c\u200b\u5982\u200b\u60a8\u200b\u66f4\u200b\u8003\u8651\u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\uff0c\u200b\u8bf7\u200b\u9009\u62e9\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b\u8f83\u200b\u5c0f\u200b\u7684\u200b\u6a21\u578b\u200b\u3002

"},{"location":"support_list/models_list.html#_1","title":"\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_224 85.36 13.1957 285.493 306.5 M CLIP_vit_base_patch16_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CLIP_vit_large_patch14_224 88.1 51.1284 1131.28 1.04 G CLIP_vit_large_patch14_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_224 83.84 12.8473 1513.87 313.9 M ConvNeXt_base_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_base_384 84.90 31.7607 3967.05 313.9 M ConvNeXt_base_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_224 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_large_384 85.27 66.4058 6598.92 700.7 M ConvNeXt_large_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_small 83.13 9.74075 1127.6 178.0 M ConvNeXt_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ConvNeXt_tiny 82.03 5.48923 672.559 101.4 M ConvNeXt_tiny.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-L 83.5 23.4415 - 357.1 M FasterNet-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-M 83.0 21.8936 - 204.6 M FasterNet-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-S 81.3 13.0409 - 119.3 M FasterNet-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-T0 71.9 12.2432 - 15.1 M FasterNet-T0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-T1 75.9 11.3562 - 29.2 M FasterNet-T1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterNet-T2 79.1 10.703 - 57.4 M FasterNet-T2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_5 63.5 1.86754 7.48297 4.8 M MobileNetV1_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_25 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x0_75 68.8 2.57903 10.6343 9.3 M MobileNetV1_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV1_x1_0 71.0 2.78781 13.98 15.2 M MobileNetV1_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_5 65.0 4.94234 11.1629 7.1 M MobileNetV2_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x0_25 53.2 4.50856 9.40991 5.5 M MobileNetV2_x0_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_0 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x1_5 74.1 6.28385 22.5129 25.0 M MobileNetV2_x1_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV2_x2_0 75.2 6.12888 30.8612 41.2 M MobileNetV2_x2_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_5 69.2 6.31302 14.5588 9.6 M MobileNetV3_large_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_35 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_35.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x0_75 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_0 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_large_x1_25 76.4 8.73358 22.1296 26.5 M MobileNetV3_large_x1_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_5 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_35 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_35.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x0_75 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_0 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV3_small_x1_25 70.7 6.9589 14.3995 13.0 M MobileNetV3_small_x1_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_large 83.4 12.5485 51.6453 125.2 M MobileNetV4_conv_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_medium 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_medium.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_conv_small 74.6 5.24172 11.0893 14.7 M MobileNetV4_conv_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_hybrid_large 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MobileNetV4_hybrid_medium 80.5 19.7543 62.2624 42.9 M MobileNetV4_hybrid_medium.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_base 85.0 14.2969 327.114 249.4 M PP-HGNet_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_small 81.51 5.50661 119.041 86.5 M PP-HGNet_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNet_tiny 79.83 5.22006 69.396 52.4 M PP-HGNet_tiny.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B1 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B2 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B3 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B4 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B4.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B5 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6 86.30 21.226 255.279 268.4 M PP-HGNetV2-B6.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_5 63.14 3.67722 6.66857 6.7 M PP-LCNet_x0_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_25 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_25.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_35 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_35.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x0_75 68.18 3.91032 8.06953 8.4 M PP-LCNet_x0_75.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_5 73.71 3.97666 12.3457 16.0 M PP-LCNet_x1_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_0 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x2_5 76.60 4.06028 21.5063 32.1 M PP-LCNet_x2_5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_base 77.05 5.23428 19.6005 23.7 M PP-LCNetV2_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_large 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNetV2_small 73.97 3.89762 13.0273 14.6 M PP-LCNetV2_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18_vd 72.3 3.53048 31.3014 41.5 M ResNet18_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet18 71.0 2.4868 27.4601 41.5 M ResNet18.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34_vd 76.0 5.60675 56.0653 77.3 M ResNet34_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet34 74.6 4.16902 51.925 77.3 M ResNet34.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_vd 79.1 10.1885 68.446 90.8 M ResNet50_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50 76.5 9.62383 64.8135 90.8 M ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101_vd 80.2 20.0563 124.85 158.4 M ResNet101_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet101 77.6 19.2297 121.006 158.7 M ResNet101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152_vd 80.6 29.6439 181.678 214.3 M ResNet152_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet152 78.3 30.0461 177.707 214.2 M ResNet152.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet200_vd 80.9 39.1628 235.185 266.0 M ResNet200_vd.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S1 73.6 9.895 23.0465 11.2 M StarNet-S1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S2 74.8 7.91279 21.9571 14.3 M StarNet-S2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S3 77.0 10.7531 30.7656 22.2 M StarNet-S3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b StarNet-S4 79.0 15.2868 43.2497 28.9 M StarNet-S4.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window7_224 83.37 16.9848 383.83 310.5 M SwinTransformer_base_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_base_patch4_window12_384 84.17 37.2855 1178.63 311.4 M SwinTransformer_base_patch4_window12_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window7_224 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_large_patch4_window12_384 87.06 74.1768 2105.22 696.1 M SwinTransformer_large_patch4_window12_384.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_small_patch4_window7_224 83.21 16.3982 285.56 175.6 M SwinTransformer_small_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SwinTransformer_tiny_patch4_window7_224 81.10 8.54846 156.306 100.1 M SwinTransformer_tiny_patch4_window7_224.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ImageNet-1k \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Top1 Acc\u3002

"},{"location":"support_list/models_list.html#_2","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b CLIP_vit_base_patch16_448_ML 89.15 - - 325.6 M CLIP_vit_base_patch16_448_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B0_ML 80.98 - - 39.6 M PP-HGNetV2-B0_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B4_ML 87.96 - - 88.5 M PP-HGNetV2-B4_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-HGNetV2-B6_ML 91.25 - - 286.5 M PP-HGNetV2-B6_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LCNet_x1_0_ML 77.96 - - 29.4 M PP-LCNet_x1_0_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_ML 83.50 - - 108.9 M ResNet50_ML.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"support_list/models_list.html#_3","title":"\u884c\u4eba\u200b\u5c5e\u6027\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LCNet_x1_0_pedestrian_attribute 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200bmA\u3002

"},{"location":"support_list/models_list.html#_4","title":"\u8f66\u8f86\u200b\u5c5e\u6027\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mA\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LCNet_x1_0_vehicle_attribute 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VeRi \u200b\u6570\u636e\u200b\u96c6\u200b mA\u3002

"},{"location":"support_list/models_list.html#_5","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G PP-ShiTuV2_rec_CLIP_vit_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"support_list/models_list.html#_6","title":"\u6587\u6863\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Top-1 Acc\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-LCNet_x1_0_doc_ori 99.26 3.84845 9.23735 7.1 M PP-LCNet_x1_0_doc_ori.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleX \u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u6570\u636e\u200b\u96c6\u200b Top-1 Acc \u3002

"},{"location":"support_list/models_list.html#_7","title":"\u4eba\u8138\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8f93\u51fa\u200b\u7279\u5f81\u200b\u7ef4\u5ea6\u200b Acc (%)AgeDB-30/CFP-FP/LFW GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b (ms) CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b (M) yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b MobileFaceNet 128 96.28/96.71/99.58 4.1 MobileFaceNet.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b ResNet50_face 512 98.12/98.56/99.77 87.2 ResNet50_face.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5206\u522b\u200b\u5728\u200bAgeDB-30\u3001CFP-FP\u200b\u548c\u200bLFW\u200b\u6570\u636e\u200b\u96c6\u4e0a\u200b\u6d4b\u5f97\u200b\u7684\u200bAccuracy\u3002

"},{"location":"support_list/models_list.html#_8","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-ShiTuV2_det 41.5 33.7426 537.003 27.6 M PP-ShiTuV2_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_9","title":"\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Cascade-FasterRCNN-ResNet50-FPN 41.1 - - 245.4 M Cascade-FasterRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 - - 246.2 M Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-DLA-34 37.6 - - 75.4 M CenterNet-DLA-34.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b CenterNet-ResNet50 38.9 - - 319.7 M CenterNet-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DETR-R50 42.3 59.2132 5334.52 159.3 M DETR-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet34-FPN 37.8 - - 137.5 M FasterRCNN-ResNet34-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-FPN 38.4 - - 148.1 M FasterRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-FPN 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet50 36.7 - - 120.2 M FasterRCNN-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101-FPN 41.4 - - 216.3 M FasterRCNN-ResNet101-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNet101 39.0 - - 188.1 M FasterRCNN-ResNet101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-ResNeXt101-vd-FPN 43.4 - - 360.6 M FasterRCNN-ResNeXt101-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FasterRCNN-Swin-Tiny-FPN 42.6 - - 159.8 M FasterRCNN-Swin-Tiny-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b FCOS-ResNet50 39.6 103.367 3424.91 124.2 M FCOS-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L 42.6 16.6715 169.904 20.9 M PicoDet-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-M 37.5 16.2311 71.7257 16.8 M PicoDet-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S 29.1 14.097 37.6563 4.4 M PicoDet-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-XS 26.2 13.8102 48.3139 5.7M PicoDet-XS.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-L 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-M 49.8 19.843 449.261 83.2 M PP-YOLOE_plus-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-X 54.7 57.8995 1439.93 349.4 M PP-YOLOE_plus-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H 56.3 114.814 3933.39 435.8 M RT-DETR-H.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-L 53.0 34.5252 1454.27 113.7 M RT-DETR-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R18 46.5 19.89 784.824 70.7 M RT-DETR-R18.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-R50 53.1 41.9327 1625.95 149.1 M RT-DETR-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-X 54.8 61.8042 2246.64 232.9 M RT-DETR-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-DarkNet53 39.1 40.1055 883.041 219.7 M YOLOv3-DarkNet53.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-MobileNetV3 31.4 18.6692 267.214 83.8 M YOLOv3-MobileNetV3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOv3-ResNet50_vd_DCN 40.6 31.6276 856.047 163.0 M YOLOv3-ResNet50_vd_DCN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-L 50.1 185.691 1250.58 192.5 M YOLOX-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-M 46.9 123.324 688.071 90.0 M YOLOX-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-N 26.1 79.1665 155.59 3.4M YOLOX-N.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-S 40.4 184.828 474.446 32.0 M YOLOX-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-T 32.9 102.748 212.52 18.1 M YOLOX-T.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b YOLOX-X 51.8 227.361 2067.84 351.5 M YOLOX-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_10","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE_plus_SOD-S 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-L 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus_SOD-largesize-L 42.7 458.521 11172.7 340.5 M PP-YOLOE_plus_SOD-largesize-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_11","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_human 48.0 32.7754 777.691 196.1 M PP-YOLOE-L_human.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_human 42.5 15.0118 179.317 28.8 M PP-YOLOE-S_human.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_12","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-YOLOE-L_vehicle 63.9 32.5619 775.633 196.1 M PP-YOLOE-L_vehicle.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE-S_vehicle 61.3 15.3787 178.441 28.8 M PP-YOLOE-S_vehicle.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_13","title":"\u4eba\u8138\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b AP (%)Easy/Medium/Hard GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b BlazeFace 77.7/73.4/49.5 0.447 M BlazeFace.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b BlazeFace-FPN-SSH 83.2/80.5/60.5 0.606 M BlazeFace-FPN-SSH.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet_LCNet_x2_5_face 93.7/90.7/68.1 28.9 M PicoDet_LCNet_x2_5_face.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_plus-S_face 93.9/91.8/79.8 26.5 M PP-YOLOE_plus-S_face \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u662f\u200b\u5728\u200bWIDER-FACE\u200b\u9a8c\u8bc1\u200b\u96c6\u4e0a\u200b\uff0c\u200b\u4ee5\u200b640 *640\u200b\u4f5c\u4e3a\u200b\u8f93\u5165\u200b\u5c3a\u5bf8\u200b\u8bc4\u4f30\u200b\u5f97\u5230\u200b\u7684\u200b\u3002

"},{"location":"support_list/models_list.html#_14","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b STFPM 96.2 - - 21.5 M STFPM.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"support_list/models_list.html#_15","title":"\u8bed\u4e49\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Deeplabv3_Plus-R50 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3_Plus-R101 81.10 100.026 2460.71 162.5 M Deeplabv3_Plus-R101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R50 79.90 82.2631 1735.83 138.3 M Deeplabv3-R50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Deeplabv3-R101 80.85 121.492 2685.51 205.9 M Deeplabv3-R101.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b OCRNet_HRNet-W18 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W18.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b OCRNet_HRNet-W48 82.15 78.9976 2226.95 249.8 M OCRNet_HRNet-W48.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LiteSeg-T 73.10 7.6827 138.683 28.5 M PP-LiteSeg-T.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-LiteSeg-B 75.25 10.9935 194.727 47.0 M PP-LiteSeg-B.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B0 (slice) 76.73 11.1946 268.929 13.2 M SegFormer-B0.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B1 (slice) 78.35 17.9998 403.393 48.5 M SegFormer-B1.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B2 (slice) 81.60 48.0371 1248.52 96.9 M SegFormer-B2.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B3 (slice) 82.47 64.341 1666.35 167.3 M SegFormer-B3.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B4 (slice) 82.38 82.4336 1995.42 226.7 M SegFormer-B4.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SegFormer-B5 (slice) 82.58 97.3717 2420.19 229.7 M SegFormer-B5.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b Cityscapes \u200b\u6570\u636e\u200b\u96c6\u200b mloU\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b mloU\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b SeaFormer_base(slice) 40.92 24.4073 397.574 30.8 M SeaFormer_base.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SeaFormer_large (slice) 43.66 27.8123 550.464 49.8 M SeaFormer_large.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SeaFormer_small (slice) 38.73 19.2295 358.343 14.3 M SeaFormer_small.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SeaFormer_tiny (slice) 34.58 13.9496 330.132 6.1M SeaFormer_tiny.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b ADE20k \u200b\u6570\u636e\u200b\u96c6\u200b, slice \u200b\u8868\u793a\u200b\u5bf9\u200b\u8f93\u5165\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200b\u4e86\u200b\u5207\u56fe\u200b\u64cd\u4f5c\u200b\u3002

"},{"location":"support_list/models_list.html#_16","title":"\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Mask AP GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b Mask-RT-DETR-H 50.6 132.693 4896.17 449.9 M Mask-RT-DETR-H.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-L 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-L.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-M 42.7 36.8329 - 66.6 M Mask-RT-DETR-M.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-S 41.0 33.5007 - 51.8 M Mask-RT-DETR-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Mask-RT-DETR-X 47.5 75.755 3358.04 237.5 M Mask-RT-DETR-X.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-FPN 36.3 - - 254.8 M Cascade-MaskRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 - - 254.7 M Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-FPN 35.6 - - 157.5 M MaskRCNN-ResNet50-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50-vd-FPN 36.4 - - 157.5 M MaskRCNN-ResNet50-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet50 32.8 - - 127.8 M MaskRCNN-ResNet50.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-FPN 36.6 - - 225.4 M MaskRCNN-ResNet101-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNet101-vd-FPN 38.1 - - 225.1 M MaskRCNN-ResNet101-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b MaskRCNN-ResNeXt101-vd-FPN 39.5 - - 370.0 M MaskRCNN-ResNeXt101-vd-FPN.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-YOLOE_seg-S 32.5 - - 31.5 M PP-YOLOE_seg-S.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

|SOLOv2| 35.5|-|-|179.1 M|SOLOv2.yaml

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u9a8c\u8bc1\u200b\u96c6\u200b Mask AP(0.5:0.95)\u3002

"},{"location":"support_list/models_list.html#_17","title":"\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_det 77.79 10.6923 120.177 4.2 M PP-OCRv4_mobile_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_det 82.69 83.3501 2434.01 100.1M PP-OCRv4_server_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u68c0\u6d4b\u200b\u5305\u542b\u200b 500 \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/models_list.html#_18","title":"\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u68c0\u6d4b\u200bHmean\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u5370\u7ae0\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b500\u200b\u5370\u7ae0\u200b\u56fe\u50cf\u200b\u3002

"},{"location":"support_list/models_list.html#_19","title":"\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PP-OCRv4_mobile_rec 78.20 7.95018 46.7868 10.6 M PP-OCRv4_mobile_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PP-OCRv4_server_rec 79.20 7.19439 140.179 71.2 M PP-OCRv4_server_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR \u200b\u81ea\u5efa\u200b\u7684\u200b\u4e2d\u6587\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u8986\u76d6\u200b\u8857\u666f\u200b\u3001\u200b\u7f51\u56fe\u200b\u3001\u200b\u6587\u6863\u200b\u3001\u200b\u624b\u5199\u200b\u591a\u4e2a\u200b\u573a\u666f\u200b\uff0c\u200b\u5176\u4e2d\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5305\u542b\u200b 1.1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_SVTRv2_rec 68.81 8.36801 165.706 73.9 M ch_SVTRv2_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bA\u200b\u699c\u200b\u3002

\u200b\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u8bc6\u522b\u200bAvg Accuracy(%) GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b ch_RepSVTR_rec 65.07 10.5047 51.5647 22.1 M ch_RepSVTR_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleOCR\u200b\u7b97\u6cd5\u200b\u6a21\u578b\u200b\u6311\u6218\u8d5b\u200b - \u200b\u8d5b\u9898\u200b\u4e00\u200b\uff1aOCR\u200b\u7aef\u5230\u200b\u7aef\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200bB\u200b\u699c\u200b\u3002

"},{"location":"support_list/models_list.html#_20","title":"\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b BLEU score normed edit distance ExpRate \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b LaTeX_OCR_rec 0.8821 0.0823 40.01 - - 89.7 M LaTeX_OCR_rec.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b LaTeX-OCR\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u6d4b\u8bd5\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_21","title":"\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b \u200b\u7cbe\u5ea6\u200b\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b SLANet 59.52 522.536 1845.37 6.9 M SLANet.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b SLANet_plus 63.69 522.536 1845.37 6.9 M SLANet_plus.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PaddleX\u200b\u5185\u90e8\u200b\u81ea\u200b\u5efa\u200b\u82f1\u6587\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_22","title":"\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b MS-SSIM \uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b UVDoc 54.40 - - 30.3 M UVDoc.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PaddleX\u200b\u81ea\u5efa\u200b\u7684\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_23","title":"\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP@(0.50:0.95)\uff08%\uff09 GPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 CPU\u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\uff08ms\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b PicoDet_layout_1x 86.8 13.036 91.2634 7.4 M PicoDet_layout_1x.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S_layout_3cls 87.1 13.521 45.7633 4.8 M PicoDet-S_layout_3cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-S_layout_17cls 70.3 13.5632 46.2059 4.8 M PicoDet-S_layout_17cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L_layout_3cls 89.3 15.7425 159.771 22.6 M PicoDet-L_layout_3cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PicoDet-L_layout_17cls 79.9 17.1901 160.262 22.6 M PicoDet-L_layout_17cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_3cls 95.9 114.644 3832.62 470.1 M RT-DETR-H_layout_3cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RT-DETR-H_layout_17cls 92.6 115.126 3827.25 470.2 M RT-DETR-H_layout_17cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u7684\u200b\u8bc4\u4f30\u200b\u96c6\u662f\u200b PaddleX \u200b\u81ea\u5efa\u200b\u7684\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b\uff0c\u200b\u5305\u542b\u200b 1w \u200b\u5f20\u200b\u56fe\u7247\u200b\u3002

"},{"location":"support_list/models_list.html#_24","title":"\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mse mae \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b DLinear 0.382 0.394 72 K DLinear.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b NLinear 0.386 0.392 40 K NLinear.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary 0.600 0.515 55.5 M Nonstationary.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST 0.385 0.397 2.0 M PatchTST.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b RLinear 0.384 0.392 40 K RLinear.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TiDE 0.405 0.412 31.7 M TiDE.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet 0.417 0.431 4.9 M TimesNet.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b ETTH1 \u200b\u6570\u636e\u200b\u96c6\u200b \uff08\u200b\u5728\u200b\u6d4b\u8bd5\u200b\u96c6\u200btest.csv\u200b\u4e0a\u200b\u7684\u200b\u8bc4\u6d4b\u200b\u7ed3\u679c\u200b\uff09\u3002

"},{"location":"support_list/models_list.html#_25","title":"\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b precison recall f1_score \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b AutoEncoder_ad 99.36 84.36 91.25 52 K AutoEncoder_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b DLinear_ad 98.98 93.96 96.41 112 K DLinear_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b Nonstationary_ad 98.55 88.95 93.51 1.8 M Nonstationary_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b PatchTST_ad 98.78 90.70 94.57 320 K PatchTST_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b TimesNet_ad 98.37 94.80 96.56 1.3 M TimesNet_ad.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b PSM \u200b\u6570\u636e\u200b\u96c6\u200b\u3002

"},{"location":"support_list/models_list.html#_26","title":"\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b acc(%) \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b yaml \u200b\u6587\u4ef6\u200b \u200b\u6a21\u578b\u200b\u4e0b\u8f7d\u200b\u94fe\u63a5\u200b TimesNet_cls 87.5 792 K TimesNet_cls.yaml \u200b\u63a8\u7406\u6a21\u578b\u200b/\u200b\u8bad\u7ec3\u200b\u6a21\u578b\u200b

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u6d4b\u91cf\u200b\u81ea\u200b UWaveGestureLibrary\u200b\u6570\u636e\u200b\u96c6\u200b\u3002

>\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u6240\u6709\u200b\u6a21\u578b\u200b GPU \u200b\u63a8\u7406\u200b\u8017\u65f6\u200b\u57fa\u4e8e\u200b NVIDIA Tesla T4 \u200b\u673a\u5668\u200b\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\uff0c CPU \u200b\u63a8\u7406\u200b\u901f\u5ea6\u200b\u57fa\u4e8e\u200b Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz\uff0c\u200b\u7ebf\u7a0b\u200b\u6570\u4e3a\u200b8\uff0c\u200b\u7cbe\u5ea6\u200b\u7c7b\u578b\u200b\u4e3a\u200b FP32\u3002

"},{"location":"support_list/pipelines_list.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(CPU/GPU)","text":""},{"location":"support_list/pipelines_list.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5b83\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u533a\u5206\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u4e0d\u540c\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u7684\u200b\u7cbe\u786e\u200b\u5206\u5272\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5728\u200b\u540c\u4e00\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5206\u522b\u200b\u6807\u8bb0\u200b\u51fa\u200b\u6bcf\u200b\u4e00\u8f86\u8f66\u200b\u3001\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u4eba\u200b\u6216\u200b\u6bcf\u200b\u4e00\u53ea\u200b\u52a8\u7269\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5b83\u4eec\u200b\u5728\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u4e0a\u200b\u88ab\u200b\u72ec\u7acb\u200b\u5904\u7406\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u5305\u542b\u200b\u591a\u8f86\u200b\u8f66\u200b\u548c\u200b\u884c\u4eba\u200b\u7684\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u80fd\u591f\u200b\u5c06\u200b\u6bcf\u8f86\u8f66\u200b\u548c\u200b\u6bcf\u4e2a\u200b\u4eba\u200b\u7684\u200b\u8f6e\u5ed3\u200b\u6e05\u6670\u200b\u5730\u200b\u5206\u5f00\u200b\uff0c\u200b\u5f62\u6210\u200b\u591a\u4e2a\u200b\u72ec\u7acb\u200b\u7684\u200b\u533a\u57df\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u548c\u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bMask R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6765\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u7684\u200b\u50cf\u7d20\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u533a\u5206\u200b\uff0c\u200b\u4e3a\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u7684\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u652f\u6301\u200b\u3002
  • \u200b\u5546\u573a\u200b\u4e2d\u200b\u4eba\u7fa4\u200b\u7684\u200b\u8ba1\u6570\u200b
  • \u200b\u519c\u4e1a\u200b\u667a\u80fd\u5316\u200b\u4e2d\u200b\u519c\u4f5c\u7269\u200b\u6216\u200b\u679c\u5b9e\u200b\u6570\u91cf\u200b\u7684\u200b\u7edf\u8ba1\u200b
  • \u200b\u56fe\u50cf\u7f16\u8f91\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u7269\u4f53\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u5206\u5272\u200b
\u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3-doc\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u6587\u6863\u200b\u548c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u8bc6\u522b\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002\u200b\u5f00\u6e90\u200b\u7248\u200b\u652f\u6301\u200b\u672c\u5730\u200b\u4f53\u9a8c\u200b\u548c\u200b\u672c\u5730\u200b\u90e8\u7f72\u200b\uff0c\u200b\u652f\u6301\u200b\u5404\u4e2a\u200b\u6a21\u5757\u200b\u7684\u200b\u5fae\u8c03\u200b\u8bad\u7ec3\u200b\u3002
  • \u200b\u77e5\u8bc6\u200b\u56fe\u8c31\u200b\u7684\u200b\u6784\u5efa\u200b
  • \u200b\u5728\u7ebf\u200b\u65b0\u95fb\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u4e8b\u4ef6\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b66\u672f\u200b\u6587\u732e\u200b\u4e2d\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u548c\u200b\u5206\u6790\u200b\uff08\u200b\u7279\u522b\u200b\u662f\u200b\u9700\u8981\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u3001\u200b\u626d\u66f2\u200b\u56fe\u7247\u200b\u3001\u200b\u66f4\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u7684\u200b\u573a\u666f\u200b\uff09
\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u636e\u5f55\u5165\u200b\u3001\u200b\u4fe1\u606f\u68c0\u7d22\u200b\u548c\u200b\u6587\u6863\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002
  • \u200b\u94f6\u884c\u200b\u8d26\u5355\u200b\u7684\u200b\u5904\u7406\u200b
  • \u200b\u533b\u7597\u200b\u62a5\u544a\u200b\u4e2d\u200b\u5404\u9879\u200b\u6307\u6807\u200b\u7684\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b
  • \u200b\u5408\u540c\u200b\u4e2d\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u7684\u200b\u63d0\u53d6\u200b
\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u8bc6\u522b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u6a21\u5f0f\u200b\u6216\u200b\u884c\u4e3a\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7f51\u7edc\u5b89\u5168\u200b\u3001\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u548c\u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6b63\u5e38\u200b\u8d8b\u52bf\u200b\u548c\u200b\u89c4\u5f8b\u200b\uff0c\u200b\u6765\u200b\u53d1\u73b0\u200b\u4e0e\u200b\u9884\u671f\u200b\u884c\u4e3a\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u7a81\u7136\u200b\u589e\u52a0\u200b\u7684\u200b\u7f51\u7edc\u6d41\u91cf\u200b\u6216\u200b\u5f02\u5e38\u200b\u7684\u200b\u4ea4\u6613\u200b\u6d3b\u52a8\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff08\u200b\u5982\u200b\u5b64\u7acb\u200b\u68ee\u6797\u200b\u3001LSTM\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u63d0\u4f9b\u200b\u5b9e\u65f6\u200b\u8b66\u62a5\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u53ca\u65f6\u200b\u5e94\u5bf9\u200b\u6f5c\u5728\u200b\u98ce\u9669\u200b\u548c\u200b\u95ee\u9898\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u4fdd\u969c\u7cfb\u7edf\u200b\u7a33\u5b9a\u6027\u200b\u548c\u200b\u5b89\u5168\u6027\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002
  • \u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b
  • \u200b\u7f51\u7edc\u200b\u5165\u4fb5\u200b\u68c0\u6d4b\u200b
  • \u200b\u8bbe\u5907\u200b\u6545\u969c\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u751f\u4ea7\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u7535\u529b\u7cfb\u7edf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u5f52\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u884c\u4e3a\u200b\u8bc6\u522b\u200b\u3001\u200b\u8bed\u97f3\u200b\u8bc6\u522b\u200b\u548c\u200b\u91d1\u878d\u200b\u8d8b\u52bf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5f0f\u200b\u6216\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5c06\u200b\u4e00\u6bb5\u200b\u8bed\u97f3\u200b\u4fe1\u53f7\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u95ee\u5019\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u8bf7\u6c42\u200b\u201d\uff0c\u200b\u6216\u200b\u5c06\u200b\u80a1\u7968\u4ef7\u683c\u200b\u8d70\u52bf\u200b\u5212\u5206\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u6355\u6349\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\u548c\u200b\u53d8\u5316\u89c4\u5f8b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u6570\u636e\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u76d1\u63a7\u200b\u3001\u200b\u8bed\u97f3\u200b\u52a9\u624b\u200b\u548c\u200b\u5e02\u573a\u9884\u6d4b\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u8d77\u200b\u7740\u200b\u5173\u952e\u4f5c\u7528\u200b\u3002
  • \u200b\u5fc3\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u884c\u4e3a\u200b\u5206\u7c7b\u200b
  • \u200b\u8111\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u60c5\u7eea\u200b\u5206\u7c7b\u200b
  • \u200b\u4ea4\u901a\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
  • \u200b\u7f51\u7edc\u6d41\u91cf\u200b\u5206\u7c7b\u200b
  • \u200b\u8bbe\u5907\u200b\u5de5\u4f5c\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b \u200b\u6682\u65e0\u200b \u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u4e00\u5f20\u200b\u56fe\u50cf\u200b\u540c\u65f6\u200b\u5206\u914d\u200b\u5230\u200b\u591a\u4e2a\u200b\u76f8\u5173\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u56fe\u50cf\u200b\u6807\u6ce8\u200b\u3001\u200b\u5185\u5bb9\u200b\u63a8\u8350\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5b58\u5728\u200b\u7684\u200b\u591a\u4e2a\u200b\u7269\u4f53\u200b\u6216\u200b\u7279\u5f81\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4e00\u5f20\u200b\u56fe\u7247\u200b\u4e2d\u200b\u540c\u65f6\u200b\u5305\u542b\u200b\u201c\u200b\u72d7\u200b\u201d\u200b\u548c\u200b\u201c\u200b\u6237\u5916\u200b\u201d\u200b\u8fd9\u200b\u4e24\u4e2a\u200b\u6807\u7b7e\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u7528\u6237\u200b\u63d0\u4f9b\u200b\u66f4\u52a0\u200b\u5168\u9762\u200b\u7684\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u641c\u7d22\u5f15\u64ce\u200b\u548c\u200b\u81ea\u52a8\u200b\u5185\u5bb9\u200b\u751f\u6210\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u200b\u5177\u6709\u200b\u91cd\u8981\u200b\u610f\u4e49\u200b\u3002
  • \u200b\u533b\u5b66\u5f71\u50cf\u200b\u8bca\u65ad\u200b
  • \u200b\u590d\u6742\u200b\u573a\u666f\u200b\u8bc6\u522b\u200b
  • \u200b\u591a\u200b\u76ee\u6807\u200b\u76d1\u63a7\u200b
  • \u200b\u5546\u54c1\u200b\u5c5e\u6027\u200b\u8bc6\u522b\u200b
  • \u200b\u751f\u6001\u200b\u73af\u5883\u76d1\u6d4b\u200b
  • \u200b\u5b89\u5168\u76d1\u63a7\u200b
  • \u200b\u707e\u5bb3\u200b\u9884\u8b66\u200b
\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u4e13\u95e8\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u4f53\u79ef\u200b\u8f83\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u76d1\u63a7\u200b\u3001\u200b\u65e0\u4eba\u9a7e\u9a76\u200b\u548c\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u80fd\u591f\u200b\u4ece\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u4e2d\u200b\u51c6\u786e\u200b\u627e\u5230\u200b\u5e76\u200b\u5206\u7c7b\u200b\u50cf\u200b\u884c\u4eba\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u6216\u200b\u5c0f\u200b\u52a8\u7269\u200b\u7b49\u200b\u5c0f\u200b\u5c3a\u5bf8\u200b\u7269\u4f53\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\u548c\u200b\u4f18\u5316\u200b\u7684\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff0c\u200b\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u53ef\u4ee5\u200b\u6709\u6548\u200b\u63d0\u5347\u200b\u5bf9\u200b\u5c0f\u200b\u7269\u4f53\u200b\u7684\u200b\u8bc6\u522b\u200b\u80fd\u529b\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5728\u200b\u5b9e\u9645\u200b\u5e94\u7528\u200b\u4e2d\u200b\u4e0d\u200b\u9057\u6f0f\u200b\u91cd\u8981\u200b\u4fe1\u606f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u63d0\u9ad8\u200b\u5b89\u5168\u6027\u200b\u548c\u200b\u81ea\u52a8\u5316\u200b\u6c34\u5e73\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002
  • \u200b\u65e0\u4eba\u9a7e\u9a76\u200b\u6c7d\u8f66\u200b\u4e2d\u200b\u7684\u200b\u884c\u4eba\u200b\u68c0\u6d4b\u200b
  • \u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u5efa\u7b51\u7269\u200b\u8bc6\u522b\u200b
  • \u200b\u667a\u80fd\u200b\u4ea4\u901a\u7cfb\u7edf\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u5165\u4fb5\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b
  • \u200b\u5de5\u4e1a\u200b\u68c0\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u5fae\u5c0f\u200b\u7455\u75b5\u200b\u68c0\u6d4b\u200b
  • \u200b\u65e0\u4eba\u673a\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5c0f\u578b\u200b\u52a8\u7269\u200b\u76d1\u6d4b\u200b
\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5185\u5bb9\u200b\uff0c\u200b\u6765\u200b\u8bc6\u522b\u200b\u4e0e\u4f17\u4e0d\u540c\u200b\u6216\u200b\u4e0d\u200b\u7b26\u5408\u200b\u6b63\u5e38\u200b\u6a21\u5f0f\u200b\u7684\u200b\u56fe\u50cf\u5904\u7406\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u5de5\u4e1a\u200b\u8d28\u91cf\u200b\u68c0\u6d4b\u200b\u3001\u200b\u533b\u7597\u200b\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u5b89\u5168\u76d1\u63a7\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u6f5c\u5728\u200b\u7684\u200b\u7f3a\u9677\u200b\u3001\u200b\u5f02\u5e38\u200b\u6216\u200b\u5f02\u5e38\u200b\u884c\u4e3a\u200b\uff0c\u200b\u4ece\u800c\u200b\u5e2e\u52a9\u200b\u6211\u4eec\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u95ee\u9898\u200b\u5e76\u200b\u91c7\u53d6\u76f8\u5e94\u200b\u63aa\u65bd\u200b\u3002\u200b\u56fe\u50cf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u7cfb\u7edf\u200b\u88ab\u200b\u8bbe\u8ba1\u200b\u7528\u4e8e\u200b\u81ea\u52a8\u68c0\u6d4b\u200b\u548c\u200b\u6807\u8bb0\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u9ad8\u200b\u5de5\u4f5c\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002
  • \u200b\u5de5\u4e1a\u200b\u8d28\u91cf\u200b\u63a7\u5236\u200b
  • \u200b\u533b\u7597\u200b\u5f71\u50cf\u200b\u5206\u6790\u200b
  • \u200b\u76d1\u63a7\u200b\u89c6\u9891\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u4ea4\u901a\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u7684\u200b\u8fdd\u89c4\u884c\u4e3a\u200b\u8bc6\u522b\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u7684\u200b\u969c\u788d\u7269\u200b\u68c0\u6d4b\u200b
  • \u200b\u519c\u4e1a\u200b\u75c5\u866b\u5bb3\u200b\u76d1\u6d4b\u200b
  • \u200b\u73af\u5883\u76d1\u6d4b\u200b\u4e2d\u200b\u7684\u200b\u6c61\u67d3\u7269\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u7248\u9762\u200b\u89e3\u6790\u200b \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u6682\u65e0\u200b \u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u662f\u200b\u4e00\u79cd\u200b\u4ece\u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u7ed3\u6784\u5316\u200b\u4fe1\u606f\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u4e3b\u8981\u200b\u7528\u4e8e\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6587\u6863\u200b\u7248\u9762\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u673a\u5668\u200b\u53ef\u8bfb\u200b\u7684\u200b\u6570\u636e\u683c\u5f0f\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u6587\u6863\u200b\u7ba1\u7406\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u200b\u6570\u5b57\u5316\u200b\u7b49\u200b\u9886\u57df\u200b\u5177\u6709\u200b\u5e7f\u6cdb\u200b\u7684\u200b\u5e94\u7528\u200b\u3002\u200b\u7248\u9762\u200b\u89e3\u6790\u200b\u901a\u8fc7\u200b\u7ed3\u5408\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff08OCR\uff09\u3001\u200b\u56fe\u50cf\u5904\u7406\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u80fd\u591f\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u6587\u6863\u200b\u4e2d\u200b\u7684\u200b\u6587\u672c\u200b\u5757\u200b\u3001\u200b\u6807\u9898\u200b\u3001\u200b\u6bb5\u843d\u200b\u3001\u200b\u56fe\u7247\u200b\u3001\u200b\u8868\u683c\u200b\u4ee5\u53ca\u200b\u5176\u4ed6\u200b\u7248\u9762\u200b\u5143\u7d20\u200b\u3002\u200b\u6b64\u200b\u8fc7\u7a0b\u200b\u901a\u5e38\u200b\u5305\u62ec\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u5143\u7d20\u200b\u5206\u6790\u200b\u548c\u200b\u6570\u636e\u200b\u683c\u5f0f\u5316\u200b\u4e09\u4e2a\u200b\u4e3b\u8981\u200b\u6b65\u9aa4\u200b\uff0c\u200b\u6700\u7ec8\u200b\u751f\u6210\u200b\u7ed3\u6784\u5316\u200b\u7684\u200b\u6587\u6863\u200b\u6570\u636e\u200b\uff0c\u200b\u63d0\u5347\u200b\u6570\u636e\u5904\u7406\u200b\u7684\u200b\u6548\u7387\u200b\u548c\u200b\u51c6\u786e\u6027\u200b\u3002
  • \u200b\u91d1\u878d\u200b\u4e0e\u200b\u6cd5\u5f8b\u200b\u6587\u6863\u200b\u5206\u6790\u200b
  • \u200b\u5386\u53f2\u6587\u732e\u200b\u548c\u200b\u6863\u6848\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u81ea\u52a8\u5316\u200b\u8868\u5355\u200b\u586b\u5199\u200b
  • \u200b\u9875\u9762\u200b\u7ed3\u6784\u200b\u89e3\u6790\u200b
\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200bLaTeX\u200b\u516c\u5f0f\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u5b66\u200b\u3001\u200b\u7269\u7406\u200b\u3001\u200b\u8ba1\u7b97\u673a\u79d1\u5b66\u200b\u7b49\u200b\u9886\u57df\u200b\u7684\u200b\u6587\u6863\u200b\u7f16\u8f91\u200b\u548c\u200b\u6570\u636e\u5206\u6790\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u6570\u5b66\u516c\u5f0f\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200bLaTeX\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002
  • \u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u4e0e\u200b\u68c0\u7d22\u200b
  • \u200b\u516c\u5f0f\u200b\u641c\u7d22\u5f15\u64ce\u200b
  • \u200b\u516c\u5f0f\u200b\u7f16\u8f91\u5668\u200b
  • \u200b\u81ea\u52a8\u5316\u200b\u6392\u7248\u200b
\u200b\u516c\u5f0f\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6682\u65e0\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u63d0\u53d6\u200b\u548c\u200b\u8bc6\u522b\u200b\u5370\u7ae0\u200b\u5185\u5bb9\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u7684\u200b\u8bc6\u522b\u200b\u662f\u200b\u6587\u6863\u200b\u5904\u7406\u200b\u7684\u200b\u4e00\u90e8\u5206\u200b\uff0c\u200b\u5728\u200b\u5f88\u591a\u200b\u573a\u666f\u200b\u90fd\u200b\u6709\u200b\u7528\u9014\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5408\u540c\u200b\u6bd4\u200b\u5bf9\u200b\uff0c\u200b\u51fa\u5165\u5e93\u200b\u5ba1\u6838\u200b\u4ee5\u53ca\u200b\u53d1\u7968\u200b\u62a5\u9500\u200b\u5ba1\u6838\u200b\u7b49\u200b\u573a\u666f\u200b\u3002
  • \u200b\u5408\u540c\u200b\u548c\u200b\u534f\u8bae\u200b\u9a8c\u8bc1\u200b
  • \u200b\u652f\u7968\u200b\u5904\u7406\u200b
  • \u200b\u8d37\u6b3e\u200b\u5ba1\u6279\u200b
  • \u200b\u6cd5\u5f8b\u6587\u4e66\u200b\u7ba1\u7406\u200b
\u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b"},{"location":"support_list/pipelines_list.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002\u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5bf9\u200b\u7ed9\u5b9a\u200b\u7684\u200b\u56fe\u50cf\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b
  • \u200b\u827a\u672f\u54c1\u200b\u98ce\u683c\u200b\u5206\u7c7b\u200b
  • \u200b\u519c\u4f5c\u7269\u200b\u75c5\u866b\u5bb3\u200b\u8bc6\u522b\u200b
  • \u200b\u52a8\u7269\u200b\u79cd\u7c7b\u200b\u8bc6\u522b\u200b
  • \u200b\u536b\u661f\u200b\u9065\u611f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u571f\u5730\u200b\u3001\u200b\u6c34\u4f53\u200b\u3001\u200b\u5efa\u7b51\u200b\u7684\u200b\u5206\u7c7b\u200b
\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u8bad\u7ec3\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u8054\u5408\u200b\u8bad\u7ec3\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200b\u5c11\u91cf\u200b\u6709\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u548c\u200b\u5927\u91cf\u200b\u65e0\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u200b\u51cf\u5c11\u200b\u4eba\u5de5\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3001\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u7684\u200b\u6210\u672c\u200b\u3002\u200b\u4e0b\u56fe\u200b\u5c55\u793a\u200b\u4e86\u200b\u8be5\u200b\u4ea7\u7ebf\u200b\u5728\u200b\u516c\u5f00\u200b\u6570\u636e\u200b\u96c6\u200b COCO 10% \u200b\u6709\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u7684\u200b\u6307\u6807\u200b\u60c5\u51b5\u200b\u3002\u200b\u4f7f\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u8bad\u7ec3\u200b\u540e\u200b\uff0c\u200b\u5728\u200b COCO 10% \u200b\u6709\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b +90% \u200b\u65e0\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u4e0a\u200b\uff0c\u200b\u5927\u200b\u6a21\u578b\u200b\uff08RT-DETR-H\uff09\u200b\u76f8\u6bd4\u200b\u76f4\u63a5\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u7cbe\u5ea6\u9ad8\u200b 8.4 \u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\uff0847.7%->56.1%\uff09\uff0c\u200b\u5237\u65b0\u200b\u4e86\u200b\u8be5\u200b\u6570\u636e\u200b\u96c6\u200b\u7684\u200b SOTA\u3002\u200b\u5c0f\u200b\u6a21\u578b\u200b\uff08PicoDet-S\uff09\u200b\u76f8\u6bd4\u200b\u76f4\u63a5\u200b\u8bad\u7ec3\u200b\uff0c\u200b\u7cbe\u5ea6\u9ad8\u200b\u4e86\u200b 10 \u200b\u4e2a\u200b\u767e\u5206\u70b9\u200b\u4ee5\u4e0a\u200b\uff0818.3%->28.8%\uff09\u3002
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u884c\u4eba\u200b\u3001\u200b\u8f66\u8f86\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u519b\u4e8b\u200b\u4fa6\u5bdf\u200b\u4e2d\u200b\u654c\u65b9\u200b\u8bbe\u65bd\u200b\u3001\u200b\u88c5\u5907\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u6df1\u6d77\u200b\u63a2\u6d4b\u200b\u4e2d\u200b\u6d77\u5e95\u200b\u751f\u7269\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-OCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-OCR \u200b\u4ea7\u7ebf\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b OCR \u200b\u8bad\u7ec3\u200b\u4ea7\u7ebf\u200b\uff0c\u200b\u7531\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u4e32\u8054\u200b\u5b8c\u6210\u200b\u3002\u200b\u9884\u6d4b\u200b\u56fe\u7247\u200b\u9996\u5148\u200b\u7ecf\u8fc7\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u6a21\u578b\u200b\u83b7\u53d6\u200b\u5168\u90e8\u200b\u7684\u200b\u6587\u672c\u200b\u884c\u200b\u68c0\u6d4b\u200b\u6846\u200b\u5e76\u200b\u8fdb\u884c\u200b\u77eb\u6b63\u200b\uff0c\u200b\u4e4b\u540e\u200b\u7ecf\u6587\u200b\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u5f97\u5230\u200b OCR \u200b\u6587\u672c\u200b\u7ed3\u679c\u200b\u3002 \u200b\u5728\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u90e8\u5206\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5927\u5c0f\u200b\u6a21\u578b\u200b\u8054\u5408\u200b\u8bad\u7ec3\u200b\u7684\u200b\u65b9\u5f0f\u200b\uff0c\u200b\u4f7f\u7528\u200b\u5c11\u91cf\u200b\u6709\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u548c\u200b\u5927\u91cf\u200b\u65e0\u200b\u6807\u7b7e\u200b\u6570\u636e\u200b\u63d0\u5347\u200b\u6a21\u578b\u200b\u7684\u200b\u7cbe\u5ea6\u200b\uff0c\u200b\u5927\u5e45\u5ea6\u200b\u51cf\u5c11\u200b\u4eba\u5de5\u200b\u8fed\u4ee3\u200b\u6a21\u578b\u200b\u7684\u200b\u6210\u672c\u200b\u3001\u200b\u6807\u6ce8\u200b\u6570\u636e\u200b\u7684\u200b\u6210\u672c\u200b\u3002\u200b\u4e0b\u56fe\u200b\u5c55\u793a\u200b\u4e86\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u5e94\u7528\u200b\u4e2d\u200b\u7684\u200b 2 \u200b\u4e2a\u200b\u573a\u666f\u200b\u4f7f\u7528\u200b\u8be5\u4ea7\u7ebf\u200b\u540e\u200b\u7684\u200b\u6548\u679c\u200b\uff0c\u200b\u53ef\u4ee5\u200b\u770b\u5230\u200b\uff0c\u200b\u5728\u200b\u4e0d\u540c\u200b\u7684\u200b\u573a\u666f\u200b\u4e2d\u200b\uff0c\u200b\u5927\u200b\u6a21\u578b\u200b\u548c\u200b\u5c0f\u200b\u6a21\u578b\u200b\u5747\u200b\u6709\u200b\u5927\u5e45\u200b\u63d0\u5347\u200b\u3002
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7535\u5b50\u5316\u200b
  • \u200b\u8eab\u4efd\u8bc1\u200b\u3001\u200b\u62a4\u7167\u200b\u3001\u200b\u9a7e\u9a76\u6267\u7167\u200b\u4e0a\u200b\u4e2a\u4eba\u4fe1\u606f\u200b\u7684\u200b\u8bfb\u53d6\u200b\u548c\u200b\u9a8c\u8bc1\u200b
  • \u200b\u96f6\u552e\u200b\u4e2d\u200b\u4ea7\u54c1\u200b\u4fe1\u606f\u200b\u8bc6\u522b\u200b
\u200b\u5927\u200b\u6a21\u578b\u200b\u534a\u200b\u76d1\u7763\u200b\u5b66\u4e60\u200b-\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv2 \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv2-common\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u5c06\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002 PP-ChatOCRv2-common \u200b\u7684\u200b\u7cfb\u7edf\u200b\u6d41\u7a0b\u200b\uff1a\u200b\u9996\u5148\u200b\u8f93\u5165\u200b\u9884\u6d4b\u200b\u56fe\u7247\u200b\uff0c\u200b\u9001\u5165\u200b\u901a\u7528\u200b OCR \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7ecf\u8fc7\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b\u548c\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b\u6a21\u578b\u200b\u9884\u6d4b\u51fa\u200b\u6587\u5b57\u200b\uff0c\u200b\u4e0e\u200b\u7528\u6237\u200b Query \u200b\u4e4b\u95f4\u200b\u8fdb\u884c\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\uff0c\u200b\u5f97\u5230\u200b\u4e0e\u200b Query \u200b\u76f8\u5173\u200b\u7684\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\uff1b\u200b\u6700\u540e\u200b\u628a\u200b\u8fd9\u4e9b\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u4f20\u5165\u200b prompt \u200b\u751f\u6210\u5668\u200b\u91cd\u65b0\u7ec4\u5408\u200b\u6210\u200b prompt\uff0c\u200b\u8ba9\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u7ed9\u51fa\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002
  • \u200b\u8eab\u4efd\u8bc1\u200b\u3001\u200b\u94f6\u884c\u5361\u200b\u3001\u200b\u6237\u53e3\u672c\u200b\u3001\u200b\u706b\u8f66\u7968\u200b\u3001\u200b\u7eb8\u8d28\u200b\u53d1\u7968\u200b\u7b49\u200b\u591a\u79cd\u200b\u573a\u666f\u200b\u7684\u200b\u5173\u952e\u200b\u4fe1\u606f\u63d0\u53d6\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv2 \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u4ea7\u7ebf\u200b\uff08PP-ChatOCRv2-doc\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u7279\u6b8a\u200b\u6807\u70b9\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002 PP-ChatOCRv2-doc \u200b\u7684\u200b\u7cfb\u7edf\u200b\u6d41\u7a0b\u200b\u5982\u4e0b\u200b\u56fe\u200b\u6240\u793a\u200b\uff1a\u200b\u9996\u5148\u200b\u8f93\u5165\u200b\u9884\u6d4b\u200b\u56fe\u7247\u200b\uff0c\u200b\u9001\u5165\u200b\u901a\u7528\u200b OCR \u200b\u7cfb\u7edf\u200b\uff0c\u200b\u7ecf\u8fc7\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u540e\u200b\uff0c\u200b\u9884\u6d4b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u548c\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\uff1b\u200b\u968f\u540e\u200b\u5c06\u200b OCR \u200b\u7cfb\u7edf\u200b\u9884\u6d4b\u51fa\u200b\u7684\u200b\u6587\u5b57\u200b\u3001\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u4e0e\u200b\u7528\u6237\u200b Query \u200b\u4e4b\u95f4\u200b\u8fdb\u884c\u200b\u5411\u91cf\u200b\u68c0\u7d22\u200b\uff0c\u200b\u5f97\u5230\u200b\u4e0e\u200b Query \u200b\u76f8\u5173\u200b\u7684\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\uff1b\u200b\u6700\u540e\u200b\u628a\u200b\u8fd9\u4e9b\u200b\u6587\u672c\u200b\u4fe1\u606f\u200b\u4f20\u5165\u200b prompt \u200b\u751f\u6210\u5668\u200b\u91cd\u65b0\u7ec4\u5408\u200b\u6210\u200b prompt\uff0c\u200b\u8ba9\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u7ed9\u51fa\u200b\u9884\u6d4b\u200b\u7ed3\u679c\u200b\u3002
  • \u200b\u77e5\u8bc6\u200b\u56fe\u8c31\u200b\u7684\u200b\u6784\u5efa\u200b
  • \u200b\u5728\u7ebf\u200b\u65b0\u95fb\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u4e8b\u4ef6\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b66\u672f\u200b\u6587\u732e\u200b\u4e2d\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u548c\u200b\u5206\u6790\u200b
\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u6587\u6863\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3 \u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u573a\u666f\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200bv3\uff08PP-ChatOCRv3-doc\uff09\u200b\u662f\u200b\u98de\u6868\u200b\u7279\u8272\u200b\u7684\u200b\u6587\u6863\u200b\u548c\u200b\u56fe\u50cf\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u89e3\u51b3\u65b9\u6848\u200b\uff0c\u200b\u7ed3\u5408\u200b\u4e86\u200b LLM \u200b\u548c\u200b OCR \u200b\u6280\u672f\u200b\uff0c\u200b\u4e00\u7ad9\u5f0f\u200b\u89e3\u51b3\u200b\u7248\u9762\u200b\u5206\u6790\u200b\u3001\u200b\u751f\u50fb\u5b57\u200b\u3001\u200b\u591a\u9875\u200b pdf\u3001\u200b\u8868\u683c\u200b\u3001\u200b\u5370\u7ae0\u200b\u8bc6\u522b\u200b\u7b49\u200b\u5e38\u89c1\u200b\u7684\u200b\u590d\u6742\u200b\u6587\u6863\u200b\u4fe1\u606f\u200b\u62bd\u53d6\u200b\u96be\u70b9\u200b\u95ee\u9898\u200b\uff0c\u200b\u7ed3\u5408\u200b\u6587\u5fc3\u200b\u5927\u200b\u6a21\u578b\u200b\u5c06\u200b\u6d77\u91cf\u200b\u6570\u636e\u200b\u548c\u200b\u77e5\u8bc6\u200b\u76f8\u200b\u878d\u5408\u200b\uff0c\u200b\u51c6\u786e\u7387\u200b\u9ad8\u4e14\u200b\u5e94\u7528\u200b\u5e7f\u6cdb\u200b\u3002\u200b\u8be5\u200b\u7279\u8272\u200b\u4ea7\u7ebf\u200b\u5728\u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4e0a\u200b\u652f\u6301\u200b\u66f4\u5f3a\u200b\u7684\u200b\u4e8c\u6b21\u5f00\u53d1\u200b\u80fd\u529b\u200b\uff08\u200b\u5982\u200bOCR\u200b\u8bc6\u522b\u200b\u6570\u636e\u200b\u878d\u5408\u200b\u80fd\u529b\u200b\uff09\uff0c\u200b\u652f\u6301\u200b\u6027\u80fd\u200b\u66f4\u5f3a\u200b\u7684\u200b\u670d\u52a1\u5316\u200b\u90e8\u7f72\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u77e5\u8bc6\u200b\u56fe\u8c31\u200b\u7684\u200b\u6784\u5efa\u200b
  • \u200b\u5728\u7ebf\u200b\u65b0\u95fb\u200b\u548c\u200b\u793e\u4ea4\u200b\u5a92\u4f53\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u4e8b\u4ef6\u200b\u76f8\u5173\u200b\u4fe1\u606f\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5b66\u672f\u200b\u6587\u732e\u200b\u4e2d\u200b\u5173\u952e\u200b\u4fe1\u606f\u200b\u7684\u200b\u62bd\u53d6\u200b\u548c\u200b\u5206\u6790\u200b\uff08\u200b\u7279\u522b\u200b\u662f\u200b\u9700\u8981\u200b\u5bf9\u200b\u5370\u7ae0\u200b\u3001\u200b\u626d\u66f2\u200b\u56fe\u7247\u200b\u3001\u200b\u66f4\u200b\u590d\u6742\u200b\u8868\u683c\u200b\u8fdb\u884c\u200b\u8bc6\u522b\u200b\u7684\u200b\u573a\u666f\u200b\uff09
\u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u5370\u7ae0\u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u77eb\u6b63\u200b \u200b\u6587\u6863\u200b\u56fe\u50cf\u200b\u65b9\u5411\u200b\u5206\u7c7b\u200b \u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200bv2 \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u6a21\u5757\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200bv2 \u200b\u4ea7\u7ebf\u200b\u7684\u200b\u7279\u70b9\u200b\u662f\u200b\u9488\u5bf9\u200b\u4e0d\u540c\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u80fd\u591f\u200b\u81ea\u200b\u9002\u5e94\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u96c6\u6210\u200b\u6a21\u578b\u200b\uff0c\u200b\u63d0\u5347\u200b\u4efb\u52a1\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5728\u200b\u6bcf\u65e5\u200b\u7684\u200b\u751f\u6d3b\u200b\u3001\u200b\u5de5\u4f5c\u200b\u4e2d\u200b\u968f\u5904\u53ef\u89c1\u200b\uff0c\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u662f\u200b\u6307\u200b\u6839\u636e\u200b\u5386\u53f2\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u6a21\u5f0f\u200b\u548c\u200b\u8d8b\u52bf\u200b\uff0c\u200b\u5bf9\u200b\u672a\u6765\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u8fdb\u884c\u200b\u9884\u6d4b\u200b\u7684\u200b\u4efb\u52a1\u200b\u3002\u200b\u5b83\u200b\u5728\u200b\u8bb8\u591a\u200b\u9886\u57df\u200b\u4e2d\u200b\u90fd\u200b\u6709\u200b\u5e94\u7528\u200b\uff0c\u200b\u5305\u62ec\u200b\u91d1\u878d\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u3001\u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b\u3001\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u3001\u200b\u80a1\u7968\u4ef7\u683c\u200b\u9884\u6d4b\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u5e02\u573a\u9884\u6d4b\u200b
  • \u200b\u9500\u552e\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u5929\u6c14\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u7206\u53d1\u200b\u9884\u6d4b\u200b
  • \u200b\u7f51\u7edc\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u91d1\u878d\u98ce\u9669\u200b\u9884\u6d4b\u200b
\u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200bv2 \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u591a\u200b\u6a21\u578b\u200b\u878d\u5408\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4ea7\u7ebf\u200b\u7684\u200b\u7279\u70b9\u200b\u662f\u200b\u9488\u5bf9\u200b\u4e0d\u540c\u200b\u4efb\u52a1\u200b\u573a\u666f\u200b\uff0c\u200b\u80fd\u591f\u200b\u81ea\u200b\u9002\u5e94\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u96c6\u6210\u200b\u6a21\u578b\u200b\uff0c\u200b\u63d0\u5347\u200b\u4efb\u52a1\u200b\u7684\u200b\u7cbe\u5ea6\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u76ee\u524d\u200b\u65f6\u5e8f\u200b\u6570\u636e\u5206\u6790\u200b\u6210\u719f\u200b\u7684\u200b\u5e94\u7528\u200b\u4e4b\u4e00\u200b\uff0c\u200b\u5176\u200b\u65e8\u5728\u200b\u4ece\u200b\u6b63\u5e38\u200b\u7684\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u51fa\u200b\u5f02\u5e38\u200b\u7684\u200b\u4e8b\u4ef6\u200b\u6216\u200b\u884c\u4e3a\u200b\u6a21\u5f0f\u200b\uff0c\u200b\u5728\u200b\u4f17\u591a\u200b\u9886\u57df\u200b\u90fd\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff1a\u200b\u91cf\u5316\u200b\u4ea4\u6613\u200b\u4e2d\u200b\uff0c\u200b\u7528\u4e8e\u200b\u53d1\u73b0\u5f02\u5e38\u200b\u4ea4\u6613\u200b\u884c\u4e3a\u200b\uff0c\u200b\u89c4\u907f\u200b\u6f5c\u5728\u200b\u7684\u200b\u91d1\u878d\u98ce\u9669\u200b\uff1b\u200b\u5728\u200b\u7f51\u7edc\u5b89\u5168\u200b\u9886\u57df\u200b\uff0c\u200b\u7528\u4e8e\u200b\u5b9e\u65f6\u200b\u76d1\u6d4b\u200b\u7f51\u7edc\u6d41\u91cf\u200b\uff0c\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u5e76\u200b\u9884\u9632\u200b\u7f51\u7edc\u653b\u51fb\u200b\u884c\u4e3a\u200b\u7684\u200b\u53d1\u751f\u200b\uff1b\u200b\u5728\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u6c7d\u8f66\u200b\u9886\u57df\u200b\uff0c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u53ef\u4ee5\u200b\u6301\u7eed\u200b\u76d1\u6d4b\u200b\u8f66\u8f7d\u200b\u4f20\u611f\u5668\u200b\u6570\u636e\u200b\uff0c\u200b\u53ca\u65f6\u53d1\u73b0\u200b\u53ef\u80fd\u200b\u5bfc\u81f4\u200b\u4e8b\u6545\u200b\u7684\u200b\u5f02\u5e38\u60c5\u51b5\u200b\uff1b\u200b\u800c\u200b\u5728\u200b\u5927\u578b\u200b\u5de5\u4e1a\u200b\u8bbe\u5907\u200b\u7ef4\u62a4\u200b\u4e2d\u200b\uff0c\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u4e5f\u200b\u80fd\u591f\u200b\u5e2e\u52a9\u200b\u5de5\u7a0b\u5e08\u200b\u63d0\u524d\u200b\u53d1\u73b0\u200b\u8bbe\u5907\u200b\u6545\u969c\u200b\u82d7\u5934\u200b\uff0c\u200b\u4ece\u800c\u200b\u91c7\u53d6\u200b\u9884\u9632\u6027\u200b\u7ef4\u62a4\u200b\u63aa\u65bd\u200b\uff0c\u200b\u964d\u4f4e\u200b\u8bbe\u5907\u200b\u505c\u673a\u200b\u65f6\u95f4\u200b\u548c\u200b\u7ef4\u4fee\u200b\u6210\u672c\u200b\u3002
  • \u200b\u7f51\u7edc\u200b\u5165\u4fb5\u200b\u68c0\u6d4b\u200b
  • \u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u751f\u4ea7\u200b\u4e2d\u200b\u6545\u969c\u200b\u8bbe\u5907\u200b\u68c0\u6d4b\u200b
  • \u200b\u533b\u7597\u200b\u5065\u5eb7\u200b\u4e2d\u200b\u60a3\u8005\u200b\u5f02\u5e38\u200b\u72b6\u6001\u200b\u76d1\u6d4b\u200b
"},{"location":"support_list/pipelines_list_dcu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(DCU)","text":""},{"location":"support_list/pipelines_list_dcu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
"},{"location":"support_list/pipelines_list_dcu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"support_list/pipelines_list_mlu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(MLU)","text":""},{"location":"support_list/pipelines_list_mlu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
"},{"location":"support_list/pipelines_list_mlu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"support_list/pipelines_list_npu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(NPU)","text":""},{"location":"support_list/pipelines_list_npu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u4efb\u52a1\u200b\uff0c\u200b\u5b83\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u522b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u533a\u5206\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u4e2d\u200b\u4e0d\u540c\u200b\u5b9e\u4f8b\u200b\u7684\u200b\u50cf\u7d20\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u7684\u200b\u7cbe\u786e\u200b\u5206\u5272\u200b\u3002\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5728\u200b\u540c\u4e00\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u5206\u522b\u200b\u6807\u8bb0\u200b\u51fa\u200b\u6bcf\u200b\u4e00\u8f86\u8f66\u200b\u3001\u200b\u6bcf\u200b\u4e00\u4e2a\u200b\u4eba\u200b\u6216\u200b\u6bcf\u200b\u4e00\u53ea\u200b\u52a8\u7269\u200b\uff0c\u200b\u786e\u4fdd\u200b\u5b83\u4eec\u200b\u5728\u200b\u50cf\u7d20\u200b\u7ea7\u522b\u200b\u4e0a\u200b\u88ab\u200b\u72ec\u7acb\u200b\u5904\u7406\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u5305\u542b\u200b\u591a\u8f86\u200b\u8f66\u200b\u548c\u200b\u884c\u4eba\u200b\u7684\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u5b9e\u4f8b\u200b\u5206\u5272\u200b\u80fd\u591f\u200b\u5c06\u200b\u6bcf\u8f86\u8f66\u200b\u548c\u200b\u6bcf\u4e2a\u200b\u4eba\u200b\u7684\u200b\u8f6e\u5ed3\u200b\u6e05\u6670\u200b\u5730\u200b\u5206\u5f00\u200b\uff0c\u200b\u5f62\u6210\u200b\u591a\u4e2a\u200b\u72ec\u7acb\u200b\u7684\u200b\u533a\u57df\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u548c\u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bMask R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\u6765\u200b\u5b9e\u73b0\u200b\u9ad8\u6548\u200b\u7684\u200b\u50cf\u7d20\u200b\u5206\u7c7b\u200b\u548c\u200b\u5b9e\u4f8b\u200b\u533a\u5206\u200b\uff0c\u200b\u4e3a\u200b\u590d\u6742\u200b\u573a\u666f\u200b\u7684\u200b\u7406\u89e3\u200b\u63d0\u4f9b\u200b\u4e86\u200b\u5f3a\u5927\u200b\u7684\u200b\u652f\u6301\u200b\u3002
  • \u200b\u5546\u573a\u200b\u4e2d\u200b\u4eba\u7fa4\u200b\u7684\u200b\u8ba1\u6570\u200b
  • \u200b\u519c\u4e1a\u200b\u667a\u80fd\u5316\u200b\u4e2d\u200b\u519c\u4f5c\u7269\u200b\u6216\u200b\u679c\u5b9e\u200b\u6570\u91cf\u200b\u7684\u200b\u7edf\u8ba1\u200b
  • \u200b\u56fe\u50cf\u7f16\u8f91\u200b\u4e2d\u200b\u7279\u5b9a\u200b\u7269\u4f53\u200b\u7684\u200b\u9009\u62e9\u200b\u548c\u200b\u5206\u5272\u200b
\u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u901a\u7528\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b \u200b\u7248\u9762\u200b\u533a\u57df\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u662f\u200b\u4e00\u79cd\u200b\u81ea\u52a8\u200b\u4ece\u200b\u6587\u6863\u200b\u6216\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b\u8868\u683c\u200b\u5185\u5bb9\u200b\u53ca\u5176\u200b\u7ed3\u6784\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6570\u636e\u5f55\u5165\u200b\u3001\u200b\u4fe1\u606f\u68c0\u7d22\u200b\u548c\u200b\u6587\u6863\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u548c\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff0c\u200b\u8868\u683c\u200b\u8bc6\u522b\u200b\u80fd\u591f\u200b\u5c06\u200b\u590d\u6742\u200b\u7684\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u7684\u200b\u683c\u5f0f\u200b\uff0c\u200b\u65b9\u4fbf\u200b\u7528\u6237\u200b\u8fdb\u4e00\u6b65\u200b\u5904\u7406\u200b\u548c\u200b\u5206\u6790\u200b\u6570\u636e\u200b\u3002
  • \u200b\u94f6\u884c\u200b\u8d26\u5355\u200b\u7684\u200b\u5904\u7406\u200b
  • \u200b\u533b\u7597\u200b\u62a5\u544a\u200b\u4e2d\u200b\u5404\u9879\u200b\u6307\u6807\u200b\u7684\u200b\u8bc6\u522b\u200b\u548c\u200b\u63d0\u53d6\u200b
  • \u200b\u5408\u540c\u200b\u4e2d\u200b\u8868\u683c\u200b\u4fe1\u606f\u200b\u7684\u200b\u63d0\u53d6\u200b
\u200b\u8868\u683c\u200b\u7ed3\u6784\u200b\u8bc6\u522b\u200b \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u8bc6\u522b\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u4e2d\u200b\u5f02\u5e38\u200b\u6a21\u5f0f\u200b\u6216\u200b\u884c\u4e3a\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7f51\u7edc\u5b89\u5168\u200b\u3001\u200b\u8bbe\u5907\u200b\u76d1\u63a7\u200b\u548c\u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u5386\u53f2\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u6b63\u5e38\u200b\u8d8b\u52bf\u200b\u548c\u200b\u89c4\u5f8b\u200b\uff0c\u200b\u6765\u200b\u53d1\u73b0\u200b\u4e0e\u200b\u9884\u671f\u200b\u884c\u4e3a\u200b\u663e\u8457\u200b\u4e0d\u540c\u200b\u7684\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u7a81\u7136\u200b\u589e\u52a0\u200b\u7684\u200b\u7f51\u7edc\u6d41\u91cf\u200b\u6216\u200b\u5f02\u5e38\u200b\u7684\u200b\u4ea4\u6613\u200b\u6d3b\u52a8\u200b\u3002\u200b\u65f6\u5e8f\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u7b97\u6cd5\u200b\uff08\u200b\u5982\u200b\u5b64\u7acb\u200b\u68ee\u6797\u200b\u3001LSTM\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u81ea\u52a8\u8bc6\u522b\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u5f02\u5e38\u200b\u70b9\u200b\uff0c\u200b\u4e3a\u200b\u4f01\u4e1a\u200b\u548c\u200b\u7ec4\u7ec7\u200b\u63d0\u4f9b\u200b\u5b9e\u65f6\u200b\u8b66\u62a5\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u53ca\u65f6\u200b\u5e94\u5bf9\u200b\u6f5c\u5728\u200b\u98ce\u9669\u200b\u548c\u200b\u95ee\u9898\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u4fdd\u969c\u7cfb\u7edf\u200b\u7a33\u5b9a\u6027\u200b\u548c\u200b\u5b89\u5168\u6027\u200b\u65b9\u9762\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\u3002
  • \u200b\u91d1\u878d\u200b\u6b3a\u8bc8\u200b\u68c0\u6d4b\u200b
  • \u200b\u7f51\u7edc\u200b\u5165\u4fb5\u200b\u68c0\u6d4b\u200b
  • \u200b\u8bbe\u5907\u200b\u6545\u969c\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u751f\u4ea7\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
  • \u200b\u7535\u529b\u7cfb\u7edf\u200b\u5f02\u5e38\u200b\u68c0\u6d4b\u200b
\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u5f52\u7c7b\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u884c\u4e3a\u200b\u8bc6\u522b\u200b\u3001\u200b\u8bed\u97f3\u200b\u8bc6\u522b\u200b\u548c\u200b\u91d1\u878d\u200b\u8d8b\u52bf\u200b\u5206\u6790\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u968f\u200b\u65f6\u95f4\u200b\u53d8\u5316\u200b\u7684\u200b\u7279\u5f81\u200b\uff0c\u200b\u8bc6\u522b\u200b\u51fa\u200b\u4e0d\u540c\u200b\u7684\u200b\u6a21\u5f0f\u200b\u6216\u200b\u4e8b\u4ef6\u200b\uff0c\u200b\u4f8b\u5982\u200b\u5c06\u200b\u4e00\u6bb5\u200b\u8bed\u97f3\u200b\u4fe1\u53f7\u200b\u5206\u7c7b\u200b\u4e3a\u200b\u201c\u200b\u95ee\u5019\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u8bf7\u6c42\u200b\u201d\uff0c\u200b\u6216\u200b\u5c06\u200b\u80a1\u7968\u4ef7\u683c\u200b\u8d70\u52bf\u200b\u5212\u5206\u200b\u4e3a\u200b\u201c\u200b\u4e0a\u6da8\u200b\u201d\u200b\u6216\u200b\u201c\u200b\u4e0b\u8dcc\u200b\u201d\u3002\u200b\u65f6\u5e8f\u200b\u5206\u7c7b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u673a\u5668\u200b\u5b66\u4e60\u200b\u548c\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u80fd\u591f\u200b\u6709\u6548\u200b\u6355\u6349\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\u548c\u200b\u53d8\u5316\u89c4\u5f8b\u200b\uff0c\u200b\u4ee5\u4fbf\u200b\u4e3a\u200b\u6570\u636e\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u5206\u7c7b\u200b\u6807\u7b7e\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5728\u200b\u667a\u80fd\u200b\u76d1\u63a7\u200b\u3001\u200b\u8bed\u97f3\u200b\u52a9\u624b\u200b\u548c\u200b\u5e02\u573a\u9884\u6d4b\u200b\u7b49\u200b\u5e94\u7528\u200b\u4e2d\u8d77\u200b\u7740\u200b\u5173\u952e\u4f5c\u7528\u200b\u3002
  • \u200b\u5fc3\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u80a1\u7968\u5e02\u573a\u200b\u884c\u4e3a\u200b\u5206\u7c7b\u200b
  • \u200b\u8111\u7535\u56fe\u200b\u5206\u7c7b\u200b
  • \u200b\u60c5\u7eea\u200b\u5206\u7c7b\u200b
  • \u200b\u4ea4\u901a\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
  • \u200b\u7f51\u7edc\u6d41\u91cf\u200b\u5206\u7c7b\u200b
  • \u200b\u8bbe\u5907\u200b\u5de5\u4f5c\u200b\u72b6\u6001\u200b\u5206\u7c7b\u200b
"},{"location":"support_list/pipelines_list_npu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"support_list/pipelines_list_xpu.html","title":"PaddleX\u200b\u4ea7\u7ebf\u200b\u5217\u8868\u200b(XPU)","text":""},{"location":"support_list/pipelines_list_xpu.html#1","title":"1\u3001\u200b\u57fa\u7840\u200b\u4ea7\u7ebf","text":"\u4ea7\u7ebf\u200b\u540d\u79f0\u200b \u200b\u4ea7\u7ebf\u200b\u6a21\u5757\u200b \u200b\u661f\u6cb3\u200b\u793e\u533a\u200b\u4f53\u9a8c\u200b\u5730\u5740\u200b \u200b\u4ea7\u7ebf\u200b\u4ecb\u7ecd\u200b \u200b\u9002\u7528\u200b\u573a\u666f\u200b \u200b\u901a\u7528\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u5206\u914d\u200b\u5230\u200b\u9884\u5b9a\u200b\u4e49\u200b\u7c7b\u522b\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u7269\u4f53\u200b\u8bc6\u522b\u200b\u3001\u200b\u573a\u666f\u200b\u7406\u89e3\u200b\u548c\u200b\u81ea\u52a8\u200b\u6807\u6ce8\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5404\u79cd\u200b\u7269\u4f53\u200b\uff0c\u200b\u5982\u200b\u52a8\u7269\u200b\u3001\u200b\u690d\u7269\u200b\u3001\u200b\u4ea4\u901a\u6807\u5fd7\u200b\u7b49\u200b\uff0c\u200b\u5e76\u200b\u6839\u636e\u200b\u5176\u200b\u7279\u5f81\u200b\u5c06\u200b\u5176\u200b\u5f52\u7c7b\u200b\u3002\u200b\u901a\u8fc7\u200b\u4f7f\u7528\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff0c\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u80fd\u591f\u200b\u81ea\u52a8\u200b\u63d0\u53d6\u200b\u56fe\u50cf\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u51c6\u786e\u200b\u5206\u7c7b\u200b\u3002
  • \u200b\u5546\u54c1\u200b\u56fe\u7247\u200b\u7684\u200b\u81ea\u52a8\u200b\u5206\u7c7b\u200b\u548c\u200b\u8bc6\u522b\u200b
  • \u200b\u6d41\u6c34\u7ebf\u200b\u4e0a\u200b\u4e0d\u200b\u5408\u683c\u200b\u4ea7\u54c1\u200b\u7684\u200b\u5b9e\u65f6\u200b\u76d1\u63a7\u200b
  • \u200b\u5b89\u9632\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u4eba\u5458\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u901a\u7528\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u65e8\u5728\u200b\u8bc6\u522b\u200b\u56fe\u50cf\u200b\u6216\u200b\u89c6\u9891\u200b\u4e2d\u200b\u591a\u4e2a\u200b\u5bf9\u8c61\u200b\u7684\u200b\u7c7b\u522b\u200b\u53ca\u5176\u200b\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u8fc7\u200b\u751f\u6210\u200b\u8fb9\u754c\u200b\u6846\u6765\u200b\u6807\u8bb0\u200b\u8fd9\u4e9b\u200b\u5bf9\u8c61\u200b\u3002\u200b\u4e0e\u200b\u7b80\u5355\u200b\u7684\u200b\u56fe\u50cf\u200b\u5206\u7c7b\u200b\u4e0d\u540c\u200b\uff0c\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u4e0d\u4ec5\u200b\u9700\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u6709\u200b\u54ea\u4e9b\u200b\u7269\u4f53\u200b\uff0c\u200b\u4f8b\u5982\u200b\u4eba\u200b\u3001\u200b\u8f66\u200b\u548c\u200b\u52a8\u7269\u200b\u7b49\u200b\uff0c\u200b\u8fd8\u200b\u9700\u8981\u200b\u51c6\u786e\u200b\u5730\u200b\u786e\u5b9a\u200b\u6bcf\u4e2a\u200b\u7269\u4f53\u200b\u5728\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u5177\u4f53\u4f4d\u7f6e\u200b\uff0c\u200b\u901a\u5e38\u200b\u4ee5\u200b\u77e9\u5f62\u6846\u200b\u7684\u200b\u5f62\u5f0f\u200b\u8868\u793a\u200b\u3002\u200b\u8be5\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u76d1\u63a7\u200b\u7cfb\u7edf\u200b\u548c\u200b\u667a\u80fd\u200b\u76f8\u518c\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bYOLO\u3001Faster R-CNN\u200b\u7b49\u200b\uff09\uff0c\u200b\u8fd9\u4e9b\u200b\u6a21\u578b\u200b\u80fd\u591f\u200b\u9ad8\u6548\u200b\u5730\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u8fdb\u884c\u200b\u5b9e\u65f6\u200b\u68c0\u6d4b\u200b\uff0c\u200b\u663e\u8457\u200b\u63d0\u5347\u200b\u4e86\u200b\u8ba1\u7b97\u673a\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7406\u89e3\u200b\u7684\u200b\u80fd\u529b\u200b\u3002
  • \u200b\u89c6\u9891\u200b\u76d1\u63a7\u200b\u4e2d\u200b\u79fb\u52a8\u200b\u7269\u4f53\u200b\u7684\u200b\u8ddf\u8e2a\u200b
  • \u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u4e2d\u200b\u8f66\u8f86\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u5de5\u4e1a\u200b\u5236\u9020\u200b\u4e2d\u200b\u7f3a\u9677\u200b\u4ea7\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
  • \u200b\u96f6\u552e\u4e1a\u200b\u4e2d\u200b\u8d27\u67b6\u200b\u5546\u54c1\u200b\u7684\u200b\u68c0\u6d4b\u200b
\u200b\u901a\u7528\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u662f\u200b\u4e00\u79cd\u200b\u8ba1\u7b97\u673a\u200b\u89c6\u89c9\u200b\u6280\u672f\u200b\uff0c\u200b\u65e8\u5728\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u5206\u914d\u200b\u5230\u200b\u7279\u5b9a\u200b\u7684\u200b\u7c7b\u522b\u200b\uff0c\u200b\u4ece\u800c\u200b\u5b9e\u73b0\u200b\u5bf9\u200b\u56fe\u50cf\u200b\u5185\u5bb9\u200b\u7684\u200b\u7cbe\u7ec6\u5316\u200b\u7406\u89e3\u200b\u3002\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u4e0d\u4ec5\u200b\u8981\u200b\u8bc6\u522b\u200b\u51fa\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u7269\u4f53\u200b\u7c7b\u578b\u200b\uff0c\u200b\u8fd8\u8981\u200b\u5bf9\u200b\u6bcf\u4e2a\u200b\u50cf\u7d20\u200b\u8fdb\u884c\u200b\u5206\u7c7b\u200b\uff0c\u200b\u8fd9\u6837\u200b\u4f7f\u5f97\u200b\u540c\u4e00\u200b\u7c7b\u522b\u200b\u7684\u200b\u533a\u57df\u200b\u80fd\u591f\u200b\u88ab\u200b\u5b8c\u6574\u200b\u6807\u8bb0\u200b\u3002\u200b\u4f8b\u5982\u200b\uff0c\u200b\u5728\u200b\u4e00\u5e45\u200b\u8857\u666f\u200b\u56fe\u50cf\u200b\u4e2d\u200b\uff0c\u200b\u8bed\u4e49\u200b\u5206\u5272\u200b\u53ef\u4ee5\u200b\u5c06\u200b\u884c\u4eba\u200b\u3001\u200b\u6c7d\u8f66\u200b\u3001\u200b\u5929\u7a7a\u200b\u548c\u200b\u9053\u8def\u200b\u7b49\u200b\u4e0d\u540c\u200b\u7c7b\u522b\u200b\u7684\u200b\u90e8\u5206\u200b\u9010\u200b\u50cf\u7d20\u200b\u533a\u5206\u200b\u5f00\u6765\u200b\uff0c\u200b\u5f62\u6210\u200b\u4e00\u4e2a\u200b\u8be6\u7ec6\u200b\u7684\u200b\u6807\u7b7e\u200b\u56fe\u200b\u3002\u200b\u8fd9\u9879\u200b\u6280\u672f\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u81ea\u52a8\u200b\u9a7e\u9a76\u200b\u3001\u200b\u533b\u5b66\u5f71\u50cf\u200b\u5206\u6790\u200b\u548c\u200b\u4eba\u673a\u4ea4\u4e92\u200b\u7b49\u200b\u9886\u57df\u200b\uff0c\u200b\u901a\u5e38\u200b\u4f9d\u8d56\u4e8e\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bFCN\u3001U-Net\u200b\u7b49\u200b\uff09\uff0c\u200b\u901a\u8fc7\u200b\u5377\u79ef\u200b\u795e\u7ecf\u7f51\u7edc\u200b\uff08CNN\uff09\u200b\u6765\u200b\u63d0\u53d6\u200b\u7279\u5f81\u200b\u5e76\u200b\u5b9e\u73b0\u200b\u9ad8\u7cbe\u5ea6\u200b\u7684\u200b\u50cf\u7d20\u200b\u7ea7\u200b\u5206\u7c7b\u200b\uff0c\u200b\u4ece\u800c\u200b\u4e3a\u200b\u8fdb\u4e00\u6b65\u200b\u7684\u200b\u667a\u80fd\u200b\u5206\u6790\u200b\u63d0\u4f9b\u200b\u57fa\u7840\u200b\u3002
  • \u200b\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\u200b\u4e2d\u200b\u536b\u661f\u200b\u56fe\u50cf\u200b\u7684\u200b\u5206\u6790\u200b
  • \u200b\u673a\u5668\u4eba\u200b\u89c6\u89c9\u200b\u4e2d\u200b\u969c\u788d\u7269\u200b
  • \u200b\u901a\u884c\u200b\u533a\u57df\u200b\u7684\u200b\u7269\u4f53\u200b\u7684\u200b\u5206\u5272\u200b
  • \u200b\u7535\u5f71\u200b\u5236\u4f5c\u200b\u4e2d\u200b\u524d\u666f\u200b\u548c\u200b\u80cc\u666f\u200b\u7684\u200b\u5206\u79bb\u200b
\u200b\u901a\u7528\u200bOCR \u200b\u6587\u672c\u200b\u68c0\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b OCR\uff08\u200b\u5149\u5b66\u200b\u5b57\u7b26\u8bc6\u522b\u200b\uff0cOptical Character Recognition\uff09\u200b\u662f\u200b\u4e00\u79cd\u200b\u5c06\u200b\u56fe\u50cf\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u8f6c\u6362\u200b\u4e3a\u200b\u53ef\u200b\u7f16\u8f91\u200b\u6587\u672c\u200b\u7684\u200b\u6280\u672f\u200b\u3002\u200b\u5b83\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u6587\u6863\u200b\u6570\u5b57\u5316\u200b\u3001\u200b\u4fe1\u606f\u63d0\u53d6\u200b\u548c\u200b\u6570\u636e\u5904\u7406\u200b\u7b49\u200b\u9886\u57df\u200b\u3002OCR \u200b\u53ef\u4ee5\u200b\u8bc6\u522b\u200b\u5370\u5237\u200b\u6587\u672c\u200b\u3001\u200b\u624b\u5199\u200b\u6587\u672c\u200b\uff0c\u200b\u751a\u81f3\u200b\u67d0\u4e9b\u200b\u7c7b\u578b\u200b\u7684\u200b\u5b57\u4f53\u200b\u548c\u200b\u7b26\u53f7\u200b\u3002 \u200b\u901a\u7528\u200b OCR \u200b\u4ea7\u7ebf\u200b\u7528\u4e8e\u200b\u89e3\u51b3\u200b\u6587\u5b57\u200b\u8bc6\u522b\u200b\u4efb\u52a1\u200b\uff0c\u200b\u63d0\u53d6\u200b\u56fe\u7247\u200b\u4e2d\u200b\u7684\u200b\u6587\u5b57\u200b\u4fe1\u606f\u200b\u4ee5\u200b\u6587\u672c\u200b\u5f62\u5f0f\u200b\u8f93\u51fa\u200b\uff0cPP-OCRv4 \u200b\u662f\u200b\u4e00\u4e2a\u200b\u7aef\u5230\u200b\u7aef\u200b OCR \u200b\u4e32\u8054\u200b\u7cfb\u7edf\u200b\uff0c\u200b\u53ef\u200b\u5b9e\u73b0\u200b CPU \u200b\u4e0a\u200b\u6beb\u79d2\u200b\u7ea7\u200b\u7684\u200b\u6587\u672c\u200b\u5185\u5bb9\u200b\u7cbe\u51c6\u200b\u9884\u6d4b\u200b\uff0c\u200b\u5728\u200b\u901a\u7528\u200b\u573a\u666f\u200b\u4e0a\u200b\u8fbe\u5230\u200b\u5f00\u6e90\u200bSOTA\u3002\u200b\u57fa\u4e8e\u200b\u8be5\u200b\u9879\u76ee\u200b\uff0c\u200b\u4ea7\u5b66\u7814\u200b\u754c\u200b\u591a\u65b9\u200b\u5f00\u53d1\u8005\u200b\u5df2\u200b\u5feb\u901f\u200b\u843d\u5730\u200b\u591a\u4e2a\u200b OCR \u200b\u5e94\u7528\u200b\uff0c\u200b\u4f7f\u7528\u200b\u573a\u666f\u200b\u8986\u76d6\u200b\u901a\u7528\u200b\u3001\u200b\u5236\u9020\u200b\u3001\u200b\u91d1\u878d\u200b\u3001\u200b\u4ea4\u901a\u200b\u7b49\u200b\u5404\u4e2a\u9886\u57df\u200b\u3002
  • \u200b\u667a\u80fd\u200b\u5b89\u9632\u200b\u4e2d\u200b\u8f66\u724c\u53f7\u200b
  • \u200b\u95e8\u724c\u53f7\u200b\u7b49\u200b\u4fe1\u606f\u200b\u7684\u200b\u8bc6\u522b\u200b
  • \u200b\u7eb8\u8d28\u200b\u6587\u6863\u200b\u7684\u200b\u6570\u5b57\u5316\u200b
  • \u200b\u6587\u5316\u9057\u4ea7\u200b\u4e2d\u200b\u53e4\u4ee3\u200b\u6587\u5b57\u200b\u7684\u200b\u8bc6\u522b\u200b
\u200b\u6587\u672c\u200b\u8bc6\u522b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b \u200b\u5728\u7ebf\u200b\u4f53\u9a8c\u200b \u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u662f\u200b\u4e00\u79cd\u200b\u5229\u7528\u200b\u5386\u53f2\u6570\u636e\u200b\u6765\u200b\u9884\u6d4b\u200b\u672a\u6765\u200b\u8d8b\u52bf\u200b\u7684\u200b\u6280\u672f\u200b\uff0c\u200b\u901a\u8fc7\u200b\u5206\u6790\u200b\u65f6\u95f4\u200b\u5e8f\u5217\u200b\u6570\u636e\u200b\u7684\u200b\u53d8\u5316\u200b\u6a21\u5f0f\u200b\u3002\u200b\u5e7f\u6cdb\u5e94\u7528\u200b\u4e8e\u200b\u91d1\u878d\u5e02\u573a\u200b\u3001\u200b\u5929\u6c14\u9884\u62a5\u200b\u548c\u200b\u9500\u552e\u200b\u9884\u6d4b\u200b\u7b49\u200b\u9886\u57df\u200b\u3002\u200b\u5b83\u200b\u3002\u200b\u65f6\u5e8f\u200b\u9884\u6d4b\u200b\u901a\u5e38\u200b\u4f7f\u7528\u200b\u7edf\u8ba1\u200b\u65b9\u6cd5\u200b\u6216\u200b\u6df1\u5ea6\u200b\u5b66\u4e60\u200b\u6a21\u578b\u200b\uff08\u200b\u5982\u200bLSTM\u3001ARIMA\u200b\u7b49\u200b\uff09\uff0c\u200b\u80fd\u591f\u200b\u5904\u7406\u200b\u6570\u636e\u200b\u4e2d\u200b\u7684\u200b\u65f6\u95f4\u200b\u4f9d\u8d56\u6027\u200b\uff0c\u200b\u4ee5\u200b\u63d0\u4f9b\u200b\u51c6\u786e\u200b\u7684\u200b\u9884\u5224\u200b\uff0c\u200b\u5e2e\u52a9\u200b\u51b3\u7b56\u8005\u200b\u505a\u51fa\u200b\u66f4\u597d\u200b\u7684\u200b\u89c4\u5212\u200b\u548c\u200b\u54cd\u5e94\u200b\u3002\u200b\u6b64\u200b\u6280\u672f\u200b\u5728\u200b\u8bb8\u591a\u200b\u884c\u4e1a\u200b\u4e2d\u200b\u53d1\u6325\u200b\u7740\u200b\u91cd\u8981\u200b\u4f5c\u7528\u200b\uff0c\u200b\u5982\u200b\u80fd\u6e90\u7ba1\u7406\u200b\u3001\u200b\u4f9b\u5e94\u94fe\u200b\u4f18\u5316\u200b\u548c\u200b\u5e02\u573a\u200b\u5206\u6790\u200b\u7b49\u200b\u3002
  • \u200b\u80a1\u7968\u200b\u9884\u6d4b\u200b
  • \u200b\u6c14\u5019\u200b\u9884\u6d4b\u200b
  • \u200b\u75be\u75c5\u200b\u4f20\u64ad\u200b\u9884\u6d4b\u200b
  • \u200b\u80fd\u6e90\u200b\u9700\u6c42\u9884\u6d4b\u200b
  • \u200b\u4ea4\u901a\u6d41\u91cf\u200b\u9884\u6d4b\u200b
  • \u200b\u4ea7\u54c1\u200b\u751f\u547d\u5468\u671f\u200b\u9884\u6d4b\u200b
  • \u200b\u7535\u529b\u200b\u8d1f\u8377\u200b\u9884\u6d4b\u200b
"},{"location":"support_list/pipelines_list_xpu.html#2","title":"2\u3001\u200b\u7279\u8272\u200b\u4ea7\u7ebf","text":"

\u200b\u6682\u200b\u4e0d\u200b\u652f\u6301\u200b\uff0c\u200b\u656c\u8bf7\u671f\u5f85\u200b\uff01

"},{"location":"blog/index.html","title":"Blog","text":""},{"location":"en/index.html#introduction","title":"\ud83d\udd0d Introduction","text":"

PaddleX 3.0 is a low-code development tool for AI models built on the PaddlePaddle framework. It integrates numerousready-to-use pre-trained models, enablingfull-process developmentfrom model training to inference, supportinga variety of mainstream hardware both domestic and international, and aiding AI developers in industrial practice.

Image Classification Multi-label Image Classification Object Detection Instance Segmentation Semantic Segmentation Image Anomaly Detection OCR Table Recognition PP-ChatOCRv3-doc Time Series Forecasting Time Series Anomaly Detection Time Series Classification"},{"location":"en/index.html#why-paddlex","title":"\ud83c\udf1f Why PaddleX ?","text":"

\ud83c\udfa8 Rich Models One-click Call: Integrate over 200 PaddlePaddle models covering multiple key areas such as OCR, object detection, and time series forecasting into 19 pipelines. Experience the model effects quickly through easy Python API calls. Also supports more than 20 modules for easy model combination use by developers.

\ud83d\ude80 High Efficiency and Low barrier of entry: Achieve model full-process development based on graphical interfaces and unified commands, creating 8 featured model pipelines that combine large and small models, semi-supervised learning of large models, and multi-model fusion, greatly reducing the cost of iterating models.

\ud83c\udf10 Flexible Deployment in Various Scenarios: Support various deployment methods such as high-performance inference, service deployment, and lite deployment to ensure efficient operation and rapid response of models in different application scenarios.

\ud83d\udd27 Efficient Support for Mainstream Hardware: Support seamless switching of various mainstream hardware such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU to ensure efficient operation.

"},{"location":"en/index.html#recent-updates","title":"\ud83d\udce3 Recent Updates","text":"

\ud83d\udd25\ud83d\udd25 \"PaddleX Document Information Personalized Extraction Upgrade\", PP-ChatOCRv3 innovatively provides custom development functions for OCR models based on data fusion technology, offering stronger model fine-tuning capabilities. Millions of high-quality general OCR text recognition data are automatically integrated into vertical model training data at a specific ratio, solving the problem of weakened general text recognition capabilities caused by vertical model training in the industry. Suitable for practical scenarios in industries such as automated office, financial risk control, healthcare, education and publishing, and legal and government sectors. October 24th (Thursday) 19:00 Join our live session for an in-depth analysis of the open-source version of PP-ChatOCRv3 and the outstanding advantages of PaddleX 3.0 Beta1 in terms of accuracy and speed. Registration Link

\u2757 more courses

\ud83d\udd25\ud83d\udd25 9.30, 2024, PaddleX 3.0 Beta1 open source version is officially released, providing more than 200 models that can be called with a simple Python API; achieve model full-process development based on unified commands, and open source the basic capabilities of the PP-ChatOCRv3 pipeline; support more than 100 models for high-performance inference and service-oriented deployment (iterating continuously), more than 7 key visual models for edge-deployment; more than 70 models have been adapted for the full development process of Ascend 910B, more than 15 models have been adapted for the full development process of Kunlun chips and Cambricon

\ud83d\udd25 6.27, 2024, PaddleX 3.0 Beta open source version is officially released, supporting the use of various mainstream hardware for pipeline and model development in a low-code manner on the local side.

\ud83d\udd25 3.25, 2024, PaddleX 3.0 cloud release, supporting the creation of pipelines in the AI Studio Galaxy Community in a zero-code manner.

more

"},{"location":"en/index.html#explanation-of-pipeline","title":"\ud83d\udd20 Explanation of Pipeline","text":"

PaddleX is dedicated to achieving pipeline-level model training, inference, and deployment. A pipeline refers to a series of predefined development processes for specific AI tasks, which includes a combination of single models (single-function modules) capable of independently completing a certain type of task.

"},{"location":"en/index.html#what-can-paddlex-do","title":"\ud83d\udcca What can PaddleX do\uff1f","text":"

All pipelines of PaddleX support online experience on AI Studio and local fast inference. You can quickly experience the effects of each pre-trained pipeline. If you are satisfied with the effects of the pre-trained pipeline, you can directly perform high-performance inference / serving deployment / edge deployment on the pipeline. If not satisfied, you can also Custom Development to improve the pipeline effect. For the complete pipeline development process, please refer to the PaddleX pipeline Development Tool Local Use Tutorial.

In addition, PaddleX provides developers with a full-process efficient model training and deployment tool based on a cloud-based GUI. Developers do not need code development, just need to prepare a dataset that meets the pipeline requirements to quickly start model training. For details, please refer to the tutorial \"Developing Industrial-level AI Models with Zero Barrier\".

Pipeline Online Experience Local Inference High-Performance Inference Service-Oriented Deployment Edge Deployment Custom Development Zero-Code Development On AI Studio OCR Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 PP-ChatOCRv3 Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Table Recognition Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Object Detection Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Instance Segmentation Link \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \u2705 Image Classification Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Semantic Segmentation Link \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 Time Series Forecasting Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Anomaly Detection Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Time Series Classification Link \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \u2705 Small Object Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Multi-label Image Classification \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Anomaly Detection \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Layout Parsing \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Formula Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Seal Recognition \ud83d\udea7 \u2705 \u2705 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Pedestrian Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Vehicle Attribute Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Face Recognition \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 \u2705 \ud83d\udea7

\u2757Note: The above capabilities are implemented based on GPU/CPU. PaddleX can also perform local inference and custom development on mainstream hardware such as Kunlunxin, Ascend, Cambricon, and Haiguang. The table below details the support status of the pipelines. For specific supported model lists, please refer to the Model List (Kunlunxin XPU)/Model List (Ascend NPU)/Model List (Cambricon MLU)/Model List (Haiguang DCU). We are continuously adapting more models and promoting the implementation of high-performance and service-oriented deployment on mainstream hardware.

\ud83d\udd25\ud83d\udd25 Support for Domestic Hardware Capabilities

Pipeline Ascend 910B Kunlunxin R200/R300 Cambricon MLU370X8 Haiguang Z100 OCR \u2705 \u2705 \u2705 \ud83d\udea7 Table Recognition \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Object Detection \u2705 \u2705 \u2705 \ud83d\udea7 Instance Segmentation \u2705 \ud83d\udea7 \u2705 \ud83d\udea7 Image Classification \u2705 \u2705 \u2705 \u2705 Semantic Segmentation \u2705 \u2705 \u2705 \u2705 Time Series Forecasting \u2705 \u2705 \u2705 \ud83d\udea7 Time Series Anomaly Detection \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7 Time Series Classification \u2705 \ud83d\udea7 \ud83d\udea7 \ud83d\udea7"},{"location":"en/index.html#discussion","title":"\ud83d\udcac Discussion","text":"

We warmly welcome and encourage community members to raise questions, share ideas, and feedback in the Discussions section. Whether you want to report a bug, discuss a feature request, seek help, or just want to keep up with the latest project news, this is a great platform.

"},{"location":"en/index.html#license","title":"\ud83d\udcc4 License","text":"

The release of this project is licensed under the Apache 2.0 license.

"},{"location":"en/CHANGLOG.html","title":"Version Update Information","text":""},{"location":"en/CHANGLOG.html#latest-version-information","title":"Latest Version Information","text":""},{"location":"en/CHANGLOG.html#paddlex-v300beta1-9302024","title":"PaddleX v3.0.0beta1 (9.30/2024)","text":"

PaddleX 3.0 Beta1 offers over 200 models accessible through a streamlined Python API for one-click deployment; realizes full-process model development based on unified commands, and opens source the foundational capabilities of the PP-ChatOCRv3 special model pipeline; supports high-performance inference and service-oriented deployment for over 100 models, as well as edge deployment for 7 key vision models; and fully adapts the development process of over 70 models to Huawei Ascend 910B, and over 15 models to XPU and MLU.

  • Rich Models with One-click Deployment: Integrates over 200 PaddlePaddle models across key domains such as document image intelligent analysis, OCR, object detection, and time series prediction into 13 model pipelines, enabling rapid model experience through a streamlined Python API. Additionally, supports over 20 individual functional modules for convenient model combination.
  • Enhanced Efficiency and Lowered Thresholds: Implements full-process model development based on a graphical interface and unified commands, creating 8 special model pipelines that combine large and small models, leverage large model semi-supervised learning, and multi-model fusion, significantly reducing iteration costs.
  • Flexible Deployment Across Scenarios: Supports various deployment methods including high-performance, service-oriented, and edge deployment, ensuring efficient model operation and rapid response across different application scenarios.
  • Efficient Support for Mainstream Hardware: Seamlessly switches between NVIDIA GPUs, XPU, Ascend, and MLU, ensuring efficient operation.
"},{"location":"en/CHANGLOG.html#paddlex-v300beta-6272024","title":"PaddleX v3.0.0beta (6.27/2024)","text":"

PaddleX 3.0beta integrates the advantages of the PaddlePaddle ecosystem, covering 7 major scenario tasks, constructs 16 model pipelines, and provides a low-code development mode to assist developers in realizing full-process model development on various mainstream hardware.

  • Basic Model Pipelines (Rich Models, Comprehensive Scenarios): Selects 68 high-quality PaddlePaddle models, covering tasks such as image classification, object detection, image segmentation, OCR, text image layout analysis, and time series prediction.
  • Special Model Pipelines (Significant Efficiency Improvement): Provides efficient solutions combining large and small models, large model semi-supervised learning, and multi-model fusion.
  • Low-code Development Mode (Convenient Development and Deployment): Offers both zero-code and low-code development methods.
  • Zero-code Development: Users can interactively submit background training tasks through a graphical user interface (GUI), bridging online and offline deployment, and supporting API-based online service invocation.
  • Low-code Development: Achieves full-process development across 16 model pipelines through unified API interfaces, while supporting user-defined model process serialization.
  • Multi-hardware Local Support (Strong Compatibility): Supports NVIDIA GPUs, XPU, Ascend, and MLU, enabling pure offline usage.
"},{"location":"en/CHANGLOG.html#paddlex-v210-12102021","title":"PaddleX v2.1.0 (12.10/2021)","text":"

Added the ultra-lightweight classification model PPLCNet, achieving approximately 5ms prediction speed for a single image on Intel CPUs, with a Top-1 Accuracy of 80.82% on the ImageNet-1K dataset, surpassing ResNet152's performance. Experience it now! Added the lightweight detection model PP-PicoDet, the first to surpass 30+ mAP(0.5:0.95) within 1M parameters (at 416px input), achieving up to 150FPS prediction on ARM CPUs. Experience it now! Upgraded PaddleX Restful API to support PaddlePaddle's dynamic graph development mode. Experience it now! Added negative sample training strategies for detection models. Experience it now! Added lightweight Python-based service deployment. Experience it now!

"},{"location":"en/CHANGLOG.html#paddlex-v200-9102021","title":"PaddleX v2.0.0 (9.10/2021)","text":"
  • PaddleX API
  • Added visualization of prediction results for detection and instance segmentation tasks, as well as analysis of prediction errors to assist in model effect analysis
  • Introduced negative sample optimization for detection tasks to suppress false detections in background regions
  • Improved prediction results for semantic segmentation tasks, supporting the return of predicted categories and normalized prediction confidence
  • Enhanced prediction results for image classification tasks, supporting the return of normalized prediction confidence
  • Prediction Deployment
  • Completed PaddleX Python prediction deployment, enabling rapid deployment with just 2 APIs
  • Comprehensively upgraded PaddleX C++ deployment, supporting end-to-end unified deployment capabilities for PaddlePaddle vision suites including PaddleDetection, PaddleClas, PaddleSeg, and PaddleX
  • Newly released Manufacture SDK, providing a pre-compiled PaddlePaddle deployment development kit (SDK) for industrial-grade multi-end and multi-platform deployment acceleration, enabling rapid inference deployment through configuring business logic flow files in a low-code manner
  • PaddleX GUI
  • Upgraded PaddleX GUI to support 30-series graphics cards
  • Added PP-YOLO V2 model for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Newly added the ability to export API training scripts for seamless switching to PaddleX API training
  • Industrial Practice Cases
  • Added tutorial cases for steel bar counting and defect detection, focusing on object detection tasks
  • Added tutorial cases for robotic arm grasping, focusing on instance segmentation tasks
  • Added tutorial cases for training and deployment of industrial meter readings, which combines object detection, semantic segmentation, and traditional vision algorithms
  • Added a deployment case tutorial using C# language under Windows system
"},{"location":"en/CHANGLOG.html#paddlex-v200rc0-5192021","title":"PaddleX v2.0.0rc0 (5.19/2021)","text":"
  • Fully supports PaddlePaddle 2.0 dynamic graphs for an easier development mode
  • Added PP-YOLOv2 for object detection tasks, achieving 49.5% accuracy on the COCO test dataset and 68.9 FPS prediction speed on V100
  • Introduced a 4.2MB ultra-lightweight model, PP-YOLO tiny, for object detection tasks
  • Added real-time segmentation model BiSeNetV2 for semantic segmentation tasks
  • Comprehensive upgrade of C++ deployment module
    • PaddleInference deployment adapted to 2.0 prediction library (Usage Documentation)
    • Supports deployment of models from PaddleDetection, PaddleSeg, PaddleClas, and PaddleX
    • Added multi-GPU prediction based on PaddleInference (Usage Documentation)
    • GPU deployment added TensorRT high-performance acceleration engine deployment method based on ONNX
    • GPU deployment added Triton service-oriented deployment method based on ONNX (Docker Usage Documentation)
"},{"location":"en/CHANGLOG.html#paddlex-v130-12192020","title":"PaddleX v1.3.0 (12.19/2020)","text":"
  • Model Updates

    • Image Classification model ResNet50_vd adds a pre-trained model with 100,000 categories.
    • Object Detection model FasterRCNN adds model pruning support.
    • Object Detection models now support multi-channel image training.
  • Model Deployment Updates

    • Fixed bugs in OpenVINO deployment C++ code.
    • Raspberry Pi deployment adds Arm V8 support.
  • Industry Case Updates

    • Added an industrial quality inspection case, providing GPU and CPU deployment scenarios for industrial quality inspection, along with optimization strategies related to quality inspection.
  • New RESTful API Module A new RESTful API module is added, enabling developers to quickly develop training platforms based on PaddleX.

    • Added an HTML Demo based on RESTful API.
    • Added a Remote version of the visualization client based on RESTful API. Added deployment solutions for models through OpenVINO.
"},{"location":"en/CHANGLOG.html#paddlex-v120-992020","title":"PaddleX v1.2.0 (9.9/2020)","text":"
  • Model Updates

    • Added the object detection model PPYOLO.
    • FasterRCNN, MaskRCNN, YOLOv3, DeepLabv3p, and other models now have pre-trained models on the COCO dataset.
    • Object Detection models FasterRCNN and MaskRCNN add the backbone HRNet_W18.
    • Semantic Segmentation model DeepLabv3p adds the backbone MobileNetV3_large_ssld.
  • Model Deployment Updates

    • Added deployment solutions for models through OpenVINO.
    • Added deployment solutions for models on Raspberry Pi.
    • Optimized data preprocessing and postprocessing code performance for PaddleLite Android deployment.
    • Optimized Paddle Server-side C++ deployment code, added parameters such as use_mkl, significantly improving model prediction performance on CPUs through mkldnn.
  • Industry Case Updates

    • Added an RGB image remote sensing segmentation case.
    • Added a multi-channel remote sensing segmentation case.
  • Others

    • Added a dataset splitting function, supporting command-line splitting of ImageNet, PascalVOC, MSCOCO, and semantic segmentation datasets.

### PaddleX v1.1.0 (7.13/2020) - Model Updates

  • Added new semantic segmentation models: HRNet, FastSCNN
  • Added HRNet backbone for object detection (FasterRCNN) and instance segmentation (MaskRCNN)
  • Pre-trained models on COCO dataset for object detection and instance segmentation
  • Integrated X2Paddle, enabling all PaddleX classification and semantic segmentation models to export to ONNX protocol
  • Model Deployment Updates
  • Added support for model encryption on Windows platform
  • New deployment and prediction solutions for Jetson and PaddleLite
  • C++ deployment code now supports batch prediction and utilizes OpenMP for parallel acceleration of preprocessing
  • Added 2 PaddleX Industrial Cases
  • Portrait segmentation case
  • Industrial meter reading case
  • New data format conversion feature, converting data annotated by LabelMe, Jingling Annotation Assistant, and EasyData platform to formats supported by PaddleX
  • Updated PaddleX documentation, optimizing the document structure
"},{"location":"en/CHANGLOG.html#paddlex-v100-5212020","title":"PaddleX v1.0.0 (5.21/2020)","text":"
  • End-to-End Pipeline
  • Data Preparation: Supports the EasyData Intelligent Data Service Platform data protocol, facilitating intelligent annotation and low-quality data cleaning through the platform. It is also compatible with mainstream annotation tool protocols, helping developers complete data preparation faster.
  • Model Training: Integrates PaddleClas, PaddleDetection, PaddleSeg vision development kits, providing a rich selection of high-quality pre-trained models for faster achievement of industrial-grade model performance.
  • Model Tuning: Built-in model interpretability modules and VisualDL visualization analysis components, providing abundant information for better understanding and optimizing models.
  • Secure Multi-platform Deployment: Integrated with PaddleSlim model compression tools and model encryption deployment modules, facilitating high-performance and secure multi-platform deployment in conjunction with Paddle Inference or Paddle Lite.

  • Integrated Industrial Practices

  • Selects mature model architectures from PaddlePaddle's industrial practices, opening up case study tutorials to accelerate developers' industrial implementation.

  • Easy-to-Use and Easy-to-Integrate

  • Unified and user-friendly end-to-end APIs, enabling model training in 5 steps and high-performance Python/C++ deployment with just 10 lines of code.
  • Provides PaddleX-GUI, a cross-platform visualization tool centered on PaddleX, for a quick experience of the full PaddlePaddle deep learning pipeline.
"},{"location":"en/FAQ.html#q-what-is-paddlex","title":"Q: What is PaddleX?","text":"

A: PaddleX is a low-code development tool featuring selected models and pipelines launched by the PaddlePaddle team. It aims to provide developers with a more convenient and efficient development environment. This tool supports model training and inference on multiple mainstream domestic and international hardware, and is compatible with various system configurations, thereby meeting users' needs in different application scenarios. PaddleX has a wide range of applications, covering industries such as industry, energy, finance, transportation, and education, providing professional support and solutions for these industries. By using PaddleX, developers can more easily apply deep learning technology to actual industrial practices, thereby realizing technology implementation and transformation, and promoting digital transformation and intelligent upgrading across industries.

"},{"location":"en/FAQ.html#q-what-is-a-pipeline-what-is-a-module-what-is-the-relationship-between-them","title":"Q: What is a Pipeline? What is a Module? What is the relationship between them?","text":"

A: In PaddleX, a module is defined as the smallest unit that implements basic functions, meaning each module undertakes a specific task, such as text detection. Within this framework, a pipeline is the actual functionality achieved by one or more modules working together, often forming more complex application scenarios, such as Optical Character Recognition (OCR) technology. Therefore, the relationship between modules and pipelines can be understood as the relationship between basics and applications. Modules, as the smallest units, provide the foundation for construction, while pipelines demonstrate the practical application effects of these foundational modules after reasonable combination and configuration. This design approach allows users to flexibly select and combine different modules to achieve the functions they need, significantly enhancing development flexibility and efficiency. The official pipelines also support users with high-performance inference, service-oriented deployment, and other deployment capabilities.

"},{"location":"en/FAQ.html#q-how-to-choose-between-the-wheel-package-installation-mode-and-the-plugin-installation-mode","title":"Q: How to choose between the Wheel package installation mode and the plugin installation mode?","text":"

A: If your application scenario in using PaddleX mainly focuses on model inference and integration, we highly recommend choosing a more convenient and lightweight installation method, namely the Wheel package installation mode. This installation mode aims to provide users with a quick and simple installation experience, especially suitable for scenarios requiring rapid deployment and integration of models. Installing with Wheel packages can significantly reduce the complexity of the installation process, avoid unnecessary configuration issues, and allow developers to focus more time and effort on the practical application and optimization of models. Whether you are a novice or an experienced developer, this lightweight installation method will greatly facilitate your workflow. Therefore, when performing model inference and integration, choosing the Wheel package installation mode will undoubtedly make your entire development process more efficient and smooth.

"},{"location":"en/FAQ.html#q-what-is-the-difference-between-paddlex-and-baidu-aistudio-communitys-zero-code-pipeline","title":"Q: What is the difference between PaddleX and Baidu AIStudio Community's Zero-Code Pipeline?","text":"

A: Baidu AIStudio Community's Zero-Code Pipeline is the cloud-based carrier of PaddleX, with its underlying code consistent with PaddleX, and can be considered as a cloud-based PaddleX. The design philosophy of Baidu AIStudio Community's Zero-Code Pipeline is to enable users to quickly build and deploy model applications without needing to delve deeply into programming and algorithm knowledge. On this basis, Baidu AIStudio Community's Zero-Code Pipeline also provides many special pipelines, such as training high-precision models with a small number of samples and solving complex time-series problems using multi-model fusion schemes. PaddleX, on the other hand, is a local development tool that provides users with powerful functions supporting more in-depth secondary development. This means developers can flexibly adjust and expand based on PaddleX to create solutions that better fit specific application scenarios. Additionally, PaddleX offers a rich set of model interfaces, supporting users in freely combining models for use.

"},{"location":"en/FAQ.html#q-when-i-encounter-problems-while-using-paddlex-how-should-i-provide-feedback","title":"Q: When I encounter problems while using PaddleX, how should I provide feedback?","text":"

A: Welcome to the Discussion Area to communicate with a vast number of developers! If you find errors or deficiencies in PaddleX, you are also welcome to submit an issue, and our on-duty team members will respond to your questions as soon as possible.

"},{"location":"en/quick_start.html","title":"Quick Start","text":""},{"location":"en/quick_start.html#installation","title":"\ud83d\udee0\ufe0f Installation","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

  • Installing PaddlePaddle
# cpu\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 11.8 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# gpu\uff0c\u200b\u8be5\u200b\u547d\u4ee4\u200b\u4ec5\u200b\u9002\u7528\u200b\u4e8e\u200b CUDA \u200b\u7248\u672c\u200b\u4e3a\u200b 12.3 \u200b\u7684\u200b\u673a\u5668\u200b\u73af\u5883\u200b\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n

\u2757For more PaddlePaddle versions, please refer to the PaddlePaddle official website.

  • Installing PaddleX
pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n

\u2757For more installation methods, refer to the PaddleX Installation Guide.

"},{"location":"en/quick_start.html#cli-usage","title":"\ud83d\udcbb CLI Usage","text":"

One command can quickly experience the pipeline effect, the unified CLI format is:

paddlex --pipeline [Pipeline Name] --input [Input Image] --device [Running Device]\n

You only need to specify three parameters: * pipeline: The name of the pipeline * input: The local path or URL of the input image to be processed * device: The GPU number used (for example, gpu:0 means using the 0th GPU), you can also choose to use the CPU (cpu)

For example, using the OCR pipeline:

paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png  --device gpu:0\n

{\n'input_path': '/root/.paddlex/predict_input/general_ocr_002.png',\n'dt_polys': [array([[161,  27],\n       [353,  22],\n       [354,  69],\n       [162,  74]], dtype=int16), array([[426,  26],\n       [657,  21],\n       [657,  58],\n       [426,  62]], dtype=int16), array([[702,  18],\n       [822,  13],\n       [824,  57],\n       [704,  62]], dtype=int16), array([[341, 106],\n       [405, 106],\n       [405, 128],\n       [341, 128]], dtype=int16)\n       ...],\n'dt_scores': [0.758478200014338, 0.7021546472698513, 0.8536622648391111, 0.8619181462164781, 0.8321051217096188, 0.8868756173427551, 0.7982964727675609, 0.8289939036796322, 0.8289428877522524, 0.8587063317632897, 0.7786755892491615, 0.8502032769081344, 0.8703346500042997, 0.834490931790065, 0.908291103353393, 0.7614978661708064, 0.8325774055997542, 0.7843421347676149, 0.8680889482955594, 0.8788859304537682, 0.8963341277518075, 0.9364654810069546, 0.8092413027028257, 0.8503743089091863, 0.7920740420391101, 0.7592224394793805, 0.7920547400069311, 0.6641757962457888, 0.8650289477605955, 0.8079483304467047, 0.8532207681055275, 0.8913377034754717],\n'rec_text': ['\u200b\u767b\u673a\u724c\u200b', 'BOARDING', 'PASS', '\u200b\u8231\u4f4d\u200b', 'CLASS', '\u200b\u5e8f\u53f7\u200b SERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200b', '\u200b\u65e5\u671f\u200b DATE', 'SEAT NO', '\u200b\u822a\u73ed\u200b FLIGHW', '035', 'MU2379', '\u200b\u59cb\u53d1\u5730\u200b', 'FROM', '\u200b\u767b\u673a\u53e3\u200b', 'GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', \u200b\u7968\u53f7\u200bTKTNO', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE10MINUTESBEFOREDEPARTURETIME'],\n'rec_score': [0.9985831379890442, 0.999696917533874512, 0.9985735416412354, 0.9842517971992493, 0.9383274912834167, 0.9943678975105286, 0.9419361352920532, 0.9221674799919128, 0.9555020928382874, 0.9870321154594421, 0.9664073586463928, 0.9988052248954773, 0.9979352355003357, 0.9985110759735107, 0.9943482875823975, 0.9991195797920227, 0.9936401844024658, 0.9974591135978699, 0.9743705987930298, 0.9980487823486328, 0.9874696135520935, 0.9900962710380554, 0.9952947497367859, 0.9950481653213501, 0.989926815032959, 0.9915552139282227, 0.9938777685165405, 0.997239887714386, 0.9963340759277344, 0.9936134815216064, 0.97223961353302]}\n

The visualization result is as follows:

To use the command line for other pipelines, simply adjust the pipeline parameter to the name of the corresponding pipeline. Below are the commands for each pipeline:

Pipeline Name Command Image Classification paddlex --pipeline image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Object Detection paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 Instance Segmentation paddlex --pipeline instance_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png --device gpu:0 Semantic Segmentation paddlex --pipeline semantic_segmentation --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png --device gpu:0 Image Multi-label Classification paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0 Small Object Detection paddlex --pipeline small_object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/small_object_detection.jpg --device gpu:0 Image Anomaly Detection paddlex --pipeline anomaly_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/uad_grid.png --device gpu:0 OCR paddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 Table Recognition paddlex --pipeline table_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/table_recognition.jpg --device gpu:0 Layout Parsing paddlex --pipeline layout_parsing --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/demo_paper.png --device gpu:0 Formula Recognition paddlex --pipeline formula_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/demo_image/general_formula_recognition.png --device gpu:0 Seal Recognition paddlex --pipeline seal_recognition --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/seal_text_det.png --device gpu:0 Time Series Forecasting paddlex --pipeline ts_fc --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv --device gpu:0 Time Series Anomaly Detection paddlex --pipeline ts_ad --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv --device gpu:0 Time Series Classification paddlex --pipeline ts_cls --input https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv --device gpu:0"},{"location":"en/quick_start.html#python-script-usage","title":"\ud83d\udcdd Python Script Usage","text":"

With just a few lines of code, you can quickly perform inference on a production line. The unified Python script format is as follows:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=[PipelineName])\noutput = pipeline.predict([InputImageName])\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n
The following steps are executed:

  • create_pipeline() instantiates the production line object.
  • An image is passed in and the predict method of the production line object is called for inference and prediction.
  • The prediction results are processed.

For other production lines using the Python script, you only need to adjust the pipeline parameter of the create_pipeline() method to the corresponding production line name. Below is a list of each production line's corresponding parameter name and detailed usage explanation:

Production Line Name Corresponding Parameter Detailed Explanation Document Scene Information Extraction v3 PP-ChatOCRv3-doc Document Scene Information Extraction v3 Python Script Instructions General Image Classification image_classification General Image Classification Python Script Instructions General Object Detection object_detection General Object Detection Python Script Instructions General Instance Segmentation instance_segmentation General Instance Segmentation Python Script Instructions General Semantic Segmentation semantic_segmentation General Semantic Segmentation Python Script Instructions Image Multi-label Classification multi_label_image_classification Image Multi-label Classification Python Script Instructions Small Object Detection small_object_detection Small Object Detection Python Script Instructions Image Anomaly Detection anomaly_detection Image Anomaly Detection Python Script Instructions General OCR OCR General OCR Python Script Instructions General Table Recognition table_recognition General Table Recognition Python Script Instructions General Layout Parsing layout_parsing General Layout Parsing Python Script Instructions Formula Recognition formula_recognition Formula Recognition Python Script Instructions Seal Text Recognition seal_recognition Seal Text Recognition Python Script Instructions Time Series Forecasting ts_fc Time Series Forecasting Python Script Instructions Time Series Anomaly Detection ts_ad Time Series Anomaly Detection Python Script Instructions Time Series Classification ts_cls Time Series Classification Python Script Instructions"},{"location":"en/data_annotations/cv_modules/image_classification.html","title":"PaddleX Image Classification Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for image classification related single models. Click on the above link to refer to the homepage documentation for installing the data annotation tool and viewing detailed usage procedures.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical interface. It can be used for tasks such as image classification, object detection, and image segmentation. In instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_classification.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_classification.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt for the dataset to be annotated in the pets folder, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat and dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_classification.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_classification.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py script to convert the annotated dataset to the ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the path to the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_classification.html#2-data-format","title":"2. Data Format","text":"
  • The dataset defined by PaddleX for image classification tasks is named ClsDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot```bash\nclassname1\nclassname2\nclassname3\n...\n
Modified label.txt:

```bash 0 classname1 1 classname2 2 classname3 ...

"},{"location":"en/data_annotations/cv_modules/image_feature.html","title":"PaddleX Image Feature Task Module Data Annotation Tutorial","text":"

This section will introduce how to use the Labelme annotation tool to complete data annotation for image feature-related single models. Click the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#1-labelme-annotation","title":"1. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#11-introduction-to-labelme-annotation-tool","title":"1.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. In image feature annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#12-labelme-installation","title":"1.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#13-labelme-annotation-process","title":"1.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/image_feature.html#131-prepare-data-for-annotation","title":"1.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., pets.
  • Create an images directory (must be named images) within pets and store the images to be annotated in the images directory, as shown below:
  • Create a category label file flags.txt in the pets folder for the dataset to be annotated, and write the categories of the dataset to be annotated into flags.txt line by line. Taking the flags.txt for a cat-dog classification dataset as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/image_feature.html#132-start-labelme","title":"1.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/pets\nlabelme images --nodata --autosave --output annotations --flags flags.txt\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in JSON files. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/image_feature.html#133-start-image-annotation","title":"1.3.3 Start Image Annotation","text":"
  • After starting labelme, it will look like this:

* Select the category in the Flags interface.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select the save path upon the first save. If autosave is enabled, there is no need to click the Save button).

* Then click Next Image to annotate the next image.

  • After annotating all images, use the convert_to_imagenet.py to convert the annotated dataset to ImageNet-1k dataset format, generating train.txt, val.txt, and label.txt.

python convert_to_imagenet.py --dataset_path /path/to/dataset\n
dataset_path is the annotated labelme format classification dataset.

  • The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/image_feature.html#134-data-format-conversion","title":"1.3.4 Data Format Conversion","text":"

After obtaining data in LabelMe format, the data format needs to be converted to ShiTuRecDataset format. Below is a code example that demonstrates how to convert the data labeled using LabelMe according to the previous tutorial.

# Download and unzip the LabelMe format example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n# Convert the LabelMe example dataset\npython main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/image_feature.html#3-data-format","title":"3. Data Format","text":"

The dataset defined by PaddleX for image classification tasks is named ShiTuRecDataset, with the following organizational structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but should correspond to the content of train.txt, query.txt, gallery.txt\n\u251c\u2500\u2500 gallery.txt   # Annotation file for the gallery set, the file name cannot be changed. Each line gives the path of the image to be retrieved and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_2_side.jpg 3997\n\u2514\u2500\u2500 query.txt     # Annotation file for the query set, the file name cannot be changed. Each line gives the path of the database image and its feature label, separated by a space. Example: images/WOMEN/Blouses_Shirts/id_00000001/02_1_front.jpg 3997\n

The annotation files use an image feature format. Please refer to the above specifications to prepare your data. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html","title":"PaddleX Instance Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to instance segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is a fruit instance segmentation dataset, covering five different types of fruits, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For instance segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as fruit.
  • Create an images directory (must be named images) within fruit and store the images to be annotated in the images directory, as shown below:
  • Create a category label file label.txt in the fruit folder for the dataset to be annotated, and write the categories of the dataset to be annotated into label.txt by line. Taking the fruit instance segmentation dataset's label.txt as an example, as shown below:
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the labelme annotation tool.

cd path/to/fruit\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* labels is the path to the category labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting labelme, it will look like this:

* Click Edit to select the annotation type, choose Create Polygons. * Create polygons on the image to outline the boundaries of the segmentation areas.

* Click again to select the category of the segmentation area.

  • After annotation, click Save. (If output is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is specified, there is no need to click the Save button).

  • Then click Next Image to annotate the next image.

* The final annotated label file will look like this.

  • Adjusting Directory Structure to Obtain a Standard labelme Format Dataset for Fruit Instance Segmentation

  • Prepare the train_anno_list.txt and val_anno_list.txt text files in the root directory of your dataset. Populate these files with the paths of all json files in the annotations directory, distributing them into train_anno_list.txt and val_anno_list.txt at a specified ratio. Alternatively, you can include all paths in train_anno_list.txt and create an empty val_anno_list.txt file, intending to use a zero-code data splitting feature for re-partitioning upon upload. The specific format for filling train_anno_list.txt and val_anno_list.txt is illustrated as follows:

  • The final directory structure after organization should resemble the following:

  • Compress the fruit directory into a .tar or .zip format archive to obtain the standard labelme format dataset for fruit instance segmentation.
"},{"location":"en/data_annotations/cv_modules/instance_segmentation.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named COCOInstSegDataset for instance segmentation tasks, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Training set annotation file, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Validation set annotation file, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

Annotation files adopt the COCO format. Please refer to the above specifications for data preparation. Additionally, refer to: Example Dataset.

When using PaddleX 2.x version for instance segmentation datasets, please refer to the corresponding format conversion section in Instance Segmentation Module Development Tutorial to convert VOC format datasets to COCO datasets. (Note in module development documentation)

Note:

  • Instance segmentation data requires the use of the COCO data format to annotate the pixel boundaries and categories of each target area in each image in the dataset. The polygon boundaries (segmentation) of objects are represented as [x1,y1,x2,y2,...,xn,yn], where (xn,yn) denotes the coordinates of each corner point of the polygon. Annotation information is stored in json files under the annotations directory, with separate files for the training set (instance_train.json) and validation set (instance_val.json).
  • If you have a batch of unlabeled data, we recommend using LabelMe for data annotation. PaddleX Pipelines support data format conversion for datasets annotated with LabelMe.
  • To ensure successful format conversion, please strictly follow the file naming and organization of the example dataset: LabelMe Example Dataset.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html","title":"PaddleX Multi-Label Classification Task Data Annotation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for multi-label classification tasks with a single model. Click on the above links to install the annotation tools and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#1-annotation-data-example","title":"1. Annotation Data Example","text":"

This dataset is manually collected, covering two categories: safety helmets and human heads, with photos taken from different angles. Image examples:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for image classification, object detection, image segmentation, and other tasks. In object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated into label.txt by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the label path. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the storage path for label files.

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After labeling, click Save. (If the output field is not specified when starting Labelme, it will prompt you to select a save path the first time you save. If the autosave field is used for automatic saving, there is no need to click the Save button).

* Then click Next Image to label the next image.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/ml_classification.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/ml_classification.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • It can also be installed with pip in one step
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in the browser after starting. Next, you can start the annotation process based on the task.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#32-annotation-process-with-paddlelabel","title":"3.2 Annotation Process with PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and click on Object Detection.

* Fill in the project name and dataset path. Note that the path is the absolute path on the local machine. Click Create after completion.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding id. Click Add Category to create the required category names. * Start annotating * Select the label you want to annotate with. * Click the rectangular selection button on the left. * Draw a bounding box around the desired region in the image, ensuring semantic partitioning. If there are multiple columns, annotate each separately. * After completing the annotation, the result will appear in the lower-right corner. Check if the annotation is correct. * Once done, click Project Overview.

  • Export Annotated Files

  • In the Project Overview, segment the dataset as needed and click \"Export Dataset\".

  • Fill in the export path and format. The export path should be an absolute path, and the format should be coco.

  • After successful export, the annotated files will be available in the specified path.

  • Adjust directories to obtain COCO-formatted dataset for helmet detection

  • Rename the three json files and the image directory as follows:

Original File/Directory Name Renamed File/Directory Name train.json instance_train.json

|val.json|instance_val.json|

|test.json|instance_test.json| |image|images|

  • Create an annotations directory in the root of the dataset and move all json files into it. The final dataset structure should look like this:

  • Compress the helmet directory into a .tar or .zip file to obtain the COCO-formatted dataset for helmet detection.
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#4-image-multi-label-classification-data-format-conversion","title":"4. Image Multi-Label Classification Data Format Conversion","text":"

After obtaining data in COCO format, you need to convert the data format to MLClsDataset format. Below is a code example that follows the previous tutorial to use LabelMe or PaddleLabel annotated data and perform data format conversion:

# Download and unzip the COCO example dataset\ncd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n# Convert the COCO example dataset to MLClsDataset\npython main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n
"},{"location":"en/data_annotations/cv_modules/ml_classification.html#5-data-format","title":"5. Data Format","text":"

The dataset defined by PaddleX for image multi-label classification tasks is named MLClsDataset, with the following directory structure and annotation format:

dataset_dir    # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images     # Directory where images are saved, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt\n\u251c\u2500\u2500 label.txt  # Correspondence between annotation IDs and category names, the file name cannot be changed. Each line gives the category ID and category name, for example: 45 wallflower\n\u251c\u2500\u2500 train.txt  # Annotation file for the training set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0041_2456602544.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n\u2514\u2500\u2500 val.txt    # Annotation file for the validation set, the file name cannot be changed. Each line gives the image path and multi-label classification tags for the image, separated by spaces, for example: images/0045_845243484.jpg 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0\n

The annotation files use the multi-label classification format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/object_detection.html","title":"PaddleX Object Detection Task Data Preparation Tutorial","text":"

This section will introduce how to use Labelme and PaddleLabel annotation tools to complete data annotation for single-model object detection tasks. Click the above links to install the annotation tools and view detailed usage instructions.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is a Python-based image annotation software with a graphical user interface. It can be used for tasks such as image classification, object detection, and image segmentation. For object detection annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/object_detection.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, e.g., helmet.
  • Create an images directory (must be named images) within helmet and store the images to be annotated in the images directory, as shown below:

* Create a category label file label.txt in the helmet folder and write the categories of the dataset to be annotated, line by line. For example, for a helmet detection dataset, label.txt would look like this:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#232-start-labelme","title":"2.3.2 Start Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and start the Labelme annotation tool:

cd path/to/helmet\nlabelme images --labels label.txt --nodata --autosave --output annotations\n
* flags creates classification labels for images, passing in the path to the labels. * nodata stops storing image data in the JSON file. * autosave enables automatic saving. * output specifies the path for storing label files.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#233-begin-image-annotation","title":"2.3.3 Begin Image Annotation","text":"
  • After starting Labelme, it will look like this:

* Click \"Edit\" to select the annotation type.

* Choose to create a rectangular box.

* Drag the crosshair to select the target area on the image.

* Click again to select the category of the target box.

* After annotation, click Save. (If output is not specified when starting Labelme, it will prompt to select a save path upon the first save. If autosave is enabled, no need to click Save.)

* Click Next Image to annotate the next.

* The final labeled tag file looks like this:

* Adjust the directory to obtain the safety helmet detection dataset in the standard Labelme format * Create two text files, train_anno_list.txt and val_anno_list.txt, in the root directory of the dataset. Write the paths of all json files in the annotations directory into train_anno_list.txt and val_anno_list.txt at a certain ratio, or write all of them into train_anno_list.txt and create an empty val_anno_list.txt file. Use the data splitting function to re-split. The specific filling format of train_anno_list.txt and val_anno_list.txt is shown below:

* The final directory structure after organization is as follows:

"},{"location":"en/data_annotations/cv_modules/object_detection.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with Labelme, the data format needs to be converted to coco format. Below is a code example for converting the data labeled using Labelme according to the above tutorial:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n\npython main.py -c paddlex/configs/obeject_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

"},{"location":"en/data_annotations/cv_modules/object_detection.html#3-paddlelabel-annotation","title":"3. PaddleLabel Annotation","text":""},{"location":"en/data_annotations/cv_modules/object_detection.html#31-installation-and-startup-of-paddlelabel","title":"3.1 Installation and Startup of PaddleLabel","text":"
  • To avoid environment conflicts, it is recommended to create a clean conda environment:
    conda create -n paddlelabel python=3.11\nconda activate paddlelabel\n
  • Alternatively, you can install it with pip in one command:
    pip install --upgrade paddlelabel\npip install a2wsgi uvicorn==0.18.1\npip install connexion==2.14.1\npip install Flask==2.2.2\npip install Werkzeug==2.2.2\n
  • After successful installation, you can start PaddleLabel using one of the following commands in the terminal:
    paddlelabel  # Start paddlelabel\npdlabel # Abbreviation, identical to paddlelabel\n
    PaddleLabel will automatically open a webpage in your browser after startup. You can then proceed with the annotation process based on your task.
"},{"location":"en/data_annotations/cv_modules/object_detection.html#32-annotation-process-of-paddlelabel","title":"3.2 Annotation Process of PaddleLabel","text":"
  • Open the automatically popped-up webpage, click on the sample project, and then click on Object Detection.

* Fill in the project name and dataset path. Note that the path should be an absolute path on your local machine. Click Create when done.

* First, define the categories that need to be annotated. Taking layout analysis as an example, provide 10 categories, each with a unique corresponding ID. Click Add Category to create the required category names. * Start Annotating * First, select the label you need to annotate. * Click the rectangular selection button on the left. * Draw a bounding box around the desired area in the image, paying attention to semantic partitioning. If there are multiple columns, please annotate each separately. * After completing the annotation, the annotation result will appear in the lower right corner. You can check if the annotation is correct. * When all annotations are complete, click Project Overview.

* Export Annotation Files * In Project Overview, divide the dataset as needed, then click Export Dataset.

* Fill in the export path and export format. The export path should also be an absolute path, and the export format should be selected as coco.

* After successful export, you can obtain the annotation files in the specified path.

* Adjust the directory to obtain the standard coco format dataset for helmet detection * Rename the three json files and the image directory according to the following correspondence:

Original File (Directory) Name Renamed File (Directory) Name train.json instance_train.json val.json instance_val.json test.json instance_test.json image images
  • Create an annotations directory in the root directory of the dataset and move all json files to the annotations directory. The final dataset directory structure will look like this:

* Compress the helmet directory into a .tar or .zip format compressed package to obtain the standard coco format dataset for helmet detection.

"},{"location":"en/data_annotations/cv_modules/object_detection.html#4-data-format","title":"4. Data Format","text":"

The dataset defined by PaddleX for object detection tasks is named COCODetDataset, with the following organizational structure and annotation format:

dataset_dir                  # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations              # Directory for saving annotation files, the directory name cannot be changed\n\u2502   \u251c\u2500\u2500 instance_train.json  # Annotation file for the training set, the file name cannot be changed, using COCO annotation format\n\u2502   \u2514\u2500\u2500 instance_val.json    # Annotation file for the validation set, the file name cannot be changed, using COCO annotation format\n\u2514\u2500\u2500 images                   # Directory for saving images, the directory name cannot be changed\n

The annotation files use the COCO format. Please prepare your data according to the above specifications. Additionally, you can refer to the example dataset.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html","title":"PaddleX Semantic Segmentation Task Module Data Annotation Tutorial","text":"

This document will introduce how to use the Labelme annotation tool to complete data annotation for a single model related to semantic segmentation. Click on the link above to install the data annotation tool and view detailed usage instructions by referring to the homepage documentation.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":"

This dataset is a manually collected street scene dataset, covering two categories of vehicles and roads, including photos taken from different angles of the targets. Image examples:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#2-labelme-annotation","title":"2. Labelme Annotation","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#21-introduction-to-labelme-annotation-tool","title":"2.1 Introduction to Labelme Annotation Tool","text":"

Labelme is an image annotation software written in python with a graphical interface. It can be used for tasks such as image classification, object detection, and semantic segmentation. In semantic segmentation annotation tasks, labels are stored as JSON files.

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#22-labelme-installation","title":"2.2 Labelme Installation","text":"

To avoid environment conflicts, it is recommended to install in a conda environment.

conda create -n labelme python=3.10\nconda activate labelme\npip install pyqt5\npip install labelme\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#23-labelme-annotation-process","title":"2.3 Labelme Annotation Process","text":""},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#231-prepare-data-for-annotation","title":"2.3.1 Prepare Data for Annotation","text":"
  • Create a root directory for the dataset, such as seg_dataset
  • Create an images directory within seg_dataset (the directory name can be modified, but ensure the subsequent command's image directory name is correct), and store the images to be annotated in the images directory, as shown below:
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#232-launch-labelme","title":"2.3.2 Launch Labelme","text":"

Navigate to the root directory of the dataset to be annotated in the terminal and launch the labelme annotation tool.

# Windows\ncd C:\\path\\to\\seg_dataset\n# Mac/Linux\ncd path/to/seg_dataset\n
labelme images --nodata --autosave --output annotations\n
* nodata stops storing image data in the JSON file * autosave enables automatic saving * output specifies the path for storing label files

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#233-start-image-annotation","title":"2.3.3 Start Image Annotation","text":"
  • After launching labelme, it will look like this:

* Click \"Edit\" to select the annotation type

* Choose to create polygons

* Draw the target contour on the image

  • When the contour line is closed as shown in the left image below, a category selection box will pop up, allowing you to input or select the target category

Typically, only the foreground objects need to be labeled with their respective categories, while other pixels are automatically considered as background. If manual background labeling is required, the category must be set to background, otherwise errors may occur during dataset format conversion. For noisy parts or irrelevant sections in the image that should not participate in model training, the ignore class can be used, and the model will automatically skip those parts during training. For objects with holes, after outlining the main object, draw polygons along the edges of the holes and assign a specific category to the holes. If the hole represents background, assign it as background. An example is shown below:

  • After labeling, click \"Save\". (If the output field is not specified when starting labelme, it will prompt to select a save path upon the first save. If autosave is enabled, the save button is not required.)

* Then click \"Next Image\" to proceed to the next image for labeling.

  • The final labeled file will look like this:

  • Adjust the directory structure to obtain a standard LabelMe format dataset for safety helmet detection: a. Download and execute the directory organization script in the root directory of your dataset, seg_dataset. After executing the script, the train_anno_list.txt and val_anno_list.txt files will contain content as shown:

    python format_seg_labelme_dataset.py\n
    b. The final directory structure after organization will look like this:

"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#234-format-conversion","title":"2.3.4 Format Conversion","text":"

After labeling with LabelMe, the data format needs to be converted to the Seg data format. Below is a code example for converting data labeled using LabelMe according to the above tutorial.

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n\npython main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n
"},{"location":"en/data_annotations/cv_modules/semantic_segmentation.html#data-format","title":"Data Format","text":"

The dataset defined by PaddleX for image segmentation tasks is named SegDataset, with the following organizational structure and annotation format:

dataset_dir         # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 annotations     # Directory for storing annotated images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 images          # Directory for storing original images, the directory name can be changed, matching the content of the manifest files\n\u251c\u2500\u2500 train.txt       # Annotation file for the training set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/P0005.jpg annotations/P0005.png\n\u2514\u2500\u2500 val.txt         # Annotation file for the validation set, the file name cannot be changed. Each line contains the path to the original image and the annotated image, separated by a space. Example: images/N0139.jpg annotations/N0139.png\n
Label images should be single-channel grayscale or single-channel pseudo-color images, and it is recommended to save them in PNG format. Each pixel value in the label image represents a category, and the categories should start from 0 and increase sequentially, for example, 0, 1, 2, 3 represent 4 categories. The pixel storage of the label image is 8bit, so a maximum of 256 categories are supported for labeling.

Please prepare your data according to the above specifications. Additionally, you can refer to: Example Dataset

"},{"location":"en/data_annotations/ocr_modules/table_recognition.html","title":"PaddleX Table Structure Recognition Task Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/table_recognition.html#1-data-annotation","title":"1. Data Annotation","text":"

For annotating table data, use the PPOCRLabelv2 tool. Detailed steps can be found in: \u3010Video Demonstration\u3011

Table annotation focuses on structured extraction of table data, converting tables in images into Excel format. Therefore, annotation requires the use of an external software to open Excel simultaneously. In PPOCRLabel, complete the annotation of text information within the table (text and position), and in the Excel file, complete the annotation of table structure information. The recommended steps are:

  1. Table Recognition: Open the table image, click the Table Recognition button in the upper right corner of the software. The software will call the table recognition model in PP-Structure to automatically label the table, and simultaneously open an Excel file.
  2. Modify Annotation Results: Add annotation boxes with each cell as the unit (i.e., all text within a cell is marked as one box). Right-click on the annotation box and select Cell Re-recognition to automatically recognize the text within the cell using the model.
  3. Adjust Cell Order: Click View - Show Box Number to display the annotation box numbers. Drag all results under the Recognition Results column on the right side of the software interface to arrange the annotation box numbers in order from left to right and top to bottom, annotating by row.
  4. Annotate Table Structure: In an external Excel software, mark cells with text as any identifier (e.g., 1), ensuring that the cell merging in Excel matches the original image (i.e., the text in Excel cells does not need to be identical to the text in the image).
  5. Export JSON Format: Close all Excel files corresponding to the table images, click File - Export Table Annotation, and generate the gt.txt annotation file.
"},{"location":"en/data_annotations/ocr_modules/table_recognition.html#2-data-format","title":"2. Data Format","text":"

The dataset structure and annotation format defined by PaddleX for table recognition tasks are as follows:

```ruby dataset_dir # Root directory of the dataset, the directory name can be changed \u251c\u2500\u2500 images # Directory for saving images, the directory name can be changed, but note the correspondence with the content of train.txt and val.txt \u251c\u2500\u2500 train.txt # Training set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"\u3001\", \"\u200b\u81ea\u200b\", \"\u200b\u6211\u200b\"], \"bbox\": [[[5, 2], [231, 2], [231, 35], [5, 35]]]}, {\"tokens\": [\"9\"], \"bbox\": [[[168, 68], [231, 68], [231, 98], [168, 98]]]}]}, \"gt\": \"\u3001\u200b\u81ea\u6211\u200bAghas\u200b\u5931\u5434\u200b\u6708\u200b\uff0clonwyCau9\"} \u2514\u2500\u2500 val.txt # Validation set annotation file, the file name cannot be changed. Example content: {\"filename\": \"images/no_border.jpg\", \"html\": {\"structure\": {\"tokens\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]}, \"cells\": [{\"tokens\": [\"a"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html","title":"PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#1-annotation-data-examples","title":"1. Annotation Data Examples","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#2-ppocrlabel-annotation","title":"2. PPOCRLabel Annotation","text":""},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#21-introduction-to-ppocrlabel-annotation-tool","title":"2.1 Introduction to PPOCRLabel Annotation Tool","text":"

PPOCRLabel is a semi-automatic graphical annotation tool tailored for OCR tasks, featuring automatic annotation and re-recognition of data using the built-in PP-OCR model. Written in Python3 and PyQT5, it supports rectangular box annotation, table annotation, irregular text annotation, and key information annotation modes. In OCR annotation tasks, labels are stored as txt files.

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#22-installation-and-running-ppocrlabel","title":"2.2 Installation and Running PPOCRLabel","text":"

PPOCRLabel can be launched through whl packages or Python scripts. The whl package method is more convenient, and only this method is provided here:

  • For Windows:
    pip install PPOCRLabel  # Installation\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n

[!NOTE] Installing PPOCRLabel via whl packages will automatically download the paddleocr whl package. The shapely dependency may encounter a \"[winRrror 126] The specified module could not be found.\" error. It is recommended to download and install the shapely installation package separately.

  • For MacOS:
    pip3 install PPOCRLabel\npip3 install opencv-contrib-python-headless==4.2.0.32 # Add \"-i https://mirror.baidu.com/pypi/simple\" for faster downloads\n\n# Start by selecting the labeling mode\nPPOCRLabel --lang ch  # Start in [Normal Mode] for [Detection + Recognition] scenarios\n
"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#23-annotation-process-for-text-detection-and-text-recognition","title":"2.3 Annotation Process for Text Detection and Text Recognition","text":"
  1. Installation and Running: Use the above commands to install and run the program.
  2. Open Folder: Click \"File\" - \"Open Directory\" to select the folder containing images to be annotated.

3. Auto Annotation: Click \"Auto Annotation\" to use the PP-OCR ultra-lightweight model to automatically annotate images with a file status of \"X\".

4. Manual Annotation: Click \"Rectangle Annotation\" (recommended to press \"W\" directly in English mode), and users can manually draw bounding boxes for parts undetected by the model in the current image. Press \"Q\" on the keyboard to use the four-point annotation mode (or click \"Edit\" - \"Four-point Annotation\"), and users click 4 points in sequence, double-clicking the left mouse button to indicate completion. 5. After drawing the bounding box, click \"Confirm\", and the detection box will be pre-assigned a \"To Be Recognized\" label. 6. Re-Recognition: After drawing/adjusting all detection boxes in the image, click \"Re-Recognition\", and the PP-OCR model will re-recognize all detection boxes in the current image.

7. Content Modification: Click on the recognition result to manually modify inaccurate recognition results. 8. Confirm Annotation: Click \"Confirm\", the image status changes to \"\u221a\", and proceed to the next image. 9. Deletion: Click \"Delete Image\", and the image will be deleted to the Recycle Bin. 10. Export Results: Users can manually export results through \"File - Export Annotation Results\" or enable automatic export by clicking \"File - Auto Export Annotation Results\". Manually confirmed annotations will be stored in Label.txt under the opened image folder. Clicking \"File - Export Recognition Results\" in the menu bar will save the recognition training data of such images in the crop_img folder, and the recognition labels will be saved in rec_gt.txt.

Notes:

  • PPOCRLabel uses folders as the basic unit for labeling. After opening the folder containing images to be labeled, the images will not be displayed in the window bar. Instead, clicking \"Select Folder\" will directly import the images under the folder into the program.
  • The image status indicates whether the current image has been manually saved by the user. An \"X\" indicates it has not been manually saved, while a \"\u221a\" indicates it has. After clicking the \"Auto Label\" button, PPOCRLabel will not relabel images with a status of \"\u221a\".
  • Clicking \"Re-recognize\" will overwrite the recognition results in the image. Therefore, if manual changes have been made to the recognition results before this, they may be altered after re-recognition.
  • Files generated by PPOCRLabel are placed in the folder containing the labeled images, including the following types. Do not manually modify their contents as it may cause program exceptions.
File Name Description Label.txt Detection labels, which can be directly used for PPOCR detection model training. The program automatically writes to this file every 5 confirmed detection results, or when the application is closed or the file path is changed. fileState.txt Image status marker file, which saves the names of images in the current folder that have been manually confirmed by the user. Cache.cach Cache file, which saves the results of automatic recognition by the model. rec_gt.txt Recognition labels. Can be directly used for PPOCR recognition model training. Generated by manually clicking \"Export Recognition Results\" in the menu bar. crop_img Recognition data. Images cropped according to the detection boxes. Generated simultaneously with rec_gt.txt.

If data partitioning is required, follow these steps:

cd ./PPOCRLabel # Switch to the PPOCRLabel folder\npython gen_ocr_train_val_test.py --trainValTestRatio 7:3:0 --datasetRootPath ../train_data\n
* trainValTestRatio is the ratio for dividing images into training, validation, and test sets. Set it according to your needs. The default is 6:2:2. * datasetRootPath is the full path to the dataset labeled by PPOCRLabel. The default path is PaddleOCR/train_data. Before partitioning the dataset, the structure should be as follows:

|-train_data\n  |-crop_img\n    |- word_001_crop_0.png\n    |- word_002_crop_0.jpg\n    |- word_003_crop_0.jpg\n    | ...\n  | Label.txt\n  | rec_gt.txt\n  |- word_001.png\n  |- word_002.jpg\n  |- word_003.jpg\n  | ...\n
For more tool usage instructions, please refer to Detailed Instructions

"},{"location":"en/data_annotations/ocr_modules/text_detection_recognition.html#3-data-format","title":"3. Data Format","text":"

PaddleX defines a dataset named TextDetDataset specifically for text detection tasks. The organized and annotated data should follow the following file organization and naming conventions:

dataset_dir     # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images      # Directory to store images, the directory name can be changed but should correspond to the content in train.txt and val.txt\n\u251c\u2500\u2500 train.txt   # Annotation file for the training set, the file name cannot be changed. Example content: images/img_0.jpg \\t [{\"transcription\": \"MASA\", \"points\": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]\n\u2514\u2500\u2500 val.txt     # Annotation file for the validation set, the file name cannot be changed. Example content: images/img_61.jpg \\t [{\"transcription\": \"TEXT\", \"points\": [[31, 10], [310, 140], [420, 220], [310, 170]]}, {...}]\n
Place the images in the images directory, and rename the generated Label.txt annotation file to train.txt for the training set. Similarly, rename the Label.txt annotation file for the validation set to val.txt. Both files should be placed in the dataset_dir (the name of which can be changed) directory. Note that the image paths in train.txt/val.txt should be in the format images/xxx.

Each line in the annotation files contains the path to an image and a list of dictionaries. The path and the list must be separated by a tab character \u2018\\t\u2019, not spaces.

For the list of dictionaries, the points key represents the coordinates (x, y) of the four vertices of the text box, starting from the top-left vertex and proceeding clockwise. The transcription key indicates the text within the text box. If the transcription content is \"###\", it indicates that the text box is invalid and will not be used for training. For reference, see the example dataset.

If you use PPOCRLabel to annotate your data, simply rename det_gt_train.txt in the text detection (det) directory to train.txt and det_gt_test.txt to val.txt after dividing your dataset.

"},{"location":"en/data_annotations/time_series_modules/time_series_anomaly_detection.html","title":"PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial","text":"

Time series anomaly detection is an unsupervised learning task, thus there is no need to annotate training data. The collected training samples should ideally consist solely of normal data, i.e., no anomalies (represented by 0 for no anomaly). In the training set, the label column indicating anomalies can be set to 0 or omitted entirely. For the validation set, to evaluate model accuracy, annotations are required. For points that are anomalous at a specific time, set the label for that time point to 1, and the labels for other normal time points to 0.

"},{"location":"en/data_annotations/time_series_modules/time_series_classification.html","title":"PaddleX Time Series Classification Task Data Annotation Tutorial","text":"

When annotating time series classification data, based on the collected real-world data, clearly define the classification objectives of the time series data and establish corresponding classification labels. In the csv file, set a group_id column to represent samples, where the same group_id indicates that the data points belong to the same sample. For example, in stock price prediction, labels might be \"Rise\" (0), \"Flat\" (1), or \"Fall\" (2). For a time series that exhibits an \"upward\" trend over a period, it can be considered as one sample (group), where each time point in this series shares the same group_id, and the label column is set to 0. Similarly, for a time series that exhibits a \"downward\" trend, it forms another sample (group), where each time point shares the same group_id, and the label column is set to 2. As shown in the figure below, the green box represents one sample (group_id=0) with a label of 1, while the red box represents another time series classification sample (group_id=1) with a label of 0. If there are n samples, you can set group_id=0,...,n-1; each sample has a length (time=0,...,9) of 10, and the feature dimensions (dim_0, dim_1) are 2.

"},{"location":"en/data_annotations/time_series_modules/time_series_forecasting.html","title":"PaddleX Time Series Forecasting Task Data Annotation Tutorial","text":"

Data for time series forecasting tasks does not require annotation. Simply collect real-world data and arrange it in a csv file in chronological order. During training, the data will be automatically segmented into multiple time slices to form training samples, as shown in the figure below. The historical time series data and future sequences represent the input data for training the model and its corresponding prediction targets, respectively. To ensure data quality and completeness, missing values can be filled based on expert experience or statistical methods.

"},{"location":"en/installation/installation.html","title":"PaddleX Local Installation Tutorial","text":"

\u2757Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.10, with more Python versions being adapted).

"},{"location":"en/installation/installation.html#1-quick-installation","title":"1. Quick Installation","text":"

Welcome to PaddleX, Baidu's low-code development tool for AI. Before we dive into the local installation process, please clarify your development needs and choose the appropriate installation mode.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. Below, we introduce their respective application scenarios:

"},{"location":"en/installation/installation.html#11-wheel-package-installation-mode","title":"1.1 Wheel Package Installation Mode","text":"

If your use case for PaddleX involves model inference and integration, we recommend the more convenient and lightweight Wheel package installation mode.

After installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the PaddleX Wheel package by executing the following commands:

\u2757 Note: Please ensure that PaddlePaddle is successfully installed before proceeding to the next step.

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b2-py3-none-any.whl\n
"},{"location":"en/installation/installation.html#12-plugin-installation-mode","title":"1.2 Plugin Installation Mode","text":"

If your use case for PaddleX involves custom development (e.g. retraining models, fine-tuning models, customizing model structures, customizing inference codes, etc.), we recommend the more powerful plugin installation mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration with the supported models but also conduct advanced operations such as model training for custom development.

The plugins supported by PaddleX are listed below. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection PP-ChatOCRv3-doc Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionText Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Forecasting Time Series Forecasting Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS Image Multi-Label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin you need to install is PaddleXXX, after installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the corresponding PaddleX plugin by executing the following commands:

git clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\npip install -e .\npaddlex --install PaddleXXX\n

\u2757 Note: The two installation methods are not mutually exclusive, and you can install both simultaneously.

Next, we provide detailed installation tutorials for your reference. If you are using a Linux operating system, please refer to 2. Detailed Tutorial for Installing PaddleX on Linux.

"},{"location":"en/installation/installation.html#2-detailed-tutorial-for-installing-paddlex-on-linux","title":"2. Detailed Tutorial for Installing PaddleX on Linux","text":"

When installing PaddleX on Linux, we strongly recommend using the official PaddleX Docker image. Alternatively, you can use other custom installation methods.

When using the official Docker image, PaddlePaddle, PaddleX (including the wheel package and all plugins), and the corresponding CUDA environment are already pre-installed. You can simply obtain the Docker image and start the container to begin using it.

When using custom installation methods, you need to first install the PaddlePaddle framework, then obtain the PaddleX source code, and finally choose the PaddleX installation mode.

"},{"location":"en/installation/installation.html#21-get-paddlex-based-on-docker","title":"2.1 Get PaddleX based on Docker","text":"

Using the PaddleX official Docker image, create a container called 'paddlex' and map the current working directory to the '/paddle' directory inside the container by following the command.

If your Docker version >= 19.03, please use:

# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-cpu /bin/bash\n\n# For GPU\n# For CUDA11.8\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# For CUDA12.3\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0b2-paddlepaddle3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • If you want to delve deeper into the principles or usage of Docker, please refer to the Docker Official Website or the Docker Official Tutorial.

"},{"location":"en/installation/installation.html#22-custom-installation-of-paddlex","title":"2.2 Custom Installation of PaddleX","text":"

Before installation, please ensure you have completed the local installation of PaddlePaddle by referring to the PaddlePaddle Local Installation Tutorial.

"},{"location":"en/installation/installation.html#221-obtain-paddlex-source-code","title":"2.2.1 Obtain PaddleX Source Code","text":"

Next, use the following command to obtain the latest PaddleX source code from GitHub:

git clone https://github.com/PaddlePaddle/PaddleX.git\n
If accessing GitHub is slow, you can download from Gitee instead, using the following command:

git clone https://gitee.com/paddlepaddle/PaddleX.git\n
"},{"location":"en/installation/installation.html#222-install-paddlex","title":"2.2.2 Install PaddleX","text":"

After obtaining the latest PaddleX source code, you can choose between Wheel package installation mode or plugin installation mode.

  • If you choose Wheel package installation mode, execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n
  • If you choose plugin installation mode and the plugin you need is named PaddleXXX (there can be multiple), execute the following commands:
cd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX plugins\npaddlex --install PaddleXXX\n

For example, if you need to install the PaddleOCR and PaddleClas plugins, execute the following commands to install the plugins:

# Install PaddleOCR and PaddleClas plugins\npaddlex --install PaddleOCR PaddleClas\n

If you need to install all plugins, you do not need to specify the plugin names, just execute the following command:

# Install all PaddleX plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com as a clone source. You can specify the clone source using --platform.

For example, if you need to use gitee.com as the clone source to install all PaddleX plugins, just execute the following command:

# Install PaddleX plugins\npaddlex --install --platform gitee.com\n

After installation, you will see the following prompt:

All packages are installed.\n

For PaddleX installation on more hardware environments, please refer to the PaddleX Multi-hardware Usage Guide

"},{"location":"en/installation/paddlepaddle_install.html","title":"PaddlePaddle Local Installation Tutorial","text":"

When installing PaddlePaddle, you can choose to install it via Docker or pip.

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-docker","title":"Installing PaddlePaddle via Docker","text":"

If you choose to install via Docker, please refer to the following commands to use the official PaddlePaddle Docker image to create a container named paddlex and map the current working directory to the /paddle directory inside the container:

If your Docker version >= 19.03, please use:

# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\ndocker run --gpus all --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU users:\ndocker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2 /bin/bash\n\n# For GPU users:\n# CUDA 11.8 users\nnvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash\n\n# CUDA 12.3 users\nnvidia-docker run --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash\n
  • If your Docker version <= 17.06, please update your Docker.

  • Note: For more official PaddlePaddle Docker images, please refer to the PaddlePaddle official website

"},{"location":"en/installation/paddlepaddle_install.html#installing-paddlepaddle-via-pip","title":"Installing PaddlePaddle via pip","text":"

If you choose to install via pip, please refer to the following commands to install PaddlePaddle in your current environment using pip:

# CPU\npython -m pip install paddlepaddle==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/\n\n# GPU, this command is only suitable for machines with CUDA version 11.8\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/\n\n# GPU, this command is only suitable for machines with CUDA version 12.3\npython -m pip install paddlepaddle-gpu==3.0.0b2 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/\n
Note: For more PaddlePaddle Wheel versions, please refer to the PaddlePaddle official website.

For installing PaddlePaddle on other hardware, please refer to PaddleX Multi-hardware Usage Guide.

After installation, you can verify if PaddlePaddle is successfully installed using the following command:

python -c \"import paddle; print(paddle.__version__)\"\n
If the installation is successful, the following content will be output:

3.0.0-beta2\n

\u2757 Note: If you encounter any issues during the installation process, feel free to submit an issue in the Paddle repository.

"},{"location":"en/module_usage/instructions/config_parameters_common.html","title":"PaddleX Common Model Configuration File Parameter Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_common.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_common.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; Image classification, pedestrian attribute recognition, vehicle attribute recognition, document orientation classification, object detection, pedestrian detection, vehicle detection, face detection, anomaly detection, text detection, seal text detection, text recognition, table recognition, image rectification, and layout area detection do not support data format conversion; Image multi-label classification supports COCO format conversion; Image feature, semantic segmentation, and instance segmentation support LabelMe format conversion; Object detection and small object detection support VOC and LabelMe format conversion; Formula recognition supports PKL format conversion; Time series prediction, time series anomaly detection, and time series classification support xlsx and xls format conversion False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null split.gallery_percent int Sets the percentage of gallery samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and query_percent is 100; This parameter is only used in the image feature module null split.query_percent int Sets the percentage of query samples in the validation set, an integer between 0-100, ensuring the sum with train_percent and gallery_percent is 100; This parameter is only used in the image feature module null"},{"location":"en/module_usage/instructions/config_parameters_common.html#train","title":"Train","text":"Parameter Name Data Type Description Default Value num_classes int Number of classes in the dataset; If you need to train on a private dataset, you need to set this parameter; Image rectification, text detection, seal text detection, text recognition, formula recognition, table recognition, time series prediction, time series anomaly detection, and time series classification do not support this parameter Number of classes specified in the YAML file epochs_iters int Number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Training batch size Training batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file pretrain_weight_path str Pre-trained weight path null warmup_steps int Warm-up steps Warm-up steps specified in the YAML file resume_path str Model resume path after interruption null log_interval int Training log printing interval Training log printing interval specified in the YAML file eval_interval int Model evaluation interval Model evaluation interval specified in the YAML file save_interval int Model saving interval; not supported for anomaly detection, semantic segmentation, image rectification, time series forecasting, time series anomaly detection, and time series classification Model saving interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights log_interval int Evaluation log printing interval Evaluation log printing interval specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_common.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_common.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html","title":"PaddleX Time Series Task Model Configuration File Parameters Explanation","text":""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#global","title":"Global","text":"Parameter Name Data Type Description Default Value model str Specifies the model name Model name specified in the YAML file mode str Specifies the mode (check_dataset/train/evaluate/export/predict) check_dataset dataset_dir str Path to the dataset Dataset path specified in the YAML file device str Specifies the device to use Device ID specified in the YAML file output str Output path \"output\""},{"location":"en/module_usage/instructions/config_parameters_time_series.html#checkdataset","title":"CheckDataset","text":"Parameter Name Data Type Description Default Value convert.enable bool Whether to convert the dataset format; time series prediction, anomaly detection, and classification support data conversion from xlsx and xls formats False convert.src_dataset_type str The source dataset format to be converted null split.enable bool Whether to re-split the dataset False split.train_percent int Sets the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100; null split.val_percent int Sets the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100; null"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#common-parameters-for-time-series-tasks","title":"Common Parameters for Time Series Tasks","text":"Parameter Name Data Type Description Default Value epochs_iters int The number of times the model repeats learning the training data Number of iterations specified in the YAML file batch_size int Batch size Batch size specified in the YAML file learning_rate float Initial learning rate Initial learning rate specified in the YAML file time_col str Time column, set the column name of the time series dataset's time column based on your data. Time column specified in the YAML file freq str or int Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h. Frequency specified in the YAML file"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-forecasting-parameters","title":"Time Series Forecasting Parameters","text":"Parameter Name Data Type Description Default Value target_cols str Target variable column(s), set the column name(s) of the target variable(s) in the time series dataset, can be multiple, separated by commas OT input_len int For time series forecasting tasks, this parameter represents the length of historical time series input to the model; the input length should be considered in conjunction with the prediction length, generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy. 96 predict_len int The length of the future sequence that you want the model to predict; the prediction length should be considered in conjunction with the actual scenario, generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy. 96 patience int Early stopping mechanism parameter, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; a larger patience value generally results in longer training time. 10"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-anomaly-detection","title":"Time Series Anomaly Detection","text":"Parameter Name Data Type Description Default Value input_len int For time series anomaly detection tasks, this parameter represents the length of the time series input to the model, which will slice the time series according to this length to predict whether there is an anomaly in this segment of the time series; the input length should be considered in conjunction with the actual scenario. For example, an input length of 96 indicates that you want to predict whether there are anomalies in 96 time points. 96 feature_cols str Feature variables indicating variables related to whether the device is abnormal, e.g., whether the device is abnormal may be related to the heat dissipation during its operation. Set the column name(s) of the feature variable(s) based on your data, can be multiple, separated by commas. feature_0,feature_1 label_col str Represents the number indicating whether a time series point is abnormal, with 1 for abnormal points and 0 for normal points. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#time-series-classification","title":"Time Series Classification","text":"Parameter Name Data Type Description Default Value target_cols str Feature variable columns used for category discrimination. You need to set the column names of the target variables in the time series dataset based on your own data. It can be multiple, separated by commas. dim_0,dim_1,dim_2 freq str or int Frequency, which needs to be set based on your own data. Examples of time frequencies include: 1min, 5min, 1h. 1 group_id str A group ID represents a time series sample. Time series sequences with the same ID constitute a sample. Set the column name of the specified group ID based on your own data, e.g., group_id. group_id static_cov_cols str Represents the category number column of the time series. The labels of the same sample are the same. Set the column name of the category based on your own data, e.g., label. label"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#evaluate","title":"Evaluate","text":"Parameter Name Data Type Description Default Value weight_path str Evaluation model path Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#export","title":"Export","text":"Parameter Name Data Type Description Default Value weight_path str Dynamic graph weight path for exporting the model Default local path from training output, when specified as None, indicates using official weights"},{"location":"en/module_usage/instructions/config_parameters_time_series.html#predict","title":"Predict","text":"Parameter Name Data Type Description Default Value batch_size int Prediction batch size The prediction batch size specified in the YAML file model_dir str Path to the prediction model The default local inference model path produced by training. When specified as None, it indicates the use of official weights input str Path to the prediction input The prediction input path specified in the YAML file"},{"location":"en/module_usage/instructions/model_python_API.html","title":"PaddleX Single Model Python Usage Instructions","text":"

Before using Python scripts for single model quick inference, please ensure you have completed the installation of PaddleX following the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/instructions/model_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification model as an example, the usage is as follows:

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, just three steps:

  • Call the create_model() method to instantiate the prediction model object;
  • Call the predict() method of the prediction model object to perform inference prediction;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/module_usage/instructions/model_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/module_usage/instructions/model_python_API.html#1-instantiate-the-prediction-model-object-by-calling-the-create_model-method","title":"1. Instantiate the Prediction Model Object by Calling the create_model() Method","text":"
  • create_model: Instantiate the prediction model object;
  • Parameters:
    • model_name: str type, model name or local inference model file path, such as \"PP-LCNet_x1_0\", \"/path/to/PP-LCNet_x1_0_infer/\";
    • device: str type, used to set the model inference device, such as \"cpu\", \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/module_usage/instructions/model_python_API.html#2-perform-inference-prediction-by-calling-the-predict-method-of-the-prediction-model-object","title":"2. Perform Inference Prediction by Calling the predict() Method of the Prediction Model Object","text":"
  • predict: Use the defined prediction model to predict the input data;
  • Parameters:
    • input: Any type, supports str type representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV models, supports numpy.ndarray representing image data; for TS models, supports pandas.DataFrame type data; also supports list types composed of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/module_usage/instructions/model_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/module_usage/instructions/model_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/module_usage/instructions/model_python_API.html#attributes_1","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/module_usage/instructions/model_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html","title":"Unsupervised Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#i-overview","title":"I. Overview","text":"

Unsupervised anomaly detection is a technology that automatically identifies and detects anomalies or rare samples that are significantly different from the majority of data in a dataset, without labels or with a small amount of labeled data. This technology is widely used in many fields such as industrial manufacturing quality control and medical diagnosis.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link ROCAUC\uff08Avg\uff09 Model Size (M) Description STFPMInference Model/Trained Model 0.962 22.5 An unsupervised anomaly detection algorithm based on representation consists of a pre-trained teacher network and a student network with the same structure. The student network detects anomalies by matching its own features with the corresponding features in the teacher network.

The above model accuracy indicators are measured from the MVTec_AD dataset.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the unsupervised anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the unsupervised anomaly detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"STFPM\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"uad_grid.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better unsupervised anomaly detection models. Before using PaddleX to develop unsupervised anomaly detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mvtec_examples.tar -P ./dataset\ntar -xf ./dataset/mvtec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"train_samples\": 264,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/000.png\",\n      \"check_dataset/demo_img/001.png\",\n      \"check_dataset/demo_img/002.png\"\n    ],\n    \"val_samples\": 57,\n    \"num_classes\": 231\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mvtec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 264;
  • attributes.val_samples: The number of validation samples in this dataset is 57;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of STFPM as an example:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is STFPM.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mvtec_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's STFPM.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/anomaly_detection/STFPM.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"uad_grid.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is STFPM.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The unsupervised anomaly detection module can be integrated into PaddleX pipelines such as Image_anomaly_detection. Simply replace the model path to update the unsupervised anomaly detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the unsupervised anomaly detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html","title":"Face Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#i-overview","title":"I. Overview","text":"

Face detection is a fundamental task in object detection, aiming to automatically identify and locate the position and size of faces in input images. It serves as the prerequisite and foundation for subsequent tasks such as face recognition and face analysis. Face detection accomplishes this by constructing deep neural network models that learn the feature representations of faces, enabling efficient and accurate face detection.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 An improved model of BlazeFace, incorporating FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face Detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face Detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method of the wheel package, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the face detection module. You can switch models under this module freely, and you can also integrate the model inference of the face detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet_LCNet_x2_5_face\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_detection.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on the usage of PaddleX's single-model inference API, please refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better face detection models. Before using PaddleX to develop face detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerface_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerface_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_849.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_Parade_0_904.jpg\",\n      \"check_dataset/demo_img/0--Parade/0_Parade_marchingband_1_799.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_384.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_538.jpg\",\n      \"check_dataset/demo_img/1--Handshaking/1_Handshaking_Handshaking_1_429.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerface_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1;
  • attributes.train_samples: The number of training samples in this dataset is 500;
  • attributes.val_samples: The number of validation samples in this dataset is 100;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Face detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet_LCNet_x2_5_face as an example:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet_LCNet_x2_5_face.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerface_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet_LCNet_x2_5_face.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/face_detection/PicoDet_LCNet_x2_5_face.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_detection.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet_LCNet_x2_5_face.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/face_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own project.

  1. Pipeline Integration

The face detection module can be integrated into PaddleX pipelines such as Face Recognition. Simply replace the model path to update the face detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  1. Module Integration

The weights you produce can be directly integrated into the face detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html","title":"Face Feature Module Usage Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#i-overview","title":"I. Overview","text":"

Face feature models typically take standardized face images processed through detection, extraction, and keypoint correction as input. These models extract highly discriminative facial features from these images for subsequent modules, such as face matching and verification tasks.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"\ud83d\udc49Details of Model List ModelModel Download Link Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face feature model trained on MobileFaceNet with MS1Mv3 dataset ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face feature model trained on ResNet50 with MS1Mv3 dataset

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Tutorial

After installing the whl package, a few lines of code can complete the inference of the face feature module. You can switch models under this module freely, and you can also integrate the model inference of the face feature module into your project. Before running the following code, please download the example image to your local machine.

from paddlex import create_model\n\nmodel_name = \"MobileFaceNet\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"face_recognition_001.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n

For more information on using the PaddleX single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better face feature models. Before developing face feature models with PaddleX, ensure you have installed the PaddleX PaddleClas plugin. The installation process can be found in the PaddleX Local Installation Tutorial

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the official demo data. If you wish to use a private dataset for subsequent model training, the training dataset for the face feature module is organized in a general image classification dataset format. You can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial. If you wish to use a private dataset for subsequent model evaluation, note that the validation dataset format for the face feature module differs from the training dataset format. Please refer to Section 4.1.4 Data Organization Face Feature Module

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_rec_examples.tar -P ./dataset\ntar -xf ./dataset/face_rec_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_label_file\": \"../../dataset/face_rec_examples/train/label.txt\",\n    \"train_num_classes\": 995,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/01378592.jpg\",\n      \"check_dataset/demo_img/04331410.jpg\",\n      \"check_dataset/demo_img/03485713.jpg\",\n      \"check_dataset/demo_img/02382123.jpg\",\n      \"check_dataset/demo_img/01722397.jpg\",\n      \"check_dataset/demo_img/02682349.jpg\",\n      \"check_dataset/demo_img/00272794.jpg\",\n      \"check_dataset/demo_img/03151987.jpg\",\n      \"check_dataset/demo_img/01725764.jpg\",\n      \"check_dataset/demo_img/02580369.jpg\"\n    ],\n    \"val_label_file\": \"../../dataset/face_rec_examples/val/pair_label.txt\",\n    \"val_num_classes\": 2,\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/Don_Carcieri_0001.jpg\",\n      \"check_dataset/demo_img/Eric_Fehr_0001.jpg\",\n      \"check_dataset/demo_img/Harry_Kalas_0001.jpg\",\n      \"check_dataset/demo_img/Francis_Ford_Coppola_0001.jpg\",\n      \"check_dataset/demo_img/Amer_al-Saadi_0001.jpg\",\n      \"check_dataset/demo_img/Sergei_Ivanov_0001.jpg\",\n      \"check_dataset/demo_img/Erin_Runnion_0003.jpg\",\n      \"check_dataset/demo_img/Bill_Stapleton_0001.jpg\",\n      \"check_dataset/demo_img/Daniel_Bruehl_0001.jpg\",\n      \"check_dataset/demo_img/Clare_Short_0004.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/face_rec_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.train_num_classes: The number of classes in this training dataset is 995;
  • attributes.val_num_classes: The number of classes in this validation dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 1000;
  • attributes.val_samples: The number of validation samples in this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or adding hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

The face feature module does not support data format conversion or dataset splitting.

"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#414-data-organization-for-face-feature-module","title":"4.1.4 Data Organization for Face Feature Module","text":"

The format of the validation dataset for the face feature module differs from the training dataset. If you need to evaluate model accuracy on private data, please organize your dataset as follows:

face_rec_dataroot      # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 train              # Directory for saving the training dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500label.txt       # Training set annotation file, the file name cannot be changed. Each line gives the relative path of the image to `train` and the face image class (face identity) id, separated by a space. Example content: images/image_06765.jpg 0\n\u251c\u2500\u2500 val                # Directory for saving the validation dataset, the directory name cannot be changed\n   \u251c\u2500\u2500 images          # Directory for saving images, the directory name can be changed but should correspond to the content in pair_label.txt\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      \u251c\u2500\u2500 xxx.jpg      # Face image file\n      ...\n   \u2514\u2500\u2500 pair_label.txt  # Validation dataset annotation file, the file name cannot be changed. Each line gives the paths of two images to be compared and a 0 or 1 label indicating whether the pair of images belong to the same person, separated by spaces.\n

Example content of the validation set annotation file pair_label.txt:

# Face image 1.jpg Face image 2.jpg Label (0 indicates the two face images do not belong to the same person, 1 indicates they do)\nimages/Angela_Merkel_0001.jpg images/Angela_Merkel_0002.jpg 1\nimages/Bruce_Gebhardt_0001.jpg images/Masao_Azuma_0001.jpg 0\nimages/Francis_Ford_Coppola_0001.jpg images/Francis_Ford_Coppola_0002.jpg 1\nimages/Jason_Kidd_0006.jpg images/Jason_Kidd_0008.jpg 1\nimages/Miyako_Miyazaki_0002.jpg images/Munir_Akram_0002.jpg 0\n
"},{"location":"en/module_usage/tutorials/cv_modules/face_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here is an example of training MobileFaceNet:

python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file for the model (here it is MobileFaceNet.yaml)
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or by appending parameters in the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • When training other models, specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU). After completing model training, all outputs are saved in the specified output directory (default is ./output/). Typically, the following outputs are included:
  • train_result.json: A file that records the training results, indicating whether the training task was successfully completed, and includes metrics, paths to related files, etc.
  • train.log: A log file that records changes in model metrics, loss variations, and other details during the training process.
  • config.yaml: A configuration file that logs the hyperparameter settings for the current training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Files related to model weights, including network parameters, optimizer, EMA (Exponential Moving Average), static graph network parameters, and static graph network structure.
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/face_detection/MobileFaceNet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/face_rec_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `MobileFaceNet.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to [PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand) During model evaluation, the path to the model weights file needs to be specified. Each configuration file has a default weight save path built in. If you need to change it, you can set it by appending a command line parameter, such as `-o Evaluate.weight_path=\"./output/best_model/best_model/model.pdparams\"`. After completing the model evaluation, an `evaluate_result.json` file will be produced, which records the evaluation results. Specifically, it records whether the evaluation task was completed normally and the model's evaluation metrics, including Accuracy. ### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be implemented through two methods: command line and wheel package. #### 4.4.1 Model Inference * To perform inference predictions through the command line, you only need the following command. Before running the following code, please download the [example image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/face_recognition_001.jpg) to your local machine.
python main.py -c paddlex/configs/face_recognition/MobileFaceNet.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"face_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the path to the model's `.yaml` configuration file (here it is `MobileFaceNet.yaml`) * Specify the mode as model inference prediction: `-o Global.mode=predict` * Specify the path to the model weights: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the path to the input data: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.md). #### 4.4.2 Model Integration The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The face feature module can be integrated into the PaddleX pipeline for [Face Recognition](../../../pipeline_usage/tutorials/face_recognition_pipelines/face_recognition.en.md). You only need to replace the model path to update the face feature module of the relevant pipeline. In pipeline integration, you can use high-performance deployment and service-oriented deployment to deploy the model you obtained. 2. Module Integration The weights you produced can be directly integrated into the face feature module. You can refer to the Python example code in [Quick Integration](#III.-Quick-Integration) and only need to replace the model with the path to the model you trained."},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html","title":"Human Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#i-overview","title":"I. Overview","text":"

Human detection is a subtask of object detection, which utilizes computer vision technology to identify the presence of pedestrians in images or videos and provide the specific location information for each pedestrian. This information is crucial for various applications such as intelligent video surveillance, human behavior analysis, autonomous driving, and intelligent robots.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Human detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The evaluation set for the above accuracy metrics is CrowdHuman dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform human detection with just a few lines of code. You can easily switch between models in this module and integrate the human detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_human\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"human_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better human detection models. Before using PaddleX to develop human detection models, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/widerperson_coco_examples.tar -P ./dataset\ntar -xf ./dataset/widerperson_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/000041.jpg\",\n      \"check_dataset/demo_img/000042.jpg\",\n      \"check_dataset/demo_img/000044.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/001138.jpg\",\n      \"check_dataset/demo_img/001140.jpg\",\n      \"check_dataset/demo_img/001141.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/widerperson_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Human detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE-S_human as an example:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE-S_human.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/widerperson_coco_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE-S_human.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer toPaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction. In PaddleX, model inference prediction can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/human_detection/PP-YOLOE-S_human.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"human_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-YOLOE-S_human.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/human_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the human detection module. You can refer to the Python sample code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html","title":"Image Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#i-overview","title":"I. Overview","text":"

The image classification module is a crucial component in computer vision systems, responsible for categorizing input images. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. Typically, the image classification module receives an image as input and, through deep learning or other machine learning algorithms, classifies it into predefined categories based on its characteristics and content. For instance, in an animal recognition system, the image classification module might need to classify an input image as \"cat,\" \"dog,\" \"horse,\" etc. The classification results from the image classification module are then output for use by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can complete image classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the image classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0\")\noutput = model.predict(\"general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better image classification models. Before using PaddleX to develop image classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset\ntar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

One command is all you need to complete data validation:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Results Details (Click to Expand)
{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"dataset/label.txt\",\n    \"num_classes\": 102,\n    \"train_samples\": 1020,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/image_01904.jpg\",\n      \"check_dataset/demo_img/image_06940.jpg\"\n    ],\n    \"val_samples\": 1020,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/image_01937.jpg\",\n      \"check_dataset/demo_img/image_06958.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/cls_flowers_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

The above validation results, with check_pass being True, indicate that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 102;
  • attributes.train_samples: The number of training set samples in this dataset is 1020;
  • attributes.val_samples: The number of validation set samples in this dataset is 1020;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Image classification does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
  • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which should be an integer between 0-100, ensuring that the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters also support being set through appending command line arguments:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image classification model PP-LCNet_x1_0 as an example:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n

the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml. When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. Using PaddleX for model evaluation, a single command can complete the model evaluation:

python main.py -c  paddlex/configs/image_classification/PP-LCNet_x1_0.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/cls_flowers_examples\n
Similar to model training, the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path of the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration. Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including val.top1, val.top5;

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_classification_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The image classification module can be integrated into the General Image Classification Pipeline of PaddleX. Simply replace the model path to update the image classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

2.Module Integration

The weights you produce can be directly integrated into the image classification module. You can refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html","title":"Image Feature Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#i-overview","title":"I. Overview","text":"

The image feature module is one of the important tasks in computer vision, primarily referring to the automatic extraction of useful features from image data using deep learning methods, to facilitate subsequent image retrieval tasks. The performance of this module directly affects the accuracy and efficiency of the subsequent tasks. In practical applications, image features typically output a set of feature vectors, which can effectively represent the content, structure, texture, and other information of the image, and will be passed as input to the subsequent retrieval module for processing.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_recInference Model/Trained Model 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: object detection, feature extraction, and vector retrieval. These models are part of the feature extraction module and can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_baseInference Model/Trained Model 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_largeInference Model/Trained Model 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are Recall@1 from AliProducts. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the image feature module. You can switch between models under this module freely, and you can also integrate the model inference of the image feature module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-ShiTuV2_rec\")\noutput = model.predict(\"general_image_recognition_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better image feature models. Before developing image feature models with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Feature Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/Inshop_examples.tar -P ./dataset\ntar -xf ./dataset/Inshop_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/05_1_front.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/04_2_side.jpg\",\n      \"check_dataset/demo_img/12_1_front.jpg\",\n      \"check_dataset/demo_img/07_2_side.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/01_1_front.jpg\"\n    ],\n    \"gallery_samples\": 110,\n    \"gallery_sample_paths\": [\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/01_4_full.jpg\",\n      \"check_dataset/demo_img/04_7_additional.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_3_back.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/03_4_full.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\",\n      \"check_dataset/demo_img/03_2_side.jpg\"\n    ],\n    \"query_samples\": 125,\n    \"query_sample_paths\": [\n      \"check_dataset/demo_img/08_7_additional.jpg\",\n      \"check_dataset/demo_img/01_7_additional.jpg\",\n      \"check_dataset/demo_img/02_4_full.jpg\",\n      \"check_dataset/demo_img/04_4_full.jpg\",\n      \"check_dataset/demo_img/09_7_additional.jpg\",\n      \"check_dataset/demo_img/04_3_back.jpg\",\n      \"check_dataset/demo_img/02_1_front.jpg\",\n      \"check_dataset/demo_img/06_2_side.jpg\",\n      \"check_dataset/demo_img/02_7_additional.jpg\",\n      \"check_dataset/demo_img/02_2_side.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/Inshop_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ShiTuRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 1000; * attributes.gallery_samples: The number of gallery (or reference) samples in this dataset is 110; * attributes.query_samples: The number of query samples in this dataset is 125; * attributes.train_sample_paths: A list of relative paths to the visual images of training samples in this dataset; * attributes.gallery_sample_paths: A list of relative paths to the visual images of gallery (or reference) samples in this dataset; * attributes.query_sample_paths: A list of relative paths to the visual images of query samples in this dataset;

Additionally, the dataset verification also analyzes the number of images and image categories within the dataset, and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. The image feature task supports converting LabelMe format datasets to ShiTuRecDataset format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is null, optional value is LabelMe;

For example, if you want to convert a LabelMe format dataset to ShiTuRecDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/image_classification_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/image_classification_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/image_classification_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, the dataset will be re-split, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, the type is any integer between 0-100, and it needs to ensure that the sum of gallery_percent and query_percent values is 100;

For example, if you want to re-split the dataset with 70% training set, 20% gallery set, and 10% query set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 70\n    gallery_percent: 20\n    query_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/Inshop_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=70 \\\n    -o CheckDataset.split.gallery_percent=20 \\\n    -o CheckDataset.split.query_percent=10\n

\u2757Note: Due to the specificity of image feature model evaluation, data partitioning is meaningful only when the train, query, and gallery sets belong to the same category system. During the evaluation of recognition models, it is imperative that the gallery and query sets belong to the same category system, which may or may not be the same as the train set. If the gallery and query sets do not belong to the same category system as the train set, the evaluation after data partitioning becomes meaningless. It is recommended to proceed with caution.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the image feature model PP-ShiTuV2_rec as an example:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml\uff0cWhen training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/Inshop_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/general_recognition/PP-ShiTuV2_rec.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_image_recognition_001.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

\u2757 Note: The inference result of the recognition model is a set of vectors, which requires a retrieval module to complete image feature.

"},{"location":"en/module_usage/tutorials/cv_modules/image_feature.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image feature module can be integrated into the General Image Recognition Pipeline (comming soon) of PaddleX. Simply replace the model path to update the image feature module of the relevant pipeline. In pipeline integration, you can use service-oriented deployment to deploy your trained model.

2.Module Integration

The weights you produce can be directly integrated into the image feature module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html","title":"Image Multi-Label Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#i-overview","title":"I. Overview","text":"

The image multi-label classification module is a crucial component in computer vision systems, responsible for assigning multiple labels to input images. Unlike traditional image classification tasks that assign a single category to an image, multi-label classification tasks require assigning multiple relevant categories to an image. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The image multi-label classification module typically takes an image as input and, through deep learning or other machine learning algorithms, classifies it into multiple predefined categories based on its characteristics and content. For example, an image containing both a cat and a dog might be labeled as both \"cat\" and \"dog\" by the image multi-label classification module. These classification labels are then output for subsequent processing and analysis by other modules or systems.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(%) Model Size (M) Description CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 325.6 M CLIP_ML is an image multi-label classification model based on CLIP, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 M PP-HGNetV2_ML is an image multi-label classification model based on PP-HGNetV2, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 M PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 M PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 M PP-LCNet_ML is an image multi-label classification model based on PP-LCNet, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder. ResNet50_MLInference Model/Trained Model 83.50 108.9 M ResNet50_ML is an image multi-label classification model based on ResNet50, which significantly improves accuracy on multi-label classification tasks by incorporating an ML-Decoder.

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete multi-label classification module inference with just a few lines of code. You can switch between models in this module freely, and you can also integrate the model inference of the multi-label classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_ML\")\noutput = model.predict(\"multilabel_classification_005.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better multi-label classification models. Before using PaddleX to develop multi-label classification models, please ensure that you have installed the relevant model training plugins for image classification in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes data validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use your own private dataset for subsequent model training, please refer to the PaddleX Image Multi-Label Classification Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mlcls_nus_examples.tar -P ./dataset\ntar -xf ./dataset/mlcls_nus_examples.tar -C ./dataset/\n

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/mlcls_nus_examples/label.txt\",\n    \"num_classes\": 33,\n    \"train_samples\": 17463,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0543_4338693.jpg\",\n      \"check_dataset/demo_img/0272_347806939.jpg\",\n      \"check_dataset/demo_img/0069_2291994812.jpg\",\n      \"check_dataset/demo_img/0012_1222850604.jpg\",\n      \"check_dataset/demo_img/0238_53773041.jpg\",\n      \"check_dataset/demo_img/0373_541261977.jpg\",\n      \"check_dataset/demo_img/0567_519506868.jpg\",\n      \"check_dataset/demo_img/0023_289621557.jpg\",\n      \"check_dataset/demo_img/0581_484524659.jpg\",\n      \"check_dataset/demo_img/0325_120753036.jpg\"\n    ],\n    \"val_samples\": 17463,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0546_130758157.jpg\",\n      \"check_dataset/demo_img/0284_2230710138.jpg\",\n      \"check_dataset/demo_img/0090_1491261559.jpg\",\n      \"check_dataset/demo_img/0013_392798436.jpg\",\n      \"check_dataset/demo_img/0246_2248376356.jpg\",\n      \"check_dataset/demo_img/0377_1349296474.jpg\",\n      \"check_dataset/demo_img/0570_2457645006.jpg\",\n      \"check_dataset/demo_img/0027_309333946.jpg\",\n      \"check_dataset/demo_img/0584_132639537.jpg\",\n      \"check_dataset/demo_img/0329_206031527.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/mlcls_nus_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 33;
  • attributes.train_samples: The number of training set samples in this dataset is 17463;
  • attributes.val_samples: The number of validation set samples in this dataset is 17463;
  • attributes.train_sample_paths: A list of relative paths to the visual samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)(2) Dataset Splitting","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

The multi-label image classification supports the conversion of COCO format datasets to MLClsDataset format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Multi-label image classification supports converting COCO format datasets to MLClsDataset format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with the optional value of COCO;

For example, if you want to convert a COCO format dataset to MLClsDataset format, you need to modify the configuration file as follows:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: COCO\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=COCO\n

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

These parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the image multi-label classification model PP-LCNet_x1_0_ML as an example:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_ML.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mlcls_nus_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/multilabel_classification/PP-LCNet_x1_0_ML.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"multilabel_classification_005.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-LCNet_x1_0_ML.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/image_multilabel_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The image multi-label classification module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the image multi-label classification module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the image multi-label classification module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html","title":"Instance Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#i-overview","title":"I. Overview","text":"

The instance segmentation module is a crucial component in computer vision systems, responsible for identifying and marking pixels that contain specific object instances in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The instance segmentation module typically outputs pixel-level masks (masks) for each target instance, which are then passed as input to the object recognition module for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the instance segmentation module. You can switch models under this module freely, and you can also integrate the model inference of the instance segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"Mask-RT-DETR-L\")\noutput = model.predict(\"general_instance_segmentation_004.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better instance segmentation models. Before using PaddleX to develop instance segmentation models, please ensure that you have installed the relevant model training plugins for segmentation in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides data verification functionality for each module, and only data that passes the verification can be used for model training. Additionally, PaddleX provides demo datasets for each module, allowing you to complete subsequent development based on the officially provided demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_coco_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#412-data-verification","title":"4.1.2 Data Verification","text":"

Data verification can be completed with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 2,\n    \"train_samples\": 79,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/pexels-photo-634007.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-59576.png\"\n    ],\n    \"val_samples\": 19,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/peasant-farmer-farmer-romania-botiza-47862.jpeg\",\n      \"check_dataset/demo_img/pexels-photo-715546.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/instance_seg_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 79;
  • attributes.val_samples: The number of validation samples in this dataset is 19;
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset; Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The instance segmentation task supports converting LabelMe format to COCO format. The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Below are some example explanations for some of the parameters in the configuration file:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Set to True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. The available source format is LabelMe; For example, if you want to convert a LabelMe dataset to COCO format, you need to modify the configuration file as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/instance_seg_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/instance_seg_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml\\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, the dataset will be re-split. The default is False;
  • train_percent: If the dataset is to be re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples\n

After data splitting, the original annotation files will be renamed as xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/instance_seg_labelme_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete model training. Taking the training of the instance segmentation model Mask-RT-DETR-L as an example:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
The following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is Mask-RT-DETR-L.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify the first 2 GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters Instructions.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/instance_seg_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is Mask-RT-DETR-L.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_instance_segmentation_004.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's Mask-RT-DETR-L.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/instance_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX Pipeline or into your own project.

1.Pipeline Integration

The instance segmentation module can be integrated into the General Instance Segmentation Pipeline of PaddleX. Simply replace the model path to update the instance segmentation module of the relevant pipeline.

2.Module Integration The weights you produce can be directly integrated into the instance segmentation module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html","title":"Mainbody detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#i-overview","title":"I. Overview","text":"

Mainbody detection is a fundamental task in object detection, aiming to identify and extract the location and size of specific target objects, people, or entities from images and videos. By constructing deep neural network models, mainbody detection learns the feature representations of image subjects to achieve efficient and accurate detection.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_detInference Model/Trained Model 41.5 62.0 33.7 537.0 27.54 A mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common subjects simultaneously.

Note: The evaluation set for the above accuracy metrics is PaddleClas mainbody detection dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform mainbody detection inference with just a few lines of code. You can easily switch between models under this module, and integrate the mainbody detection model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-ShiTuV2_det\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better mainbody detection models. Before developing mainbody detection models with PaddleX, ensure you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/mainbody_det_examples.tar -P ./dataset\ntar -xf ./dataset/mainbody_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/mainbody_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 1.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 701.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 176.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Mainbody detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-ShiTuV2_det as an example:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-ShiTuV2_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/mainbody_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-ShiTuV2_det.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/mainbody_detection/PP-ShiTuV2_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PP-ShiTuV2_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/mainbody_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The main body detection module can be integrated into PaddleX pipelines such as General Object Detection (comming soon). Simply replace the model path to update the main body detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the main body detection module. You can refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html","title":"Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#i-overview","title":"I. Overview","text":"

The object detection module is a crucial component in computer vision systems, responsible for locating and marking regions containing specific objects in images or videos. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The object detection module typically outputs bounding boxes for the target regions, which are then passed as input to the object recognition module for further processing.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#ii-list-of-supported-models","title":"II. List of Supported Models","text":"ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before proceeding with quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, you can perform object detection inference with just a few lines of code. You can easily switch between models within the module and integrate the object detection inference into your projects. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PicoDet-S\")\noutput = model.predict(\"general_object_detection_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher precision from existing models, you can leverage PaddleX's custom development capabilities to develop better object detection models. Before developing object detection models with PaddleX, ensure you have installed the object detection related training plugins. For installation instructions, refer to the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, prepare the corresponding dataset for the task module. PaddleX provides a data validation feature for each module, and only datasets that pass validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Object Detection Task Module Data Annotation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset\ntar -xf ./dataset/det_coco_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Validate your dataset with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 701,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/road839.png\",\n      \"check_dataset/demo_img/road363.png\",\n      \"check_dataset/demo_img/road148.png\",\n      \"check_dataset/demo_img/road237.png\",\n      \"check_dataset/demo_img/road733.png\",\n      \"check_dataset/demo_img/road861.png\",\n      \"check_dataset/demo_img/road762.png\",\n      \"check_dataset/demo_img/road515.png\",\n      \"check_dataset/demo_img/road754.png\",\n      \"check_dataset/demo_img/road173.png\"\n    ],\n    \"val_samples\": 176,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/road218.png\",\n      \"check_dataset/demo_img/road681.png\",\n      \"check_dataset/demo_img/road138.png\",\n      \"check_dataset/demo_img/road544.png\",\n      \"check_dataset/demo_img/road596.png\",\n      \"check_dataset/demo_img/road857.png\",\n      \"check_dataset/demo_img/road203.png\",\n      \"check_dataset/demo_img/road589.png\",\n      \"check_dataset/demo_img/road655.png\",\n      \"check_dataset/demo_img/road245.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 704;
  • attributes.val_samples: The number of validation samples in this dataset is 176;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes in the dataset and generates a histogram (histogram.png) for visualization:

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_labelme_examples.tar -P ./dataset\ntar -xf ./dataset/det_labelme_examples.tar -C ./dataset/\n
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_labelme_examples \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When True, dataset splitting is performed. Default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, you need to modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n

After dataset splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the object detection model PicoDet-S as an example:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_coco_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/object_detection/PicoDet-S.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"general_object_detection_002.png\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PicoDet-S.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own project.

1.Pipeline Integration

The object detection module can be integrated into the General Object Detection Pipeline of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the object detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Pedestrian attribute recognition is a crucial component in computer vision systems, responsible for locating and labeling specific attributes of pedestrians in images or videos, such as gender, age, clothing color, and type. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The pedestrian attribute recognition module typically outputs attribute information for each pedestrian, which is then passed as input to other modules (e.g., pedestrian tracking, pedestrian re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the pedestrian attribute recognition module. You can easily switch models under this module and integrate the model inference of pedestrian attribute recognition into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_pedestrian_attribute\")\noutput = model.predict(\"pedestrian_attribute_006.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

Note: The index of the output value represents the following attributes: index 0 indicates whether a hat is worn, index 1 indicates whether glasses are worn, indexes 2-7 represent the style of the upper garment, indexes 8-13 represent the style of the lower garment, index 14 indicates whether boots are worn, indexes 15-17 represent the type of bag carried, index 18 indicates whether an object is held in front, indexes 19-21 represent age, index 22 represents gender, and indexes 23-25 represent orientation. Specifically, the attributes include the following types:

- Gender: Male, Female\n- Age: Under 18, 18-60, Over 60\n- Orientation: Front, Back, Side\n- Accessories: Glasses, Hat, None\n- Holding Object in Front: Yes, No\n- Bag: Backpack, Shoulder Bag, Handbag\n- Upper Garment Style: Striped, Logo, Plaid, Patchwork\n- Lower Garment Style: Striped, Patterned\n- Short-sleeved Shirt: Yes, No\n- Long-sleeved Shirt: Yes, No\n- Long Coat: Yes, No\n- Pants: Yes, No\n- Shorts: Yes, No\n- Skirt: Yes, No\n- Boots: Yes, No\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better pedestrian attribute recognition models. Before developing pedestrian attribute recognition with PaddleX, ensure you have installed the classification-related model training plugins for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to the PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/pedestrian_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/pedestrian_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/pedestrian_attribute_examples/label.txt\",\n    \"num_classes\": 26,\n    \"train_samples\": 1000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/020907.jpg\",\n      \"check_dataset/demo_img/004274.jpg\",\n      \"check_dataset/demo_img/009412.jpg\",\n      \"check_dataset/demo_img/026873.jpg\",\n      \"check_dataset/demo_img/030560.jpg\",\n      \"check_dataset/demo_img/022846.jpg\",\n      \"check_dataset/demo_img/009055.jpg\",\n      \"check_dataset/demo_img/015399.jpg\",\n      \"check_dataset/demo_img/006435.jpg\",\n      \"check_dataset/demo_img/055307.jpg\"\n    ],\n    \"val_samples\": 500,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/080381.jpg\",\n      \"check_dataset/demo_img/080469.jpg\",\n      \"check_dataset/demo_img/080146.jpg\",\n      \"check_dataset/demo_img/080003.jpg\",\n      \"check_dataset/demo_img/080283.jpg\",\n      \"check_dataset/demo_img/080104.jpg\",\n      \"check_dataset/demo_img/080149.jpg\",\n      \"check_dataset/demo_img/080313.jpg\",\n      \"check_dataset/demo_img/080131.jpg\",\n      \"check_dataset/demo_img/080412.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/pedestrian_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 26;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 500;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Pedestrian attribute recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command-line arguments:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Taking the training of the PP-LCNet pedestrian attribute recognition model (PP-LCNet_x1_0_pedestrian_attribute) as an example:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/pedestrian_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/pedestrian_attribute/PP-LCNet_x1_0_pedestrian_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"pedestrian_attribute_006.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_pedestrian_attribute.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" . Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/pedestrian_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The pedestrian attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the pedestrian attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the pedestrian attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html","title":"Semantic Segmentation Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#i-overview","title":"I. Overview","text":"

Semantic segmentation is a technique in computer vision that classifies each pixel in an image, dividing the image into distinct semantic regions, with each region corresponding to a specific category. This technique generates detailed segmentation maps, clearly revealing objects and their boundaries in the image, providing powerful support for image analysis and understanding.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Semantic Segmentation module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Semantic Segmentation module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LiteSeg-T\")\noutput = model.predict(\"general_semantic_segmentation_002.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Semantic Segmentation models. Before developing a Semantic Segmentation model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Semantic Segmentation Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset\ntar -xf ./dataset/seg_optic_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/P0005.jpg\",\n      \"check_dataset/demo_img/P0050.jpg\"\n    ],\n    \"train_samples\": 267,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/N0139.jpg\",\n      \"check_dataset/demo_img/P0137.jpg\"\n    ],\n    \"val_samples\": 76,\n    \"num_classes\": 2\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/seg_optic_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"SegDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 2;
  • attributes.train_samples: The number of training samples in this dataset is 267;
  • attributes.val_samples: The number of validation samples in this dataset is 76;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Semantic segmentation supports converting LabelMe format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting LabelMe format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null, and the supported source dataset format is LabelMe;

For example, if you want to convert a LabelMe format dataset, you can download a sample LabelMe format dataset as follows:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_dataset_to_convert.tar -P ./dataset\ntar -xf ./dataset/seg_dataset_to_convert.tar -C ./dataset/\n

After downloading, modify the paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_dataset_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the semantic segmentation model (PP-LiteSeg-T) as an example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/seg_optic_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-LiteSeg-T.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mIoU.
"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model\" \\\n    -o Predict.input=\"general_semantic_segmentation_002.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/cv_modules/semantic_segmentation.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document semantic segmentation module can be integrated into PaddleX pipelines such as the Semantic Segmentation Pipeline (Seg). Simply replace the model path to update the The document semantic segmentation module's model.

  1. Module Integration

The weights you produce can be directly integrated into the semantic segmentation module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html","title":"Small Object Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#i-overview","title":"I. Overview","text":"

Small object detection typically refers to accurately detecting and locating small-sized target objects in images or videos. These objects often have a small pixel size in images, typically less than 32x32 pixels (as defined by datasets like MS COCO), and may be obscured by the background or other objects, making them difficult to observe directly by the human eye. Small object detection is an important research direction in computer vision, aiming to precisely detect small objects with minimal visual features in images.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description (VisDrone) PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 52.1 57.1 1007.0 324.93 PP-YOLOE_plus small object detection model trained on VisDrone. VisDrone is a benchmark dataset specifically for unmanned aerial vehicle (UAV) visual data, which is used for small object detection due to the small size of the targets and the inherent challenges they pose. PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 42.8 65.5 324.4 77.29 PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 65.9 458.5 11172.7 340.42

Note: The evaluation set for the above accuracy metrics is VisDrone-DET dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

After installing the wheel package, you can complete the inference of the small object detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the small object detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PP-YOLOE_plus_SOD-S\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"small_object_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better small object detection models. Before using PaddleX to develop small object detection models, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/small_det_examples.tar -P ./dataset\ntar -xf ./dataset/small_det_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 1610,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/9999938_00000_d_0000352.jpg\",\n      \"check_dataset/demo_img/9999941_00000_d_0000014.jpg\",\n      \"check_dataset/demo_img/9999973_00000_d_0000043.jpg\"\n    ],\n    \"val_samples\": 548,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0000330_00801_d_0000804.jpg\",\n      \"check_dataset/demo_img/0000103_00180_d_0000026.jpg\",\n      \"check_dataset/demo_img/0000291_04001_d_0000888.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/small_det_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 10.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 1610.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 548.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Small object detection supports converting datasets in VOC and LabelMe formats to COCO format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Small object detection supports converting VOC and LabelMe format datasets to COCO format. Default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set. Default is null, with optional values VOC, LabelMe, VOCWithUnlabeled, LabelMeWithUnlabeled; For example, if you want to convert a LabelMe format dataset to COCO format, taking the following LabelMe format dataset as an example, you need to modify the configuration as follows:
......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: LabelMe\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset\n

Of course, the above parameters also support being set by appending command line arguments. Taking a LabelMe format dataset as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./path/to/your_smallobject_labelme_dataset \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=LabelMe\n

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of PP-YOLOE_plus_SOD-S as an example:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/small_det_examples \\\n    -o Train.num_classes=10\n
The steps required are:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/small_det_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PP-YOLOE_plus_SOD-S.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"small_object_detection.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-YOLOE_plus_SOD-S.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weight path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Explanation.
"},{"location":"en/module_usage/tutorials/cv_modules/small_object_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipelines or directly into your own projects.

  1. Pipeline Integration

The small object detection module can be integrated into the Small Object Detection Pipeline of PaddleX. Simply replace the model path to update the small object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the small object detection module. You can refer to the Python example code in Quick Integration, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#i-overview","title":"I. Overview","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, license plate number, etc. The performance of this module directly impacts the accuracy and efficiency of the entire computer vision system. The vehicle attribute recognition module typically outputs bounding boxes (Bounding Boxes) containing vehicle attribute information, which are then passed as input to other modules (e.g., vehicle tracking, vehicle re-identification) for subsequent processing.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the vehicle attribute recognition module. You can easily switch models under this module, and you can also integrate the model inference of the vehicle attribute recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_vehicle_attribute\")\noutput = model.predict(\"vehicle_attribute_007.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

Note: In the output, values indexed from 0-9 represent color attributes, corresponding to the following colors respectively: yellow, orange, green, gray, red, blue, white, golden, brown, black. Indices 10-18 represent vehicle type attributes, corresponding to the following vehicle types: sedan, suv, van, hatchback, mpv, pickup, bus, truck, estate.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better vehicle attribute recognition models. Before using PaddleX to develop vehicle attribute recognition models, ensure you have installed the classification-related model training plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Multi-Label Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_attribute_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_attribute_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"../../dataset/vehicle_attribute_examples/label.txt\",\n    \"num_classes\": 19,\n    \"train_samples\": 1200,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/0018_c017_00033140_0.jpg\",\n      \"check_dataset/demo_img/0010_c019_00034275_0.jpg\",\n      \"check_dataset/demo_img/0015_c019_00068660_0.jpg\",\n      \"check_dataset/demo_img/0016_c017_00049590_1.jpg\",\n      \"check_dataset/demo_img/0018_c016_00052280_0.jpg\",\n      \"check_dataset/demo_img/0023_c001_00006995_0.jpg\",\n      \"check_dataset/demo_img/0022_c004_00065910_0.jpg\",\n      \"check_dataset/demo_img/0007_c019_00048655_1.jpg\",\n      \"check_dataset/demo_img/0022_c007_00072970_0.jpg\",\n      \"check_dataset/demo_img/0022_c008_00065785_0.jpg\"\n    ],\n    \"val_samples\": 300,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/0025_c003_00054095_0.jpg\",\n      \"check_dataset/demo_img/0023_c013_00006350_1.jpg\",\n      \"check_dataset/demo_img/0024_c003_00046320_0.jpg\",\n      \"check_dataset/demo_img/0025_c005_00054795_2.jpg\",\n      \"check_dataset/demo_img/0024_c012_00041770_0.jpg\",\n      \"check_dataset/demo_img/0024_c007_00060845_1.jpg\",\n      \"check_dataset/demo_img/0023_c017_00013150_0.jpg\",\n      \"check_dataset/demo_img/0024_c014_00040410_0.jpg\",\n      \"check_dataset/demo_img/0025_c002_00050685_1.jpg\",\n      \"check_dataset/demo_img/0025_c005_00032645_0.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/vehicle_attribute_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MLClsDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 19;
  • attributes.train_samples: The number of samples in the training set of this dataset is 1200;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 300;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of the length and width of all images in the dataset and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle attribute recognition does not support dataset format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Training a model can be done with a single command, taking the training of the PP-LCNet vehicle attribute recognition model (PP-LCNet_x1_0_vehicle_attribute) as an example:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_attribute_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_vehicle_attribute.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including MultiLabelMAP;

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/vehicle_attribute/PP-LCNet_x1_0_vehicle_attribute.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_attribute_007.jpg\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-LCNet_x1_0_vehicle_attribute.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_attribute_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The vehicle attribute recognition module can be integrated into the General Image Multi-label Classification Pipeline of PaddleX. Simply replace the model path to update the vehicle attribute recognition module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

2.Module Integration

The weights you produce can be directly integrated into the vehicle attribute recognition module. Refer to the Python example code in Quick Integration and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html","title":"Vehicle Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#i-overview","title":"I. Overview","text":"

Vehicle detection is a subtask of object detection, specifically referring to the use of computer vision technology to determine the presence of vehicles in images or videos and provide specific location information for each vehicle (such as the coordinates of the bounding box). This information is of great significance for various fields such as intelligent transportation systems, autonomous driving, and video surveillance.

"},{"location":"en/module_usage/tutorials/cv_modules/vehicle_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicle 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicle 63.9 32.6 775.6 196.02 Note: The evaluation set for the above accuracy metrics is PPVehicle dataset mAP(0.5:0.95). GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision. ## III. Quick Integration > \u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the [PaddleX Local Installation Guide](../../../installation/installation.en.md) After installing the wheel package, you can complete the inference of the vehicle detection module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the vehicle detection module into your project. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
from paddlex import create_model\n\nmodel_name = \"PP-YOLOE-S_vehicle\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"vehicle_detection.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the [PaddleX Single-Model Python Script Usage Instructions](../../instructions/model_python_API.en.md). ## IV. Custom Development If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better vehicle detection models. Before using PaddleX to develop vehicle detection models, please ensure that you have installed the PaddleDetection plugin for PaddleX. The installation process can be found in the [PaddleX Local Installation Guide](../../../installation/installation.en.md). ### 4.1 Data Preparation Before model training, you need to prepare a dataset for the specific task module. PaddleX provides a data validation function for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to [PaddleX Object Detection Task Module Data Annotation Tutorial](../../../data_annotations/cv_modules/object_detection.en.md). #### 4.1.1 Demo Data Download You can download the demo dataset to a specified folder using the following commands:
cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/vehicle_coco_examples.tar -P ./dataset\ntar -xf ./dataset/vehicle_coco_examples.tar -C ./dataset/\n
#### 4.1.2 Data Validation You can complete data validation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message `Check dataset passed !`. The validation result file will be saved in `./output/check_dataset_result.json`, and related outputs will be saved in the `./output/check_dataset` directory of the current directory. The output directory includes visualized example images and histograms of sample distributions. \ud83d\udc49 Details of validation results (click to expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 500,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20011__img00001.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00005.jpg\",\n      \"check_dataset/demo_img/MVI_20011__img00009.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/MVI_20032__img00401.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00405.jpg\",\n      \"check_dataset/demo_img/MVI_20032__img00409.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/vehicle_coco_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. The explanations for other indicators are as follows:

  • attributes.num_classes\uff1aThe number of classes in this dataset is 4.
  • attributes.train_samples\uff1aThe number of samples in the training set of this dataset is 500.
  • attributes.val_samples\uff1aThe number of samples in the validation set of this dataset is 100.
  • attributes.train_sample_paths\uff1aA list of relative paths to the visualized images of samples in the training set of this dataset.
  • attributes.val_sample_paths\uff1a A list of relative paths to the visualized images of samples in the validation set of this dataset.

The dataset validation also analyzes the distribution of sample counts across all classes in the dataset and generates a histogram (histogram.png) to visualize this distribution.

#### 4.1.3 Dataset Format Conversion / Dataset Splitting (Optional) After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters. \ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Vehicle detection does not support data format conversion.

(2) Dataset Splitting

Dataset splitting parameters can be set by modifying the CheckDataset section in the configuration file. Some example parameters in the configuration file are explained below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
### 4.2 Model Training Model training can be completed with a single command, taking the training of `PP-YOLOE-S_vehicle` as an example:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
The steps required are: * Specify the `.yaml` configuration file path for the model (here it is `PP-YOLOE-S_vehicle.yaml`,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the [PaddleX Model List (CPU/GPU)](../../../support_list/models_list.en.md)) * Specify the mode as model training: `-o Global.mode=train` * Specify the training dataset path: `-o Global.dataset_dir` Other related parameters can be set by modifying the `Global` and `Train` fields in the `.yaml` configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: `-o Global.device=gpu:0,1`; to set the number of training epochs to 10: `-o Train.epochs_iters=10`. For more modifiable parameters and their detailed explanations, refer to the [PaddleX Common Configuration Parameters for Model Tasks](../../instructions/config_parameters_common.en.md). \ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
### 4.3 Model Evaluation After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/vehicle_coco_examples\n
Similar to model training, the process involves the following steps: * Specify the path to the `.yaml` configuration file for the model\uff08here it's `PP-YOLOE-S_vehicle.yaml`\uff09 * Set the mode to model evaluation: `-o Global.mode=evaluate` * Specify the path to the validation dataset: `-o Global.dataset_dir` Other related parameters can be configured by modifying the fields under `Global` and `Evaluate` in the `.yaml` configuration file. For detailed information, please refer to[PaddleX Common Configuration Parameters for Models](../../instructions/config_parameters_common.en.md)\u3002 \ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

### 4.4 Model Inference After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package. #### 4.4.1 Model Inference The model can be directly integrated into the PaddleX pipeline or into your own project. 1. Pipeline Integration The object detection module can be integrated into the [General Object Detection Pipeline](../../../pipeline_usage/tutorials/cv_pipelines/object_detection.en.md) of PaddleX. Simply replace the model path to update the object detection module of the relevant pipeline. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your trained model. 2. Module Integration The weights you produced can be directly integrated into the object detection module. You can refer to the Python example code in [Quick Integration](#\u200b\u4e09\u200b\u5feb\u901f\u200b\u96c6\u6210\u200b), simply replace the model with the path to your trained model. * To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the [demo image](https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_detection.jpg) to your local machine.
python main.py -c paddlex/configs/vehicle_detection/PP-YOLOE-S_vehicle.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"vehicle_detection.jpg\"\n
Similar to model training and evaluation, the following steps are required: * Specify the `.yaml` configuration file path of the model (here it is `PP-YOLOE-S_vehicle.yaml`) * Set the mode to model inference prediction: `-o Global.mode=predict` * Specify the model weight path: `-o Predict.model_dir=\"./output/best_model/inference\"` * Specify the input data path: `-o Predict.input=\"...\"` Other related parameters can be set by modifying the fields under `Global` and `Predict` in the `.yaml` configuration file. For details, please refer to [PaddleX Common Model Configuration File Parameter Description](../../instructions/config_parameters_common.en.md). #### 4.4.2 Model Integration The weights you produced can be directly integrated into the vehicle detection module. You can refer to the Python example code in [Quick Integration](#iii-quick-integration), simply replace the model with the path to your trained model."},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html","title":"Document Image Orientation Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#i-overview","title":"I. Overview","text":"

The document image orientation classification module is aim to distinguish the orientation of document images and correct them through post-processing. In processes such as document scanning and ID card photography, capturing devices are sometimes rotated to obtain clearer images, resulting in images with varying orientations. Standard OCR pipelines cannot effectively handle such data. By utilizing image classification technology, we can pre-judge the orientation of document or ID card images containing text regions and adjust their orientations, thereby enhancing the accuracy of OCR processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as IDs and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

Just a few lines of code can complete the inference of the document image orientation classification module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the document image orientation classification module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-LCNet_x1_0_doc_ori\")\noutput = model.predict(\"img_rot180_demo.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/demo.png\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better document image orientation classification models. Before developing a document image orientation classification model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Image Classification Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/text_image_orientation.tar -P ./dataset\ntar -xf ./dataset/text_image_orientation.tar  -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": \"..\\/..\\/text_image_orientation\\/label.txt\",\n    \"num_classes\": 4,\n    \"train_samples\": 1553,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_10351.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_3908.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_7712.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_7480.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot270_9599.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_10323.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4885.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_3939.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7153.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1747.jpg\"\n    ],\n    \"val_samples\": 2593,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/img_rot270_3190.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_10272.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot0_9930.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_918.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_2079.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_8574.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_7595.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_1751.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot180_1573.jpg\",\n      \"check_dataset\\/demo_img\\/img_rot90_4401.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/text_image_orientation\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4;
  • attributes.train_samples: The number of training samples in this dataset is 1552;
  • attributes.val_samples: The number of validation samples in this dataset is 2593;
  • attributes.train_sample_paths: A list of relative paths to visual sample images for the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visual samples in the validation set of this dataset;

Additionally, the dataset validation analyzes the sample number distribution across all classes in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Document image orientation classification does not currently support dataset format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/text_image_orientation \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the document image orientation classification model (PP-LCNet_x1_0_doc_ori) as an example:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n

You need to follow these steps:

  • Specify the path to the model's .yaml configuration file (here, PP-LCNet_x1_0_doc_ori.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train.
  • Specify the training dataset path: -o Global.dataset_dir.

Other relevant parameters can be set by modifying fields under Global and Train in the .yaml configuration file, or by appending arguments to the command line. For example, to specify the first two GPUs for training: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and detailed explanations, refer to the PaddleX General Model Configuration File Parameters.

\ud83d\udc49 More Information (click to expand)
  • During model training, PaddleX automatically saves the model weight files, defaulting to output. If you want to specify a different save path, you can set it using the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concept of dynamic graph weights and static graph weights. During model training, it produces both dynamic and static graph weights. For model inference, it defaults to using static graph weights.
  • After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which records whether the training task was completed normally, as well as the output weight metrics and related file paths.

  • train.log: Training log file, which records changes in model metrics and loss during training.
  • config.yaml: Training configuration file, which records the hyperparameter configuration for this training.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.
"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. With PaddleX, model evaluation can be done with just one command:

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/text_image_orientation\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it is PP-LCNet_x1_0_doc_ori.yaml).
  • Set the mode to model inference prediction: -o Global.mode=predict.
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/best_model/inference\".
  • Specify the input data path: -o Predict.input=\"...\". Other relevant parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Description.
\ud83d\udc49 More Information (click to expand)
  • When conducting model evaluation, it is necessary to specify the model weight file path. Each configuration file has a built-in default path for saving weights. If you need to change this path, you can simply append a command line argument to set it, for example: -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

  • After the model evaluation is completed, typically, the following outputs are generated:

  • Upon finishing the model evaluation, an evaluate_result.json file is produced, which records the results of the evaluation. Specifically, it logs whether the evaluation task was successfully completed and the evaluation metrics of the model, including Top1 Accuracy (Top1 Acc).

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/doc_text_orientation/PP-LCNet_x1_0_doc_ori.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"img_rot180_demo.jpg\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-LCNet_x1_0_doc_ori.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

1.Pipeline Integration

The document image classification module can be integrated into PaddleX pipelines such as the Document Scene Information Extraction Pipeline (PP-ChatOCRv3). Simply replace the model path to update the The document image classification module's model.

2.Module Integration

The weights you produce can be directly integrated into the document image orientation classification module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html","title":"Formula Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#i-overview","title":"I. Overview","text":"

The formula recognition module is a crucial component of OCR (Optical Character Recognition) systems, responsible for converting mathematical formulas in images into editable text or computer-readable formats. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The module typically outputs LaTeX or MathML codes of mathematical formulas, which are then passed on to the text understanding module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Normed Edit Distance BLEU Score ExpRate (%) Model Size (M) Description LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 89.7 M LaTeX-OCR is a formula recognition algorithm based on an autoregressive large model. By adopting Hybrid ViT as the backbone network and transformer as the decoder, it significantly improves the accuracy of formula recognition.

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

After installing the wheel package, a few lines of code can complete the inference of the formula recognition module. You can switch models under this module freely, and you can also integrate the model inference of the formula recognition module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"LaTeX_OCR_rec\")\noutput = model.predict(\"general_formula_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better formula recognition models. Before developing formula recognition models with PaddleX, ensure you have installed the PaddleOCR-related model training plugins for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the LaTeX-OCR Formula Recognition Project.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_latexocr_dataset_example.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_latexocr_dataset_example.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 9452,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0109284.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0217434.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0166758.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0022294.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0071799.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0017043.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0026204.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0209202.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/val_0157332.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0232582.png\"\n    ],\n    \"val_samples\": 1050,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0070221.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0157901.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0085392.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0196480.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0096180.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0136149.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0143310.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0004560.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0115191.png\",\n      \"../dataset/ocr_rec_latexocr_dataset_example/images/train_0015323.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_latexocr_dataset_example\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"LaTeXOCRDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows: * attributes.train_samples: The number of training samples in this dataset is 9452; * attributes.val_samples: The number of validation samples in this dataset is 1050; * attributes.train_sample_paths: A list of relative paths to the visualized training samples in this dataset; * attributes.val_sample_paths: A list of relative paths to the visualized validation samples in this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data verification, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

The formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format ( PKL format ). The parameters for dataset format conversion can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion. Formula recognition supports converting MSTextRecDataset format datasets to LaTeXOCRDataset format, default is True;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format needs to be set, default is MSTextRecDataset;

For example, if you want to convert a MSTextRecDataset format dataset to LaTeXOCRDataset format, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: MSTextRecDataset\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data conversion is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.convert.enable=True \\\n    -o CheckDataset.convert.src_dataset_type=MSTextRecDataset\n

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. When set to True, dataset splitting is performed, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, which is an integer between 0 and 100, and the sum with val_percent should be 100;

For example, if you want to re-split the dataset with 90% for the training set and 10% for the validation set, you need to modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support being set by appending command line arguments:

python main.py -c  paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command, taking the training of the formula recognition model LaTeX_OCR_rec as an example:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
The following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file instructions for the corresponding task module of the model PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml  \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_latexocr_dataset_example\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file, detailed instructions can be found in PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including recall1\u3001recall5\u3001mAP\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/formula_recognition/LaTeX_OCR_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_formula_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is LaTeX_OCR_rec.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/formula_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The weights you produce can be directly integrated into the formula recognition module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html","title":"Layout Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#i-overview","title":"I. Overview","text":"

The core task of structure analysis is to parse and segment the content of input document images. By identifying different elements in the image (such as text, charts, images, etc.), they are classified into predefined categories (e.g., pure text area, title area, table area, image area, list area, etc.), and the position and size of these regions in the document are determined.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Tutorial

After installing the wheel package, a few lines of code can complete the inference of the structure analysis module. You can switch models under this module freely, and you can also integrate the model inference of the structure analysis module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\n\nmodel_name = \"PicoDet-L_layout_3cls\"\n\nmodel = create_model(model_name)\noutput = model.predict(\"layout.jpg\", batch_size=1)\n\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n

For more information on using PaddleX's single-model inference API, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better structure analysis models. Before developing a structure analysis model with PaddleX, ensure you have installed PaddleX's Detection-related model training capabilities. The installation process can be found in PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development based on the official demos. If you wish to use private datasets for subsequent model training, refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_layout_examples.tar -P ./dataset\ntar -xf ./dataset/det_layout_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After executing the above command, PaddleX will validate the dataset and collect its basic information. Upon successful execution, the log will print the message Check dataset passed !. The validation result file will be saved in ./output/check_dataset_result.json, and related outputs will be saved in the ./output/check_dataset directory of the current directory. The output directory includes visualized example images and histograms of sample distributions.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 11,\n    \"train_samples\": 90,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/train_0077.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0028.jpg\",\n      \"check_dataset/demo_img/JPEGImages/train_0012.jpg\"\n    ],\n    \"val_samples\": 20,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/JPEGImages/val_0007.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0019.jpg\",\n      \"check_dataset/demo_img/JPEGImages/val_0010.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/example_data/det_layout_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

The verification results mentioned above indicate that check_pass being True means the dataset format meets the requirements. Details of other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 11;
  • attributes.train_samples: The number of training samples in this dataset is 90;
  • attributes.val_samples: The number of validation samples in this dataset is 20;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Layout detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_layout_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#42-model-training","title":"4.2 Model Training","text":"

A single command is sufficient to complete model training, taking the training of PicoDet-L_layout_3cls as an example:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
The steps required are:

  • Specify the path to the .yaml configuration file of the model (here it is PicoDet-L_layout_3cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters for Model Tasks.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation, you can complete the evaluation with a single command:

python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_layout_examples\n
Similar to model training, the process involves the following steps:

  • Specify the path to the .yaml configuration file for the model\uff08here it's PicoDet-L_layout_3cls.yaml\uff09
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be configured by modifying the fields under Global and Evaluate in the .yaml configuration file. For detailed information, please refer to PaddleX Common Configuration Parameters for Models\u3002
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model/model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be generated, which records the evaluation results, specifically whether the evaluation task was completed successfully, and the model's evaluation metrics, including AP.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#44-model-inference","title":"4.4 Model Inference","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions. In PaddleX, model inference predictions can be achieved through two methods: command line and wheel package.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • To perform inference predictions through the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/structure_analysis/PicoDet-L_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_model/inference\" \\\n    -o Predict.input=\"layout.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it is PicoDet-L_layout_3cls.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_model/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, please refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own project. To integrate, simply add the model_dir=\"/output/best_model/inference\" parameter to the create_model(model_name=model_name, kernel_option=kernel_option) function in the quick integration method from Step 3.

"},{"location":"en/module_usage/tutorials/ocr_modules/layout_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into PaddleX pipelines or into your own projects.

  1. Pipeline Integration The structure analysis module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the layout area localization module. In pipeline integration, you can use high-performance inference and service-oriented deployment to deploy your model.

  2. Module Integration The weights you produce can be directly integrated into the layout area localization module. You can refer to the Python example code in the Quick Integration section, simply replacing the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html","title":"Seal Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#i-overview","title":"I. Overview","text":"

The seal text detection module typically outputs multi-point bounding boxes around text regions, which are then passed as inputs to the distortion correction and text recognition modules for subsequent processing to identify the textual content of the seal. Recognizing seal text is an integral part of document processing and finds applications in various scenarios such as contract comparison, inventory access auditing, and invoice reimbursement verification. The seal text detection module serves as a subtask within OCR (Optical Character Recognition), responsible for locating and marking the regions containing seal text within an image. The performance of this module directly impacts the accuracy and efficiency of the entire seal text OCR system.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Hmean\uff08%\uff09 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 M The server-side seal text detection model of PP-OCRv4 boasts higher accuracy and is suitable for deployment on better-equipped servers. PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 M The mobile-side seal text detection model of PP-OCRv4, on the other hand, offers greater efficiency and is suitable for deployment on end devices.

Note: The evaluation set for the above accuracy metrics is a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Seal Text Detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Seal Text Detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_server_seal_det\")\noutput = model.predict(\"seal_text_det.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Seal Text Detection models. Before developing a Seal Text Detection model with PaddleX, ensure you have installed PaddleOCR plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Text Detection and Recognition Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_curve_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_curve_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 606,\n    \"train_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07834.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09943.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04079.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05701.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08324.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug07451.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug09562.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug08237.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug01788.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06481.png\"\n    ],\n    \"val_samples\": 152,\n    \"val_sample_paths\": [\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03724.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06456.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04029.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug03603.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug05454.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug06269.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00624.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug02818.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug00538.png\",\n      \"..\\/ocr_curve_det_dataset_examples\\/images\\/circle_Aug04935.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/ocr_curve_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 606;
  • attributes.val_samples: The number of validation samples in this dataset is 152;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset;

The dataset verification also analyzes the distribution of sample numbers across all classes and plots a histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Seal text detection does not support data format conversion.

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Seal Text Detection model (PP-OCRv4_server_seal_det) as an example:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, and static graph network structure.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_curve_det_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_server_seal_det.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX Common Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including precision, recall and Hmean.
"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"seal_text_det.png\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_server_seal_det.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/seal_text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The document Seal Text Detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text detection module of the relevant pipeline.

  1. Module Integration

The weights you produce can be directly integrated into the Seal Text Detection module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html","title":"Table Structure Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#i-overview","title":"I. Overview","text":"

Table structure recognition is a crucial component in table recognition systems, converting non-editable table images into editable table formats (e.g., HTML). The goal of table structure recognition is to identify the rows, columns, and cell positions of tables. The performance of this module directly impacts the accuracy and efficiency of the entire table recognition system. The module typically outputs HTML or LaTeX code for the table area, which is then passed to the table content recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddlePaddle Vision Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddlePaddle's Vision Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the table structure recognition module. You can easily switch models within this module and integrate the model inference into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"SLANet\")\noutput = model.predict(\"table_recognition.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better table structure recognition models. Before developing table structure recognition models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the corresponding dataset for the task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use a private dataset for model training, refer to PaddleX Table Structure Recognition Task Module Data Annotation Tutorial

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following command:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/table_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/table_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Run a single command to complete data validation:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Details of Validation Results (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 2000,\n    \"train_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_right_7384_X9UFEPKVMLALY7DDB11A.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_13708_VE2DGBD4DCQU2ITLBTEA.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_6490_14Z6ZN6G52GG4XA0K4XU.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_14236_DG96EX0EDKIIDK8P6ENG.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_19648_SV8B7X34RTYRAT2T5CPI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_7186_HODBC25HISMCSVKY0HJ9.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_5773_4K4H9OVK9X9YVHE4Y1BQ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_7760_8C62CCH5T57QUGE0NTHZ.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_15707_B1YVOU3X4NHHB6TL269O.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_5223_HLG406UK35UD5EUYC2AV.jpg\"\n    ],\n    \"val_samples\": 100,\n    \"val_sample_paths\": [\n      \"../dataset/table_rec_dataset_examples/images/border_2945_L7MSRHBZRW6Y347G39O6.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_4825_LH9WI6X104CP3VFXPSON.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/head_border_bottom_16837_79KHWU9WDM9ZQHNBGQAL.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_10107_9ENLLC29SQ6XI8WZY53E.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_16668_JIS0YFDZKTKETZIEKCKX.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_18653_J9SSKHLFTRJD4J8W17OW.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_bottom_8396_VJ3QJ3I0DP63P4JR77FE.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_9017_K2V7QBWSU2BA4R3AJSO7.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/border_top_19494_SDFMWP92NOB2OT7109FI.jpg\",\n      \"../dataset/table_rec_dataset_examples/images/no_border_288_6LK683JUCMOQ38V5BV29.jpg\"\n    ]\n  },\n  \"analysis\": {},\n  \"dataset_path\": \"./dataset/table_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"PubTabTableRecDataset\"\n}\n

In the above validation results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 2000;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 100;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Table structure recognition does not support data format conversion.

(2) Dataset Splitting

The dataset splitting parameters can be set by modifying the fields under CheckDataset in the configuration file. An example of part of the configuration file is shown below:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, ensuring the sum with val_percent equals 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n

After the data splitting is executed, the original annotation files will be renamed to xxx.bak in their original paths.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#42-model-training","title":"4.2 Model Training","text":"

A single command can complete the model training. Taking the training of the table structure recognition model SLANet as an example:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
the following steps are required:

  • Specify the path of the model's .yaml configuration file (here it is SLANet.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path of the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the fields under Global and Train in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the configuration file parameter instructions for the corresponding task module of the model PaddleX Common Model Configuration File Parameters.
\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/table_recognition/SLANet.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/table_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc ;

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"
  • Inference predictions can be performed through the command line with just one command. Before running the following code, please download the demo image to your local machine.

    python main.py -c paddlex/configs/table_recognition/SLANet.yaml  \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"table_recognition.jpg\"\n
    Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's SLANet.yaml)

  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\". Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.
"},{"location":"en/module_usage/tutorials/ocr_modules/table_structure_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

1.Pipeline Integration

The table structure recognition module can be integrated into PaddleX pipelines such as the General Table Recognition Pipeline and the Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the table structure recognition module in the relevant pipelines. For pipeline integration, you can deploy your obtained model using high-performance inference and service-oriented deployment.

2.Module Integration

The model weights you produce can be directly integrated into the table structure recognition module. Refer to the Python example code in Quick Integration , and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html","title":"Text Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#i-overview","title":"I. Overview","text":"

The text detection module is a crucial component in OCR (Optical Character Recognition) systems, responsible for locating and marking regions containing text within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text detection module typically outputs bounding boxes for text regions, which are then passed on to the text recognition module for further processing.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#ii-supported-models","title":"II. Supported Models","text":"ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide.

Just a few lines of code can complete the inference of the text detection module, allowing you to easily switch between models under this module. You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_det\")\noutput = model.predict(\"general_ocr_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek even higher accuracy from existing models, you can leverage PaddleX's custom development capabilities to develop better text detection models. Before developing text detection models with PaddleX, ensure you have installed the PaddleOCR plugin for PaddleX. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare a dataset for the specific task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_det_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_det_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After executing the above command, PaddleX will validate the dataset and gather basic information about it. Once the command runs successfully, Check dataset passed ! will be printed in the log. The validation result file is saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory in the current directory. The output directory includes sample images and histograms of sample distribution.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 200,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/train_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/train_img_289.jpg\"\n    ],\n    \"val_samples\": 50,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_det_dataset_examples/images/val_img_61.jpg\",\n      \"../dataset/ocr_det_dataset_examples/images/val_img_137.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_det_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. The explanation of other metrics is as follows:

  • attributes.train_samples: The number of training samples in the dataset is 200;
  • attributes.val_samples: The number of validation samples in the dataset is 50;
  • attributes.train_sample_paths: List of relative paths for visualizing training sample images in the dataset;
  • attributes.val_sample_paths: List of relative paths for visualizing validation sample images in the dataset;

Additionally, the dataset validation also analyzed the distribution of the length and width of all images in the dataset and plotted a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Text detection does not support data format conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Below are some example explanations for the parameters in the configuration file:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and the sum with val_percent must be 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command-line arguments:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text detection model (PP-OCRv4_mobile_det):

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_det.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Set the mode to model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration Parameters Documentation.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_det_dataset_examples\n

Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (in this case, PP-OCRv4_mobile_det.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir

Other related parameters can be set by modifying the fields under Global and Evaluate in the .yaml configuration file. For details, please refer to PaddleX General Model Configuration File Parameter Instructions.

\ud83d\udc49 More Instructions (Click to Expand)

During model evaluation, you need to specify the path to the model weight file. Each configuration file has a built-in default weight save path. If you need to change it, you can set it by adding a command line argument, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

After completing the model evaluation, an evaluate_result.json will be generated, which records the evaluation results. Specifically, it records whether the evaluation task was completed successfully and the model's evaluation metrics, including precision, recall, and hmean.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, simply use the following command. Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's PP-OCRv4_mobile_det.yaml)
  • Set the mode to model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

  • Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text detection module can be integrated into PaddleX pipelines such as the General OCR Pipeline, Table Recognition Pipeline, and PP-ChatOCRv3-doc. Simply replace the model path to update the text detection module of the relevant pipeline.

2.Module Integration

The model weights you produce can be directly integrated into the text detection module. Refer to the Python example code in Quick Integration, and simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html","title":"Text Image Unwarping Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#i-overview","title":"I. Overview","text":"

The primary purpose of Text Image Unwarping is to perform geometric transformations on images in order to correct issues such as document distortion, tilt, perspective deformation, etc., enabling more accurate recognition by subsequent text recognition modules.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link MS-SSIM \uff08%\uff09 Model Size (M) information UVDocInference Model/Trained Model 54.40 30.3 M High-precision Text Image Unwarping Model

The accuracy metrics of the above models are measured on the DocUNet benchmark dataset.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Text Image Unwarping module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Text Image Unwarping module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"UVDoc\")\noutput = model.predict(\"doc_test.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_image_unwarping.html#iv-custom-development","title":"IV. Custom Development","text":"

The current module temporarily does not support fine-tuning training and only supports inference integration. Fine-tuning training for this module is planned to be supported in the future.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html","title":"Text Recognition Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#i-overview","title":"I. Overview","text":"

The text recognition module is the core component of an OCR (Optical Character Recognition) system, responsible for extracting text information from text regions within images. The performance of this module directly impacts the accuracy and efficiency of the entire OCR system. The text recognition module typically receives bounding boxes of text regions output by the text detection module as input. Through complex image processing and deep learning algorithms, it converts the text in images into editable and searchable electronic text. The accuracy of text recognition results is crucial for subsequent applications such as information extraction and data mining.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#ii-supported-model-list","title":"II. Supported Model List","text":"ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 4 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iii-quick-integration","title":"III. Quick Integration","text":"

Before quick integration, you need to install the PaddleX wheel package. For the installation method, please refer to the PaddleX Local Installation Tutorial. After installing the wheel package, a few lines of code can complete the inference of the text recognition module. You can switch models under this module freely, and you can also integrate the model inference of the text recognition module into your project.

Before running the following code, please download the demo image to your local machine.

from paddlex import create_model\nmodel = create_model(\"PP-OCRv4_mobile_rec\")\noutput = model.predict(\"general_ocr_rec_001.png\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
For more information on using PaddleX's single-model inference APIs, please refer to the PaddleX Single-Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#iv-custom-development","title":"IV. Custom Development","text":"

If you are seeking higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better text recognition models. Before using PaddleX to develop text recognition models, please ensure that you have installed the relevant model training plugins for OCR in PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, it is necessary to prepare the corresponding dataset for each task module. PaddleX provides a data validation function for each module, and only data that passes the validation can be used for model training. Additionally, PaddleX offers Demo datasets for each module, allowing you to complete subsequent development based on the officially provided Demo data. If you wish to use a private dataset for subsequent model training, you can refer to the PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#411-download-demo-data","title":"4.1.1 Download Demo Data","text":"

You can use the following commands to download the Demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ocr_rec_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ocr_rec_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#412-data-validation","title":"4.1.2 Data Validation","text":"

A single command can complete data validation:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
After executing the above command, PaddleX will validate the dataset and summarize its basic information. If the command runs successfully, it will print Check dataset passed ! in the log. The validation results file is saved in ./output/check_dataset_result.json, and related outputs are saved in the ./output/check_dataset directory in the current directory, including visual examples of sample images and sample distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 4468,\n    \"train_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/train_word_10.png\"\n    ],\n    \"val_samples\": 2077,\n    \"val_sample_paths\": [\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_1.png\",\n      \"../dataset/ocr_rec_dataset_examples/images/val_word_10.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ocr_rec_dataset_examples\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above validation result, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 4468;
  • attributes.val_samples: The number of validation set samples in this dataset is 2077;
  • attributes.train_sample_paths: A list of relative paths to the visualized training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized validation set samples in this dataset; Additionally, the dataset validation also analyzes the distribution of character length ratios in the dataset and generates a distribution histogram (histogram.png):

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format or re-split the training/validation ratio of the dataset by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Dataset Format Conversion/Dataset Splitting Details (Click to Expand)

(1) Dataset Format Conversion

Text recognition does not currently support data conversion.

(2) Dataset Splitting

The parameters for dataset splitting can be set by modifying the CheckDataset section in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set. The type is any integer between 0-100, and it must sum up to 100 with val_percent; For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:
......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n

After data splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with a single command. Here's an example of training the PP-OCRv4 mobile text recognition model (PP-OCRv4_mobile_rec):

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
The steps required are:

  • Specify the path to the model's .yaml configuration file (here it's PP-OCRv4_mobile_rec.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU))
  • Specify the mode as model training: -o Global.mode=train
  • Specify the path to the training dataset: -o Global.dataset_dir. Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file or adjusted by appending parameters in the command line. For example, to specify training on the first 2 GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX Common Configuration File Parameters.
\ud83d\udc49 More Information (Click to Expand)
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can set it through the -o Global.output field in the configuration file.
  • PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.
  • After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, related file paths, etc.;

  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

```bash\npython main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ocr_rec_dataset_examples\n
Similar to model training, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it's PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
\ud83d\udc49 More Information (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter to set it, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After completing the model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully and the model's evaluation metrics, including acc\u3001norm_edit_dis\uff1b

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo image to your local machine.

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/best_accuracy/inference\" \\\n    -o Predict.input=\"general_ocr_rec_001.png\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path for the model (here it is PP-OCRv4_mobile_rec.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/ocr_modules/text_recognition.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipelines or into your own projects.

1.Pipeline Integration

The text recognition module can be integrated into PaddleX pipelines such as the General OCR Pipeline, General Table Recognition Pipeline, and Document Scene Information Extraction Pipeline v3 (PP-ChatOCRv3). Simply replace the model path to update the text recognition module of the relevant pipeline.

2.Module Integration

The weights you produce can be directly integrated into the text recognition module. Refer to the Quick Integration Python example code. Simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#i-overview","title":"I. Overview","text":"

Time series anomaly detection focuses on identifying abnormal points or periods in time series data that do not conform to expected patterns, trends, or periodic regularities. These anomalies can be caused by system failures, external shocks, data entry errors, or rare events, and are of great significance for timely response, risk assessment, and business decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Precision Recall F1-Score Model Size (M) Description AutoEncoder_ad_adInference Model/Trained Model 0.9898 0.9396 0.9641 72.8K AutoEncoder_ad_ad is a simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_adInference Model/Trained Model 0.9855 0.8895 0.9351 1.5MB Based on the transformer structure, optimized for anomaly detection in non-stationary time series AutoEncoder_adInference Model/Trained Model 0.9936 0.8436 0.9125 32K AutoEncoder_ad is a classic autoencoder-based, efficient, and easy-to-use time series anomaly detection model PatchTST_adInference Model/Trained Model 0.9878 0.9070 0.9457 164K PatchTST is a high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_adInference Model/Trained Model 0.9837 0.9480 0.9656 732K Through multi-period analysis, TimesNet is an adaptive and high-precision time series anomaly detection model

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For details, refer to the PaddleX Local Installation Guide

After installing the wheel package, a few lines of code can complete the inference of the time series anomaly detection module. You can switch models under this module freely, and you can also integrate the model inference of the time series anomaly detection module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"AutoEncoder_ad\")\noutput = model.predict(\"ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy from existing models, you can use PaddleX's custom development capabilities to develop better time series anomaly detection models. Before developing time series anomaly models with PaddleX, please ensure that the PaddleTS plugin is installed. The installation process can be found in the PaddleX Local Installation Guide.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to the PaddleX Time Series Anomaly Detection Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following command to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_anomaly_examples.tar -P ./dataset\ntar -xf ./dataset/ts_anomaly_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22032,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        0.0,\n        0.7326893750079723,\n        \"...\",\n        0.1382488479262673,\n        0.0\n      ]\n    ],\n    \"val_samples\": 198290,\n    \"val_table\": [\n      [\n        \"timestamp\",\n        \"feature_0\",\n        \"...\",\n        \"feature_24\",\n        \"label\"\n      ],\n      [\n        22032.0,\n        0.8604795809835284,\n        \"...\",\n        0.1428571428571428,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_anomaly_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 22032;
  • attributes.val_samples: The number of validation samples in this dataset is 198290;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset. Note: Only data that has passed validation can be used for training and evaluation.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#413-dataset-format-conversion-dataset-splitting-optional","title":"4.1.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

After completing the data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details of Format Conversion / Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time series anomaly detection supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, supporting xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to convert the dataset format, True to enable dataset format conversion, default is False;
  • src_dataset_type: If dataset format conversion is performed, time series anomaly detection only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If re-splitting the dataset, set the percentage of the validation set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with 90% training set and 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (AutoEncoder_ad) as an example:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's AutoEncoder_ad.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_anomaly_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, the following outputs are typically generated:

Upon completion of model evaluation, an evaluate_result.json file will be produced, which records the evaluation results, specifically indicating whether the evaluation task was completed successfully and the model's evaluation metrics, including f1, recall, and precision.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions through the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_ad.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's AutoEncoder_ad.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other related parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_anomaly_detection.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or directly into your own project.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Anomaly Detection. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your obtained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series anomaly detection module. Refer to the Python example code in Quick Integration, simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html","title":"Time Series Classification Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#i-overview","title":"I. Overview","text":"

Time series classification involves identifying and categorizing different patterns in time series data by analyzing trends, periodicity, seasonality, and other factors that vary over time. This technique is widely used in medical diagnosis and other fields, effectively classifying key information in time series data to provide robust support for decision-making.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link Acc(%) Model Size (M) Description TimesNet_clsInference Model/Trained Model 87.5 792K TimesNet is an adaptive and high-accuracy time series classification model through multi-period analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to PaddleX Local Installation Guide

After installing the wheel package, you can perform inference for the time series classification module with just a few lines of code. You can switch models under this module freely, and you can also integrate the model inference of the time series classification module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference APIs, refer to PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#iv-custom-development","title":"IV. Custom Development","text":"

If you aim for higher accuracy with existing models, you can leverage PaddleX's custom development capabilities to develop better time series classification models. Before using PaddleX to develop time series classification models, ensure you have installed the PaddleTS plugin. Refer to the PaddleX Local Installation Guide for the installation process.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

Before model training, you need to prepare the dataset for the corresponding task module. PaddleX provides data validation functionality for each module, and only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for subsequent model training, refer to PaddleX Time Series Classification Task Module Data Annotation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can use the following commands to download the demo dataset to a specified folder:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#412-data-validation","title":"4.1.2 Data Validation","text":"

You can complete data validation with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

\ud83d\udc49 Validation Result Details (Click to Expand)

The specific content of the validation result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.000949,\n        ...,\n        0.12107,\n        1.0,\n        0.0\n      ]\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [\n        \"Unnamed: 0\",\n        \"group_id\",\n        \"dim_0\",\n        ...,\n        \"dim_60\",\n        \"label\",\n        \"time\"\n      ],\n      [\n        0.0,\n        0.0,\n        0.004578,\n        ...,\n        0.15728,\n        1.0,\n        0.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;

Furthermore, the dataset validation also involved an analysis of the distribution of sample numbers across all categories within the dataset, and a distribution histogram (histogram.png) was generated accordingly.

Note: Only data that has passed validation can be used for training and evaluation.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#413-dataset-format-conversiondataset-splitting-optional","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

After completing data validation, you can convert the dataset format and re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

(1) Dataset Format Conversion

Time-series classification supports converting xlsx and xls format datasets to csv format.

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, supporting conversion from xlsx and xls formats to CSV format, default is False;
  • src_dataset_type: If dataset format conversion is performed, the source dataset format does not need to be set, default is null;

To enable format conversion, modify the configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.convert.enable=True\n

(2) Dataset Splitting

Parameters related to dataset validation can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to perform dataset format conversion, True to enable, default is False;
  • src_dataset_type: If dataset format conversion is performed, time-series classification only supports converting xlsx annotation files to csv, the source dataset format does not need to be set, default is null;
  • split:
  • enable: Whether to re-split the dataset, True to enable, default is False;
  • train_percent: If the dataset is re-split, the percentage of the training set needs to be set, an integer between 0-100, ensuring the sum with val_percent is 100;
  • val_percent: If the dataset is re-split, the percentage of the validation set needs to be set, an integer between 0-100, ensuring the sum with train_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters can also be set by appending command line arguments:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (TimesNet_cls) as an example:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's TimesNet_cls.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation can be done with a single command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other relevant parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, an evaluate_result.json file is produced, which records the evaluation results, specifically whether the evaluation task was completed successfully and the model's evaluation metrics, including Top-1 Accuracy and F1 score.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#44-model-inference-and-model-integration","title":"4.4 Model Inference and Model Integration","text":"

After completing model training and evaluation, you can use the trained model weights for inference prediction or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference prediction via the command line, simply use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_cls.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's TimesNet_cls.yaml - Note: This should likely be TimesNet_cls.yaml for consistency)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the model weights path: -o Predict.model_dir=\"./output/inference\"
  • Specify the input data path: -o Predict.input=\"...\" Other relevant parameters can be set by modifying the Global and Predict fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_classification.html#442-model-integration","title":"4.4.2 Model Integration","text":"

Models can be directly integrated into the PaddleX pipeline or directly into your own projects.

  1. Pipeline Integration

The time series prediction module can be integrated into PaddleX pipelines such as Time Series Classification. Simply replace the model path to update the time series prediction model. In pipeline integration, you can use service deployment to deploy your trained model.

  1. Module Integration

The weights you produce can be directly integrated into the time series classification module. Refer to the Python example code in Quick Integration (Note: This section header is in Chinese and should be translated or removed for consistency), simply replace the model with the path to your trained model.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html","title":"Time Series Forecasting Module Development Tutorial","text":""},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#i-overview","title":"I. Overview","text":"

Time series forecasting aims to predict the possible values or states at a future point in time or within a future time period by analyzing patterns, trends, periodicity, and other characteristics in historical data. This helps enterprises and organizations make more accurate decisions, optimize resource allocation, reduce risks, and seize potential market opportunities. These time series data typically originate from various sensors, economic activities, social behaviors, and other real-world application scenarios. For example, stock prices, temperature changes, website traffic, sales data, and the like are all typical examples of time series data.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#ii-supported-model-list","title":"II. Supported Model List","text":"Model NameModel Download Link mse mae Model Size (M) Introduce DLinearInference Model/Trained Model 0.382 0.394 76k Simple structure, high efficiency and easy-to-use time series prediction model NonstationaryInference Model/Trained Model 0.600 0.515 60.3M Based on the transformer structure, targeted optimization of long-term time series prediction models for non-stationary time series PatchTSTInference Model/Trained Model 0.385 0.397 2.2M High-precision long-term time series prediction model that takes into account both local patterns and global dependencies TiDEInference Model/Trained Model 0.405 0.412 34.9M High-precision model suitable for handling multivariate, long-term time series prediction problems TimesNetInference Model/Trained Model 0.417 0.431 5.2M Through multi-period analysis, TimesNet is a highly adaptable high-precision time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset, with an input sequence length of 96, and a prediction sequence length of 96 for all models except TiDE, which has a prediction sequence length of 720.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iii-quick-integration","title":"III. Quick Integration","text":"

\u2757 Before quick integration, please install the PaddleX wheel package. For detailed instructions, refer to the PaddleX Local Installation Guide

Just a few lines of code can complete the inference of the Time Series Forecasting module, allowing you to easily switch between models under this module. You can also integrate the model inference of the the Time Series Forecasting module into your project. Before running the following code, please download the demo csv to your local machine.

from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
For more information on using PaddleX's single-model inference API, refer to the PaddleX Single Model Python Script Usage Instructions.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#iv-custom-development","title":"IV. Custom Development","text":"

If you seek higher accuracy, you can leverage PaddleX's custom development capabilities to develop better Time Series Forecasting models. Before developing a Time Series Forecasting model with PaddleX, ensure you have installed PaddleClas plugin for PaddleX. The installation process can be found in the custom development section of the PaddleX Local Installation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#41-dataset-preparation","title":"4.1 Dataset Preparation","text":"

Before model training, you need to prepare a dataset for the task. PaddleX provides data validation functionality for each module. Only data that passes validation can be used for model training. Additionally, PaddleX provides demo datasets for each module, which you can use to complete subsequent development. If you wish to use private datasets for model training, refer to PaddleX Time Series Forecasting Task Module Data Preparation Tutorial.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#411-demo-data-download","title":"4.1.1 Demo Data Download","text":"

You can download the demo dataset to a specified folder using the following commands:

wget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_dataset_examples.tar -P ./dataset\ntar -xf ./dataset/ts_dataset_examples.tar -C ./dataset/\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#412-data-validation","title":"4.1.2 Data Validation","text":"

Data validation can be completed with a single command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Once the command runs successfully, a message saying Check dataset passed ! will be printed in the log. The verification results will be saved in ./output/check_dataset_result.json, and related outputs will be stored in the ./output/check_dataset directory, including visual examples of sample images and a histogram of sample distribution.

\ud83d\udc49 Verification Result Details (click to expand)

The specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 12194,\n    \"train_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2016-07-01 00:00:00\",\n        5.827000141143799,\n        2.009000062942505,\n        1.5989999771118164,\n        0.4620000123977661,\n        4.203000068664552,\n        1.3400000333786009,\n        30.5310001373291\n      ],\n      [\n        \"2016-07-01 01:00:00\",\n        5.692999839782715,\n        2.075999975204468,\n        1.4919999837875366,\n        0.4259999990463257,\n        4.142000198364259,\n        1.371000051498413,\n        27.78700065612793\n      ]\n    ],\n    \"val_samples\": 3484,\n    \"val_table\": [\n      [\n        \"date\",\n        \"HUFL\",\n        \"HULL\",\n        \"MUFL\",\n        \"MULL\",\n        \"LUFL\",\n        \"LULL\",\n        \"OT\"\n      ],\n      [\n        \"2017-11-21 02:00:00\",\n        12.994000434875488,\n        4.889999866485597,\n        10.055999755859377,\n        2.878000020980835,\n        2.559000015258789,\n        1.2489999532699585,\n        4.7129998207092285\n      ],\n      [\n        \"2017-11-21 03:00:00\",\n        11.92199993133545,\n        4.554999828338623,\n        9.097000122070312,\n        3.0920000076293945,\n        2.559000015258789,\n        1.2790000438690186,\n        4.8540000915527335\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/ts_dataset_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The verification results above indicate that check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training samples in this dataset is 12194;
  • attributes.val_samples: The number of validation samples in this dataset is 3484;
  • attributes.train_sample_paths: A list of relative paths to the top 10 rows of training samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the top 10 rows of validation samples in this dataset;
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#413-dataset-format-conversiondataset-splitting-optional-click-to-expand","title":"4.1.3 Dataset Format Conversion/Dataset Splitting (Optional) (Click to Expand)","text":"\ud83d\udc49 Details on Format Conversion/Dataset Splitting (Click to Expand)

After completing dataset verification, you can convert the dataset format or re-split the training/validation ratio by modifying the configuration file or appending hyperparameters.

(1) Dataset Format Conversion

Time Series Forecasting supports converting xlsx and xls format datasets to the required format.

Parameters related to dataset verification can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • convert:
  • enable: Whether to enable dataset format conversion, supporting xlsx and xls format conversion, default is False;
  • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set, default is null.

Modify the paddlex/configs/ts_forecast/DLinear.yaml configuration as follows:

......\nCheckDataset:\n  ......\n  convert:\n    enable: True\n    src_dataset_type: null\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert\n

Of course, the above parameters also support being set by appending command-line arguments. For a LabelMe format dataset, the command is:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_forecast_to_convert \\\n    -o CheckDataset.convert.enable=True \\\n

(2) Dataset Splitting

Parameters for dataset splitting can be set by modifying the CheckDataset fields in the configuration file. Example explanations for some parameters in the configuration file are as follows:

  • CheckDataset:
  • split:
  • enable: Whether to enable re-splitting the dataset, set to True to perform dataset splitting, default is False;
  • train_percent: If re-splitting the dataset, set the percentage of the training set, which should be an integer between 0 and 100, ensuring the sum with val_percent is 100;

For example, if you want to re-split the dataset with a 90% training set and a 10% validation set, modify the configuration file as follows:

......\nCheckDataset:\n  ......\n  split:\n    enable: True\n    train_percent: 90\n    val_percent: 10\n  ......\n

Then execute the command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

After dataset splitting, the original annotation files will be renamed to xxx.bak in the original path.

The above parameters also support setting through appending command line arguments:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml  \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples \\\n    -o CheckDataset.split.enable=True \\\n    -o CheckDataset.split.train_percent=90 \\\n    -o CheckDataset.split.val_percent=10\n
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#42-model-training","title":"4.2 Model Training","text":"

Model training can be completed with just one command. Here, we use the Time Series Forecasting model (DLinear) as an example:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

You need to follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml,When training other models, you need to specify the corresponding configuration files. The relationship between the model and configuration files can be found in the PaddleX Model List (CPU/GPU)).
  • Set the mode to model training: -o Global.mode=train
  • Specify the training dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Train fields in the .yaml configuration file, or adjusted by appending parameters in the command line. For example, to train using the first two GPUs: -o Global.device=gpu:0,1; to set the number of training epochs to 10: -o Train.epochs_iters=10. For more modifiable parameters and their detailed explanations, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)
  • During model training, PaddleX automatically saves model weight files, with the default path being output. To specify a different save path, use the -o Global.output field in the configuration file.
  • PaddleX abstracts the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced, and static graph weights are used by default for model inference.
  • After model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, including whether the training task completed successfully, produced weight metrics, and related file paths.

  • train.log: Training log file, recording model metric changes, loss changes, etc.
  • config.yaml: Training configuration file, recording the hyperparameters used for this training session.
  • best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference: Model weight-related files, including Model weight-related files, including network parameters, optimizers, and network architecture.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#43-model-evaluation","title":"4.3 Model Evaluation","text":"

After model training, you can evaluate the specified model weights on the validation set to verify model accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_dataset_examples\n

Similar to model training, follow these steps:

  • Specify the .yaml configuration file path for the model (here it's DLinear.yaml).
  • Set the mode to model evaluation: -o Global.mode=evaluate
  • Specify the validation dataset path: -o Global.dataset_dir

Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For more details, refer to the PaddleX TS Configuration Parameters Documentation.

\ud83d\udc49 More Details (Click to Expand)

When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply append the command line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

After model evaluation, the following outputs are typically produced:

  • evaluate_result.json: Records the evaluation results, specifically whether the evaluation task completed successfully and the model's evaluation metrics, including mse and mae.
"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#44-model-inference-and-integration","title":"4.4 Model Inference and Integration","text":"

After model training and evaluation, you can use the trained model weights for inference predictions or Python integration.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#441-model-inference","title":"4.4.1 Model Inference","text":"

To perform inference predictions via the command line, use the following command:

Before running the following code, please download the demo csv to your local machine.

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"ts_fc.csv\"\n

Similar to model training and evaluation, the following steps are required:

  • Specify the .yaml configuration file path of the model (here it's DLinear.yaml)

  • Set the mode to model inference prediction: -o Global.mode=predict

  • Specify the model weights path: -o Predict.model_dir=\"./output/best_accuracy/inference\"

Specify the input data path: -o Predict.inputh=\"...\" Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Common Model Configuration File Parameter Description.

Alternatively, you can use the PaddleX wheel package for inference, easily integrating the model into your own projects.

"},{"location":"en/module_usage/tutorials/time_series_modules/time_series_forecasting.html#442-model-integration","title":"4.4.2 Model Integration","text":"

The model can be directly integrated into the PaddleX pipeline or into your own projects.

  1. Pipeline Integration

The Time Series Forecasting module can be integrated into PaddleX pipelines such as the Time Series Forecasting Pipeline (ts_fc). Simply replace the model path to update the Time Series Forecasting module's model.

  1. Module Integration

The weights you produce can be directly integrated into the Time Series Forecasting module. You can refer to the Python sample code in Quick Integration and just replace the model with the path to the model you trained.

"},{"location":"en/other_devices_support/how_to_contribute_device.html","title":"1. More Device Support","text":"

The prosperity of the PaddlePaddle ecosystem is inseparable from the contributions of developers and users. We warmly welcome you to provide more device compatibility for PaddleX and greatly appreciate your feedback.

Currently, PaddleX supports Intel/Apple M series CPU, NVIDIA GPUs, XPU, Ascend NPU, Hygon DCU, and MLU. If the device you wish to support is not within the current scope, you can contribute by following the methods below.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#11-integration-device-into-paddlepaddle-backend","title":"1.1 Integration Device into PaddlePaddle Backend","text":"

The PaddlePaddle deep learning framework provides multiple integration solutions, including operator development and mapping, subgraph and whole graph integration, deep learning compiler backend integration, and open neural network format conversion. Device vendors can flexibly choose based on their chip architecture design and software stack maturity. For specific details, please refer to PaddlePaddle Custom Device Integration Solutions.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#12-support-for-paddlecv-devkits","title":"1.2 Support for PaddleCV devkits","text":"

Since PaddleX is based on the PaddlePaddle model library, after the device completes the integration into the PaddlePaddle backend, select the corresponding devkit to submit code based on the models already supported by the device to ensure that the relevant devkits are adapted to the corresponding device. Refer to the contribution guides for each devkit:

  1. PaddleClas

  2. PaddleDetection

  3. PaddleSeg

  4. PaddleOCR

  5. PaddleTS

"},{"location":"en/other_devices_support/how_to_contribute_device.html#2-updating-paddlex","title":"2. Updating PaddleX","text":"

After completing the device integration into PaddlePaddle and the PaddleCV devkits, you need to update the device recognition-related code and documentation in PaddleX.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#21-inference-support","title":"2.1 Inference Support","text":""},{"location":"en/other_devices_support/how_to_contribute_device.html#211-version-support-optional","title":"2.1.1 Version Support (Optional)","text":"

If the relevant device has specific requirements for the PaddlePaddle version, you can make judgments based on device information and version information during initialization. The relevant code is located in the _check_paddle_version function in PaddleX Initialization.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#212-setting-environment-variables-optional","title":"2.1.2 Setting Environment Variables (Optional)","text":"

If special environment variables need to be set when using the relevant device, you can modify the device environment setup code. The relevant code is located in the set_env_for_device function in PaddleX Environment Variable Settings.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#213-creating-a-predictor","title":"2.1.3 Creating a Predictor","text":"

PaddleX's inference capability is provided based on the Paddle Inference Predictor. When creating a Predictor, you need to select different device based on device information and create passes. The relevant code is located in the _create function in PaddleX Predictor Creation.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#214-updating-the-device-support-list","title":"2.1.4 Updating the Device Support List","text":"

When creating a Predictor, it will judge whether the device is already supported. The relevant code is located in the SUPPORT_DEVICE constant in PaddleX Predictor Option.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#215-updating-the-multi-devices-user-guide","title":"2.1.5 Updating the Multi-Devices User Guide","text":"

Please update the PaddleX multi-devices user guide and add the newly supported device information to the documentation. Both Chinese and English versions need to be updated. The Chinese version is PaddleX\u200b\u591a\u200b\u786c\u4ef6\u200b\u4f7f\u7528\u6307\u5357\u200b, and the English version is PaddleX Multi-Devices Usage Guide.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#216-updating-the-installation-tutorial","title":"2.1.6 Updating the Installation Tutorial","text":"

Please provide device-related installation tutorials in both Chinese and English. The Chinese version can refer to \u200b\u6607\u200b\u817e\u200b NPU \u200b\u98de\u6868\u200b\u5b89\u88c5\u200b\u6559\u7a0b\u200b, and the English version can refer to Ascend NPU PaddlePaddle Installation Tutorial.

"},{"location":"en/other_devices_support/how_to_contribute_device.html#217-updating-the-model-list","title":"2.1.7 Updating the Model List","text":"

Please provide a list of models supported by the device in both Chinese and English. The Chinese version can refer to PaddleX\u200b\u6a21\u578b\u200b\u5217\u8868\u200b\uff08\u200b\u6607\u200b\u817e\u200b NPU\uff09, and the English version can refer to PaddleX Model List (Huawei Ascend NPU).

"},{"location":"en/other_devices_support/how_to_contribute_device.html#22-training-support","title":"2.2 Training Support","text":"

TODO

"},{"location":"en/other_devices_support/how_to_contribute_device.html#3-submitting-a-pr","title":"3. Submitting a PR","text":"

When you complete the device adaptation work, please submit a Pull Request to PaddleX with relevant information. We will validate the model and merge the relevant code after confirmation.

The relevant PR needs to provide information on reproducing model accuracy, including at least the following:

  • The software versions used to validate model accuracy, including but not limited to:

  • Paddle version

  • PaddleCustomDevice version (if any)

  • The branch of PaddleX or the corresponding devkit

  • The machine environment used to validate model accuracy, including but not limited to:

  • Chip model

  • Operating system version

  • Device driver version

  • Operator library version, etc.

"},{"location":"en/other_devices_support/how_to_contribute_model.html","title":"1. Contributing Models","text":"

The prosperity of the PaddlePaddle ecosystem is inseparable from the contributions of developers and users. We warmly welcome you to contribute more models for multi-hardware compatibility to PaddlePaddle and greatly appreciate your feedback.

The current list of hardware-compatible models in PaddleX is as follows. You can check whether the relevant models have been adapted for the corresponding hardware:

  • NPU Model List

  • XPU Model List

  • DCU Model List

  • MLU Model List

The source code for current PaddleX-related models is placed in various kits, and some kits and models have not been integrated into PaddleX. Therefore, before adapting a model, please ensure that your model is already integrated into PaddleX. For the current list of PaddleX models, see PaddleX Model Library. If you have specific model requirements, please submit an issue to inform us.

If the model you are adapting involves modifications to the model networking code on the relevant hardware, please submit the code to the corresponding kit first, referring to the contribution guides for each kit:

  1. PaddleClas

  2. PaddleDetection

  3. PaddleSeg

  4. PaddleOCR

  5. PaddleTS

"},{"location":"en/other_devices_support/how_to_contribute_model.html#2-submitting-an-issue-for-explanation","title":"2. Submitting an Issue for Explanation","text":"

When you have completed the adaptation of a model on a specific hardware, please submit an issue to PaddleX explaining the relevant information. We will verify the model and, upon confirmation of no issues, merge the relevant code and update the model list in the documentation.

The relevant issue needs to provide information to reproduce the model's accuracy, including at least the following:

  • The software versions used to verify the model's accuracy, including but not limited to:

  • Paddle version

  • PaddleCustomDevice version (if applicable)

  • Branch of PaddleX or the corresponding kit

  • The machine environment used to verify the model's accuracy, including but not limited to:

  • Chip model

  • Operating system version

  • Hardware driver version

  • Operator library version, etc.

"},{"location":"en/other_devices_support/how_to_contribute_model.html#3-more-documentation","title":"3. More Documentation","text":"

For more documentation related to multi-hardware compatibility and usage in PaddlePaddle, please refer to:

  • PaddlePaddle User Guide

  • PaddlePaddle Hardware Support

  • PaddleX Multi-device Usage Guide

  • PaddleCustomDevice Repository

"},{"location":"en/other_devices_support/multi_devices_use_guide.html","title":"PaddleX Multi-Devices Usage Guide","text":"

This document focuses on the usage guide of PaddleX for Huawei Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU hardware platforms.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#1-installation","title":"1. Installation","text":""},{"location":"en/other_devices_support/multi_devices_use_guide.html#11-paddlepaddle-installation","title":"1.1 PaddlePaddle Installation","text":"

First, please complete the installation of PaddlePaddle according to your hardware platform. The installation tutorials for each hardware are as follows:

Ascend NPU: Ascend NPU PaddlePaddle Installation Guide

Cambricon MLU: Cambricon MLU PaddlePaddle Installation Guide

Kunlun XPU: Kunlun XPU PaddlePaddle Installation Guide

Hygon DCU: Hygon DCU PaddlePaddle Installation Guide

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#12-paddlex-installation","title":"1.2 PaddleX Installation","text":"

Welcome to use PaddlePaddle's low-code development tool, PaddleX. Before we officially start the local installation, please clarify your development needs and choose the appropriate installation mode based on your requirements.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. The following details the application scenarios and installation methods for these two modes.

"},{"location":"en/other_devices_support/multi_devices_use_guide.html#121-wheel-package-installation-mode","title":"1.2.1 Wheel Package Installation Mode","text":"

If your application scenario for PaddleX is model inference and integration, we recommend using the more convenient and lightweight Wheel Package Installation Mode.

After installing PaddlePaddle, you can directly execute the following commands to quickly install the PaddleX Wheel package:

pip install https://paddle-model-ecology.bj.bcebos.com/paddlex/whl/paddlex-3.0.0b1-py3-none-any.whl\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#122-plugin-installation-mode","title":"1.2.2 Plugin Installation Mode","text":"

If your application scenario for PaddleX is secondary development, we recommend using the more powerful Plugin Installation Mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration on the models supported by the plugins but also conduct more advanced operations such as model training for secondary development.

The plugins supported by PaddleX are as follows. Please determine the name(s) of the plugin(s) you need based on your development requirements:

\ud83d\udc49 Plugin and Pipeline Correspondence (Click to Expand) Pipeline Module Corresponding Plugin General Image Classification Image Classification PaddleClas General Object Detection Object Detection PaddleDetection General Semantic Segmentation Semantic Segmentation PaddleSeg General Instance Segmentation Instance Segmentation PaddleDetection General OCR Text DetectionText Recognition PaddleOCR General Table Recognition Layout Region DetectionTable Structure RecognitionText DetectionText Recognition PaddleOCRPaddleDetection Document Scene Information Extraction v3 Table Structure RecognitionLayout Region DetectionText DetectionText RecognitionSeal Text DetectionDocument Image CorrectionDocument Image Orientation Classification PaddleOCRPaddleDetectionPaddleClas Time Series Prediction Time Series Prediction Module PaddleTS Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS Time Series Classification Time Series Classification Module PaddleTS General Multi-label Classification Image Multi-label Classification PaddleClas Small Object Detection Small Object Detection PaddleDetection Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin(s) you need to install is/are PaddleXXX (can be multiple), after installing PaddlePaddle, you can directly execute the following commands to quickly install the corresponding PaddleX plugin(s):

# obtain PaddleX source code\ngit clone https://github.com/PaddlePaddle/PaddleX.git\ncd PaddleX\n\n# Install PaddleX whl\n# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel\npip install -e .\n\n# Install PaddleX Plugins\npaddlex --install PaddleXXX\n
For example, if you need to install the PaddleOCR and PaddleClas plugins, you can execute the following command:

# Install PaddleOCR and PaddleClas Plugins\npaddlex --install PaddleOCR PaddleClas\n

If you wish to install all plugins, you do not need to specify the plugin names. Simply execute the following command:

# Install All PaddleX Plugins\npaddlex --install\n

The default clone source for plugins is github.com, but it also supports gitee.com. You can specify the clone source using --platform.

For instance, if you want to install all PaddleX plugins using the gitee.com clone source, execute the following command:

# Install PaddleX Plugins using gitee.com\npaddlex --install --platform gitee.com\n

Upon successful installation, you will see the following prompt:

All packages are installed.\n
"},{"location":"en/other_devices_support/multi_devices_use_guide.html#2-usage","title":"2. Usage","text":"

The usage of PaddleX model pipeline development tool on hardware platforms such as Ascend NPU, Cambricon MLU, Kunlun XPU, and Hygon DCU is identical to that on GPU. You only need to modify the device configuration parameters according to your hardware platform. For detailed usage tutorials, please refer to PaddleX Pipeline Development Tool Local Usage Guide.

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html","title":"Hygon DCU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Haiguang Z100 series chips. Considering environmental differences, we recommend using the officially released Haiguang DCU development image by PaddlePaddle, which is pre-installed with the Haiguang DCU basic runtime library (DTK).

"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. Note that this image is only for development environments and does not include pre-compiled PaddlePaddle installation packages.

docker pull registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-dcu-dev -v `pwd`:/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  registry.baidubce.com/device/paddle-dcu:dtk23.10.1-kylinv10-gcc73-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_DCU.html#2-install-paddlepaddle-package","title":"2. Install PaddlePaddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle's official website. Note: The DCU version of PaddlePaddle framework only supports Hygon C86 architecture.

# Download and install the wheel package\npip install paddlepaddle-rocm -i https://www.paddlepaddle.org.cn/packages/nightly/dcu\n

After the installation package is installed, run the following command to verify it:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is as follows:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html","title":"Cambricon MLU Installation Tutorial for PaddlePaddle","text":"

Currently, PaddleX supports the Cambricon MLU370X8 chip. Considering environmental differences, we recommend using the Cambricon MLU development image provided by PaddlePaddle to prepare your environment.

"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is for development only and does not include a pre-compiled PaddlePaddle installation package.

# Applicable to X86 architecture, Arch64 architecture image is not provided for now\ndocker pull registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310\n

Start the container with the following command as a reference:

docker run -it --name paddle-mlu-dev -v $(pwd):/work \\\n  -w=/work --shm-size=128G --network=host --privileged  \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v /usr/bin/cnmon:/usr/bin/cnmon \\\n  registry.baidubce.com/device/paddle-mlu:ctr2.15.0-ubuntu20-gcc84-py310 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_MLU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Within the started docker container, download and install the wheel package released by PaddlePaddle. Currently, Python 3.10 wheel packages are provided. If you require other Python versions, refer to the PaddlePaddle official documentation for compilation and installation instructions.

# Download and install the wheel package\n# Note: You need to install the CPU version of PaddlePaddle first\npython -m pip install paddlepaddle==3.0.0.dev20240624 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython -m pip install paddle-custom-mlu==3.0.0.dev20240806 -i https://www.paddlepaddle.org.cn/packages/nightly/mlu/\n

Verify the installation. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 mlu.\nPaddlePaddle works well on 16 mlus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html","title":"Ascend NPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports the Ascend 910B chip (more models are under support. If you have a related need for other models, please submit an issue to inform us). The Ascend driver version is 23.0.3. Considering the differences in environments, we recommend using the Ascend development image provided by PaddlePaddle to complete the environment preparation.

"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"
  • Pull the image. This image is only for the development environment and does not contain a pre-compiled PaddlePaddle installation package. The image has CANN-8.0.T13, the Ascend operator library, installed by default.
    # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-x86_64-gcc84-py39\n# For Aarch64 architecture\ndocker pull registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-aarch64-gcc84-py39\n
  • Start the container with the following command. ASCEND_RT_VISIBLE_DEVICES specifies the visible NPU card numbers.
    docker run -it --name paddle-npu-dev -v $(pwd):/work \\\n    --privileged --network=host --shm-size=128G -w=/work \\\n    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \\\n    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\\n    -v /usr/local/dcmi:/usr/local/dcmi \\\n    -e ASCEND_RT_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" \\\n    registry.baidubce.com/device/paddle-npu:cann80T13-ubuntu20-$(uname -m)-gcc84-py39 /bin/bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_NPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python 3.9 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

  • Download and install the Python 3.9 wheel installation package
    # Note: You need to install the CPU version of PaddlePaddle first\npython3.9 -m pip install paddlepaddle==3.0.0.dev20240520 -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/\npython3.9 -m pip install paddle_custom_npu==3.0.0.dev20240719 -i https://www.paddlepaddle.org.cn/packages/nightly/npu/\n
  • After verifying that the installation package is installed, run the following command
    python -c \"import paddle; paddle.utils.run_check()\"\n
    The expected output is as follows
Running verify PaddlePaddle program ...\nPaddlePaddle works well on 1 npu.\nPaddlePaddle works well on 8 npus.\nPaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html","title":"Kunlun XPU PaddlePaddle Installation Tutorial","text":"

Currently, PaddleX supports Kunlun R200/R300 and other chips. Considering environmental differences, we recommend using the Kunlun XPU development image officially released by PaddlePaddle, which is pre-installed with the Kunlun basic runtime environment library (XRE).

"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#1-docker-environment-preparation","title":"1. Docker Environment Preparation","text":"

Pull the image. This image is only for the development environment and does not include a pre-compiled PaddlePaddle installation package.

docker pull registry.baidubce.com/device/paddle-xpu:ubuntu20-x86_64-gcc84-py310 # For X86 architecture\ndocker pull registry.baidubce.com/device/paddle-xpu:kylinv10-aarch64-gcc82-py310 # For ARM architecture\n
Refer to the following command to start the container:

docker run -it --name=xxx -m 81920M --memory-swap=81920M \\\n    --shm-size=128G --privileged --net=host \\\n    -v $(pwd):/workspace -w /workspace \\\n    registry.baidubce.com/device/paddle-xpu:$(uname -m)-py310 bash\n
"},{"location":"en/other_devices_support/paddlepaddle_install_XPU.html#2-install-paddle-package","title":"2. Install Paddle Package","text":"

Currently, Python3.10 wheel installation packages are provided. If you have a need for other Python versions, you can refer to the PaddlePaddle official documentation to compile and install them yourself.

Install the Python3.10 wheel installation package:

pip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_x86_64.whl # For X86 architecture\npip install https://paddle-whl.bj.bcebos.com/paddlex/xpu/paddlepaddle_xpu-2.6.1-cp310-cp310-linux_aarch64.whl # For ARM architecture\n

Verify the installation package. After installation, run the following command:

python -c \"import paddle; paddle.utils.run_check()\"\n

The expected output is:

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.\n
"},{"location":"en/pipeline_deploy/edge_deploy.html","title":"PaddleX Edge Deployment Demo Usage Guide","text":"
  • PaddleX Edge Deployment Demo Usage Guide
  • Installation Process and Usage
    • Environment Preparation
    • Material Preparation
    • Deployment Steps
  • Reference Materials
  • Feedback Section

This guide mainly introduces the operation method of the PaddleX edge deployment demo on the Android shell. This guide applies to 8 models across 6 modules:

Module Specific Model CPU GPU Object Detection PicoDet-S \u2705 \u2705 PicoDet-L \u2705 \u2705 Layout Area Detection PicoDet_layout_1x \u2705 \u2705 Semantic Segmentation PP-LiteSeg-T \u2705 \u2705 Image Classification PP-LCNet_x1_0 \u2705 \u2705 MobileNetV3_small_x1_0 \u2705 \u2705 Text Detection PP-OCRv4_mobile_det \u2705 Text Recognition PP-OCRv4_mobile_rec \u2705

Note - GPU refers to mapping computations to GPU execution using OpenCL to fully utilize GPU hardware computing power and improve inference performance.

"},{"location":"en/pipeline_deploy/edge_deploy.html#installation-process-and-usage","title":"Installation Process and Usage","text":""},{"location":"en/pipeline_deploy/edge_deploy.html#environment-preparation","title":"Environment Preparation","text":"
  1. Install CMake build tool locally and download the required version of NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK official website.

    Environment Requirements - CMake >= 3.10 (Minimum version not verified, recommend 3.20 and above) - Android NDK >= r17c (Minimum version not verified, recommend r20b and above)

    Tested Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Locate Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install ADB tool on your computer for debugging. ADB installation methods:

    3.1. For Mac:

    brew cask install android-platform-tools\n

    3.2. For Linux:

    # Debian-based Linux distributions\nsudo apt update\nsudo apt install -y wget adb\n\n# Red Hat-based Linux distributions\nsudo yum install adb\n

    3.3. For Windows:

    Install ADB by downloading the ADB software package from Google's Android platform: Link

    Open a terminal, connect your phone to the computer, and enter in the terminal:

     adb devices\n

    If there is an output from the device, it indicates that the installation was successful.

     List of devices attached\n 744be294    device\n
"},{"location":"en/pipeline_deploy/edge_deploy.html#material-preparation","title":"Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified unzip directory, switch to the specified unzip directory, and execute the unzip command.

    • Object Detection Survey
    • Semantic Segmentation Survey
    • Image Classification Survey
    • OCR Survey

    Below is an example of the unzip operation for object_detection. Refer to the table below for other pipelines.

    # 1. Switch to the specified unzip directory\ncd PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection\n\n# 2. Execute the unzip command\nunzip object_detection.zip\n

    Pipeline Name Unzip Directory Unzip Command Object Detection PaddleX-Lite-Deploy/object_detection/android/shell/cxx/picodet_detection unzip object_detection.zip Semantic Segmentation PaddleX-Lite-Deploy/semantic_segmentation/android/shell/cxx/semantic_segmentation unzip semantic_segmentation.zip Image Classification PaddleX-Lite-Deploy/image_classification/android/shell/cxx/image_classification unzip image_classification.zip OCR PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo unzip ocr.zip

"},{"location":"en/pipeline_deploy/edge_deploy.html#deployment-steps","title":"Deployment Steps","text":"
  1. Switch the working directory to PaddleX_Lite_Deploy/libs and run the download.sh script to download the necessary Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/assets, run the download.sh script to download the paddle_lite_opt tool optimized model, test images, label files, etc.

  3. Switch the working directory to PaddleX_Lite_Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the build.sh script to complete the compilation and execution of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/{Task_Name}/android/shell/cxx/{Demo_Name}, run the run.sh script to complete the prediction on the edge.

    Note: - {Pipeline_Name} and {Demo_Name} are placeholders. Refer to the table at the end of this section for specific values. - download.sh and run.sh support passing in model names to specify models. If not specified, the default model will be used. Refer to the Model_Name column in the table at the end of this section for currently supported models. - To use your own trained model, refer to the Model Conversion Method to obtain the .nb model, place it in the PaddleX_Lite_Deploy/{Pipeline_Name}/assets/{Model_Name} directory, where {Model_Name} is the model name, e.g., PaddleX_Lite_Deploy/object_detection/assets/PicoDet-L. - Before running the build.sh script, change the path specified by NDK_ROOT to the actual installed NDK path. - Keep ADB connected when running the build.sh script. - On Windows systems, you can use Git Bash to execute the deployment steps. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME to windows in CMakeLists.txt. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME to darwin in CMakeLists.txt.

Below is an example for object_detection. For other demos, change the directories switched in steps 2 and 3 according to the table at the end of this section.

# 1. Download the necessary Paddle Lite prediction library\ncd PaddleX_Lite_Deploy/libs\nsh download.sh\n\n# 2. Download the paddle_lite_opt tool optimized model, test images, and label files\ncd ../object_detection/assets\nsh download.sh\n# Supports passing in model names to specify the downloaded model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh download.sh PicoDet-L\n\n# 3. Complete the compilation of the executable file\ncd ../android/app/shell/cxx/picodet_detection\nsh build.sh\n\n# 4. Prediction\nsh run.sh\n# Supports passing in model names to specify the prediction model. Refer to the Model_Name column in the table at the end of this section for supported models.\n# sh run.sh PicoDet-L\n

The run results are shown below, and a result image named dog_picodet_detection_result.jpg is generated:

======= benchmark summary =======\ninput_shape(s) (NCHW): {1, 3, 320, 320}\nmodel_dir:./models/PicoDet-S/model.nb\nwarmup:1\nrepeats:10\npower_mode:1\nthread_num:0\n<b>* time info(ms) </b>*\n1st_duration:320.086\nmax_duration:277.331\nmin_duration:272.67\navg_duration:274.91\n\n====== output summary ======\ndetection, image size: 768, 576, detect object: bicycle, score: 0.905929, location: x=125, y=1\n

This section describes the deployment steps applicable to the demos listed in the following table:

Pipeline Pipeline_Name Module Demo_Name Specific Model Model_Name General Object Detection object_detection Object Detection picodet_detection PicoDet-S PicoDet-S\uff08default\uff09PicoDet-S_gpu PicoDet-L PicoDet-LPicoDet-L_gpu PicoDet_layout_1x PicoDet_layout_1xPicoDet_layout_1x_gpu General Semantic Segmentation semantic_segmentation Semantic Segmentation semantic_segmentation PP-LiteSeg-T PP-LiteSeg-T\uff08default\uff09PP-LiteSeg-T_gpu General Image Classification image_classification Image Classification image_classification PP-LCNet_x1_0 PP-LCNet_x1_0\uff08default\uff09PP-LCNet_x1_0_gpu MobileNetV3_small_x1_0 MobileNetV3_small_x1_0MobileNetV3_small_x1_0_gpu General OCR ocr Text Detection ppocr_demo PP-OCRv4_mobile_det PP-OCRv4_mobile_det Text Recognition PP-OCRv4_mobile_rec PP-OCRv4_mobile_rec

Note - Currently, there is no demo for deploying the Layout Area Detection module on the edge, so the picodet_detection demo is reused to deploy the PicoDet_layout_1x model.

"},{"location":"en/pipeline_deploy/edge_deploy.html#reference-materials","title":"Reference Materials","text":"

This guide only introduces the basic installation and usage process of the edge deployment demo. If you want to learn more detailed information, such as code introduction, code explanation, updating models, updating input and output preprocessing, updating prediction libraries, etc., please refer to the following documents:

  • Object Detection
  • Semantic Segmentation
  • Image Classification
  • OCR
"},{"location":"en/pipeline_deploy/edge_deploy.html#feedback-section","title":"Feedback Section","text":"

The edge deployment capabilities are continuously optimized. Welcome to submit issue to report problems and needs, and we will follow up promptly.

"},{"location":"en/pipeline_deploy/high_performance_inference.html","title":"PaddleX High-Performance Inference Guide","text":"

In real-world production environments, many applications have stringent standards for deployment strategy performance metrics, particularly response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins designed to deeply optimize model inference and pre/post-processing, achieving significant speedups in the end-to-end process. This document will first introduce the installation and usage of the high-performance inference plugins, followed by a list of pipelines and models currently supporting the use of these plugins.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#1-installation-and-usage-of-high-performance-inference-plugins","title":"1. Installation and Usage of High-Performance Inference Plugins","text":"

Before using the high-performance inference plugins, ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial, and have successfully run the quick inference of the pipeline using either the PaddleX pipeline command line instructions or the Python script instructions.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#11-installing-high-performance-inference-plugins","title":"1.1 Installing High-Performance Inference Plugins","text":"

Find the corresponding installation command based on your processor architecture, operating system, device type, and Python version in the table below and execute it in your deployment environment. Please replace {paddlex version number} with the actual paddlex version number, such as the current latest stable version 3.0.0b2. If you need to use the version corresponding to the development branch, replace {paddlex version number} with 0.0.0.dev0.

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU\u00a0(CUDA\u00a011.8\u00a0+\u00a0cuDNN\u00a08.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/{paddlex version number}/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • For Linux systems, execute the installation instructions using Bash.
  • When using NVIDIA GPUs, please use the installation instructions corresponding to the CUDA and cuDNN versions that match your environment. Otherwise, you will not be able to use the high-performance inference plugin properly.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/pipeline_deploy/high_performance_inference.html#12-obtaining-serial-numbers-and-activation","title":"1.2 Obtaining Serial Numbers and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Platform page, under the \"Open-source Pipeline Deployment Serial Number Inquiry and Acquisition\" section, select \"Acquire Now\" as shown in the following image:

Select the pipeline you wish to deploy and click \"Acquire\". Afterwards, you can find the acquired serial number in the \"Open-source Pipeline Deployment SDK Serial Number Management\" section at the bottom of the page:

After using the serial number to complete activation, you can utilize high-performance inference plugins. PaddleX provides both online and offline activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and enable online activation to automatically complete the process.
  • Offline Activation: Follow the instructions in the serial number management interface (click \"Offline Activation\" under \"Operations\") to obtain the device fingerprint of your machine. Bind the serial number with the device fingerprint to obtain a certificate and complete the activation. For this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI.

Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

For Linux systems, if using the high-performance inference plugin in a Docker container, please mount the host machine's /dev/disk/by-uuid and ${HOME}/.baidu/paddlex/licenses directories to the container.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate the license online, specify --update_license when using the serial number for the first time. Taking the general image classification pipeline as an example:

paddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex \\\n    --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number} \\\n    --update_license\n

For PaddleX Python API, enabling the high-performance inference plugin is similar. Still taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"image_classification\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": \"{serial_number}\"},\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\n

The inference results obtained with the high-performance inference plugin enabled are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache the relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent runs to improve initialization speed.

"},{"location":"en/pipeline_deploy/high_performance_inference.html#14-modifying-high-performance-inference-configurations","title":"1.4 Modifying High-Performance Inference Configurations","text":"

PaddleX combines model information and runtime environment information to provide default high-performance inference configurations for each model. These default configurations are carefully prepared to be applicable in several common scenarios and achieve relatively optimal performance. Therefore, users typically may not need to be concerned with the specific details of these configurations. However, due to the diversity of actual deployment environments and requirements, the default configuration may not yield ideal performance in certain scenarios and could even result in inference failures. In cases where the default configuration does not meet the requirements, users can manually adjust the configuration by modifying the Hpi field in the inference.yml file within the model directory (if this field does not exist, it needs to be added). The following are two common situations:

  • Switching inference backends:

    When the default inference backend is not available, the inference backend needs to be switched manually. Users should modify the selected_backends field (if it does not exist, it needs to be added).

    Hpi:\n  ...\n  selected_backends:\n    cpu: paddle_infer\n    gpu: onnx_runtime\n  ...\n

    Each entry should follow the format {device type}: {inference backend name}.

    The currently available inference backends are:

    • paddle_infer: The Paddle Inference engine. Supports CPU and GPU. Compared to the PaddleX quick inference, TensorRT subgraphs can be integrated to enhance inference performance on GPUs.
    • openvino: OpenVINO, a deep learning inference tool provided by Intel, optimized for model inference performance on various Intel hardware. Supports CPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • onnx_runtime: ONNX Runtime, a cross-platform, high-performance inference engine. Supports CPU and GPU. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
    • tensorrt: TensorRT, a high-performance deep learning inference library provided by NVIDIA, optimized for NVIDIA GPUs to improve speed. Supports GPU only. The high-performance inference plugin automatically converts the model to the ONNX format and uses this engine for inference.
  • Modifying dynamic shape configurations for Paddle Inference or TensorRT:

    Dynamic shape is the ability of TensorRT to defer specifying parts or all of a tensor\u2019s dimensions until runtime. If the default dynamic shape configuration does not meet requirements (e.g., the model may require input shapes beyond the default range), users need to modify the trt_dynamic_shapes or dynamic_shapes field in the inference backend configuration:

    Hpi:\n  ...\n  backend_configs:\n    # Configuration for the Paddle Inference backend\n    paddle_infer:\n      ...\n      trt_dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n    # Configuration for the TensorRT backend\n    tensorrt:\n      ...\n      dynamic_shapes:\n        x:\n          - [1, 3, 300, 300]\n          - [4, 3, 300, 300]\n          - [32, 3, 1200, 1200]\n      ...\n

    In trt_dynamic_shapes or dynamic_shapes, each input tensor requires a specified dynamic shape in the format: {input tensor name}: [{minimum shape}, [{optimal shape}], [{maximum shape}]]. For details on minimum, optimal, and maximum shapes and further information, please refer to the official TensorRT documentation.

    After completing the modifications, please delete the cache files in the model directory (shape_range_info.pbtxt and files starting with trt_serialized).

"},{"location":"en/pipeline_deploy/high_performance_inference.html#2-pipelines-and-models-supporting-high-performance-inference-plugins","title":"2. Pipelines and Models Supporting High-Performance Inference Plugins","text":"Pipeline Module Model Support List OCR Text Detection \u2705 Text Recognition \u2705 PP-ChatOCRv3 Table Recognition \u2705 Layout Detection \u2705 Text Detection \u2705 Text Recognition \u2705 Seal Text Detection \u2705 Text Image Unwarping \u2705 Document Image Orientation Classification \u2705 Table Recognition Layout Detection \u2705 Table Recognition \u2705 Text Detection \u2705 Text Recognition \u2705 Object Detection Object Detection FasterRCNN-Swin-Tiny-FPN \u274cCenterNet-DLA-34 \u274c CenterNet-ResNet50 \u274c Instance Segmentation Instance Segmentation Mask-RT-DETR-S \u274c Image Classification Image Classification \u2705 Semantic Segmentation Semantic Segmentation \u2705 Time Series Forecasting Time Series Forecasting \u274c Time Series Anomaly Detection Time Series Anomaly Forecasting \u274c Time Series Classification Time Series Classification \u274c Small Object Detection Small Object Detection \u2705 Multi-Label Image Classification Multi-Label Image Classification \u2705 Image Anomaly Detection Unsupervised Anomaly Detection \u2705 Layout Parsing Table Structure Recognition \u2705 Layout Region Analysis \u2705 Text Detection \u2705 Text Recognition \u2705 Formula Recognition \u274c Seal Text Detection \u2705 Text Image Unwarping \u2705 Document Image Orientation Classification \u2705 Formula Recognition Layout Detection \u274c Formula Recognition \u274c Seal Recognition Layout Region Analysis \u2705 Seal Text Detection \u2705 Text Recognition \u2705 Image Recognition Subject Detection \u2705 Image Feature \u2705 Pedestrian Attribute Recognition Pedestrian Detection \u274c Pedestrian Attribute Recognition \u274c Vehicle Attribute Recognition Vehicle Detection \u274c Vehicle Attribute Recognition \u274c Face Recognition Face Detection \u2705 Face Feature \u2705"},{"location":"en/pipeline_deploy/service_deploy.html","title":"PaddleX Serving Deployment Guide","text":"

Serving deployment is a common form of deployment in real-world production environments. By encapsulating inference capabilities as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost serving deployment for production lines. This document will first introduce the basic process of serving deployment using PaddleX, followed by considerations and potential operations when using the service in a production environment.

Note - Serving deployment provides services for model pipelines, not specific to individual pipeline modules.

Serving Deployment Example Diagram:

"},{"location":"en/pipeline_deploy/service_deploy.html#1-basic-process","title":"1. Basic Process","text":""},{"location":"en/pipeline_deploy/service_deploy.html#11-install-the-serving-deployment-plugin","title":"1.1 Install the Serving Deployment Plugin","text":"

Execute the following command to install the serving deployment plugin:

paddlex --install serving\n
"},{"location":"en/pipeline_deploy/service_deploy.html#12-start-the-service","title":"1.2 Start the Service","text":"

Start the service through the PaddleX CLI with the following command format:

paddlex --serve --pipeline {pipeline_name_or_path} [{other_command_line_options}]\n

Taking the General Image Classification Pipeline as an example:

paddlex --serve --pipeline image_classification\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or the path to a local pipeline configuration file. PaddleX uses this to build the pipeline and deploy it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General Image Classification Pipeline Tutorial.

Command-line options related to serving deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Defaults to cpu (If GPU is unavailable) or gpu (If GPU is available). --host Hostname or IP address bound to the server. Defaults to 0.0.0.0. --port Port number listened to by the server. Defaults to 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Activates the license online if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/pipeline_deploy/service_deploy.html#13-call-the-service","title":"1.3 Call the Service","text":"

Please refer to the \"Development Integration/Deployment\" section in the usage tutorials for each pipeline. You can find the pipeline tutorials here.

"},{"location":"en/pipeline_deploy/service_deploy.html#2-deploy-services-for-production","title":"2. Deploy Services for Production","text":"

When deploying services into production environments, the stability, efficiency, and security of the services are of paramount importance. Below are some recommendations for deploying services into production.

"},{"location":"en/pipeline_deploy/service_deploy.html#21-utilize-paddlex-high-performance-inference-plugin","title":"2.1 Utilize PaddleX high-performance inference Plugin","text":"

In scenarios where strict response time requirements are imposed on applications, the PaddleX high-performance inference Plugin can be used to accelerate model inference and pre/post-processing, thereby reducing response time and increasing throughput.

To use the PaddleX high-performance inference Plugin, please refer to the PaddleX High-Performance Inference Guide for installing the high-performance inference plugin, obtaining serial numbers, and activating the plugin. Additionally, not all pipelines, models, and environments support the use of the high-performance inference plugin. For detailed support information, please refer to the section on pipelines and models that support the high-performance inference plugin.

When starting the PaddleX pipeline service, you can specify --use_hpip along with the serial number to use the high-performance inference plugin. If you wish to perform online activation, you should also specify --update_license. Example usage:

paddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number}\n\n# If you wish to perform online activation\npaddlex --serve --pipeline image_classification --use_hpip --serial_number {serial_number} --update_license\n
"},{"location":"en/pipeline_deploy/service_deploy.html#22-consider-security","title":"2.2 Consider Security","text":"

A typical scenario involves an application accepting inputs from the network, with the PaddleX pipeline service acting as a module within the application, interacting with other modules through APIs. In this case, the position of the PaddleX pipeline service within the application is crucial. The service-oriented deployment solution provided by PaddleX focuses on efficiency and ease of use but does not perform sufficient security checks on request bodies. Malicious requests from the network, such as excessively large images or carefully crafted data, can lead to severe consequences like service crashes. Therefore, it is recommended to place the PaddleX pipeline service within the application's internal network, avoiding direct processing of external inputs, and ensuring it only processes trustworthy requests. Appropriate protective measures, such as input validation and authentication, should be added at the application's outer layer.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html","title":"Overview of PaddleX Model Pipeline Usage","text":"

If you have already experienced the pre-trained model pipeline effects in PaddleX and wish to proceed directly with model fine-tuning, you can jump to Model Selection.

The complete PaddleX model pipeline development process is illustrated in the following diagram:

PaddleX Model Pipeline Development Flowchart

graph LR\n    select_pipeline(Select Pipeline) --> online_experience[Quick Experience]\n    online_experience --> online_ok{Satisfied with Results?}\n    online_ok --No--> select_model[Select Model]\n    select_model --> model_finetune[Model Fine-tuning]\n    online_ok --Yes--> development_integration(Development Integration/Deployment)\n    model_finetune --> pipeline_test[Pipeline Testing]\n    pipeline_test --> test_ok{Satisfied with Results?}\n    test_ok --No--> select_model\n    test_ok --Yes--> development_integration

The pre-trained model pipelines provided by PaddleX allow for quick experience of effects. If the pipeline effects meet your requirements, you can directly proceed with development integration/deployment of the pre-trained model pipeline. If the effects are not as expected, you can use your private data to fine-tune the models within the pipeline until satisfactory results are achieved.

Below, let's take the task of boarding pass recognition as an example to introduce the local usage process of the PaddleX model pipeline tool. Before use, please ensure you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#1-select-pipeline","title":"1. Select Pipeline","text":"

Each pipeline in PaddleX can solve specific task scenarios such as object detection, time series prediction, semantic segmentation, etc. You need to select the pipeline for subsequent development based on the specific task. For example, for the boarding pass recognition task, the corresponding PaddleX pipeline is the General OCR Pipeline. More task-pipeline correspondences can be found in the PaddleX Models List (CPU/GPU).

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#2-quick-start","title":"2. Quick Start","text":"

Each pipeline in PaddleX integrates numerous pre-trained models. You can first experience the effects of the PaddleX pre-trained model pipeline. If the effects of the pre-trained model pipeline meet your expectations, you can proceed directly with Development Integration/Deployment. If not, optimize the pipeline effects according to the subsequent steps.

PaddleX provides three ways to quickly experience pipeline effects. You can choose the appropriate method based on your needs:

  • Online Quick Experience URL: PaddleX Pipeline List (CPU/GPU)
  • Command Line Quick Experience: PaddleX Pipeline Command Line Usage Instructions
  • Python Script Quick Experience: PaddleX Pipeline Python API Usage Instructions

To demonstrate the OCR pipeline for the boarding pass recognition task, you can quickly experience the pipeline's effect in three ways:

\ud83c\udf10 Online Experience

You can experience the effects of the universal OCR pipeline in AI Studio online. Use the official demo image provided for recognition, for example:

\ud83d\udcbb Command Line Experience

A single command can quickly experience the pipeline effects. Use the test file, and replace --input with a local path for prediction:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter description:

--pipeline: Pipeline name, which is the OCR pipeline in this case.\n--input: Local path or URL of the input image to be processed.\n--device: GPU serial number used (for example, gpu:0 means using the 0th GPU, gpu:1,2 means using the 1st and 2nd GPUs), or you can choose to use CPU (--device cpu).\n
\ud83d\udc49Click to view the running results

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [array([[ 6, 13],\n       [64, 13],\n       [64, 31],\n       [ 6, 31]], dtype=int16), array([[210,  14],\n       [238,  14],\n       ...\n       [830, 445],\n       [830, 464],\n       [338, 473]], dtype=int16)], 'dt_scores': [0.7629529090100092, 0.7717284653547034, 0.7139251666762622, 0.8057611181556994, 0.8840947658872964, 0.793295938183885, 0.8342027855884783, 0.8081378522874861, 0.8436969344212185, 0.8500845646497226, 0.7932189714842249, 0.8875924621248228, 0.8827884273639948, 0.8322404317386042, 0.8614796803023563, 0.8804252994596097, 0.9069978945305474, 0.8383917914190059, 0.8495824076580516, 0.8825556800041383, 0.852788927706737, 0.8379584696974435, 0.8633519228646618, 0.763234473595298, 0.8602154244410916, 0.9206341882426813, 0.6341425973804049, 0.8490156149797171, 0.758314821564747, 0.8757849788793592, 0.772485060565334, 0.8404023012596349, 0.8190037953773427, 0.851908529295617, 0.6126112758079643, 0.7324388418218587], 'rec_text': ['www.9', '5', 'boarding pass', 'BOARDING', 'PASS', 'cabin class', '', 'CLASS', 'SERIAL NO', 'seat number', 'SEAT NO', 'flight FLIGHT', 'date DATE', '03DEC', 'W', '035', 'MU 2379', 'departure city', 'FROM', 'boarding gate', 'GATE', 'boarding time BDT', 'destination TO', 'Fuzhou', 'Taiyuan', 'G11', 'FUZHOU', 'ID NO', 'NAME', 'ZHANGQIWEI', 'ticket number TKTNO', 'Zhang Qiwei', 'fare FARE', 'ETKT7813699238489/1', 'The boarding gate closes 10 minutes before departure', 'GATES CLOSE 10 MINUTES BEFORE DEPARTURE TIME'], 'rec_score': [0.683099627494812, 0.23417049646377563, 0.9969978928565979, 0.9945957660675049, 0.9787729382514954, 0.9983421564102173, 0.0, 0.9896272420883179, 0.9927973747253418, 0.9976049065589905, 0.9330753684043884, 0.9562691450119019, 0.9312669038772583, 0.9749765396118164, 0.9749416708946228, 0.9988260865211487, 0.9319792985916138, 0.9979889988899231, 0.9956836700439453, 0.9991750717163086, 0.9938803315162659, 0.9982991218566895, 0.9701204299926758, 0.9986245632171631, 0.9888408780097961, 0.9793729782104492, 0.9952947497367859, 0.9945247173309326, 0.9919753670692444, 0.991995632648468, 0.9937331080436707, 0.9963390827178955, 0.9954304695129395, 0.9934715628623962, 0.9974429607391357, 0.9529641270637512]}\n

The visualization result is as follows:

When executing the above command, the default OCR pipeline configuration file is loaded. If you need a custom configuration file, you can follow the steps below:

\ud83d\udc49Click to expand

Get the OCR pipeline configuration file:

paddlex --get_pipeline_config OCR\n

After execution, the OCR pipeline configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ocr.yaml, just execute:

paddlex --pipeline ./ocr.yaml --input general_ocr_002.png\n

Parameters such as --model, --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will prevail.

\ud83d\udcbb Python Script Experience

A few lines of code can quickly experience the pipeline effects:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

The following steps are executed:

  • create_pipeline() instantiates the pipeline object
  • Passes the image and calls the predict method of the pipeline object for inference prediction
  • Processes the prediction results

\u2757 The results obtained from running the Python script are the same as those from the command line method.

If the pre-trained model pipeline meets your expectations, you can proceed directly to development integration/deployment. If not, optimize the pipeline effects according to the following steps.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#3-model-selection-optional","title":"3. Model Selection (Optional)","text":"

Since a pipeline may contain one or more models, when fine-tuning models, you need to determine which model to fine-tune based on testing results. Taking the OCR pipeline for boarding pass recognition as an example, this pipeline includes a text detection model (e.g., PP-OCRv4_mobile_det) and a text recognition model (e.g., PP-OCRv4_mobile_rec). If the text positioning is inaccurate, you need to fine-tune the text detection model. If the text recognition is inaccurate, you need to fine-tune the text recognition model. If you are unsure which models are included in the pipeline, you can refer to the PaddleX Models List (CPU/GPU)

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#4-model-fine-tuning-optional","title":"4. Model Fine-tuning (Optional)","text":"

After determining the model to fine-tune, you need to train the model with your private dataset. PaddleX provides a single-model development tool that can complete model training with a single command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=your/dataset_dir\n
In addition, PaddleX provides detailed tutorials for preparing private datasets for model fine-tuning, single-model inference, and more. For details, please refer to the PaddleX Modules Tutorials

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#5-pipeline-testing-optional","title":"5. Pipeline Testing (Optional)","text":"

After fine-tuning your model with a private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n
Then, refer to the command line method or Python script method to load the modified pipeline configuration file.

If the results are satisfactory, proceed with Development Integration/Deployment. If not, return to Model Selection to continue fine-tuning other task modules until you achieve satisfactory results.

"},{"location":"en/pipeline_usage/pipeline_develop_guide.html#6-development-integration-and-deployment","title":"6. Development Integration and Deployment","text":"

If the pre-trained pipeline meets your requirements for inference speed and accuracy, you can proceed directly to development integration/deployment.

If you need to apply the pipeline directly in your Python project, you can refer to the PaddleX Pipeline Python Script Usage Guide and the Python example code in the Quick Start section.

In addition, PaddleX also provides three other deployment methods, with detailed instructions as follows:

\ud83d\ude80 high-performance inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

\u2757 PaddleX provides detailed usage instructions for each pipeline. You can choose according to your needs. Here are all the pipelines and their corresponding detailed instructions:

Pipeline Name Detailed Description PP-ChatOCR-doc v3 PP-ChatOCR-doc v3 Pipeline Usage Tutorial Image Classification Image Classification Pipeline Usage Tutorial Object Detection Object Detection Pipeline Usage Tutorial Instance Segmentation Instance Segmentation Pipeline Usage Tutorial Semantic Segmentation Semantic Segmentation Pipeline Usage Tutorial Image Multi-label Classification Image Multi-label Classification Pipeline Usage Tutorial Small Object Detection Small Object Detection Pipeline Usage Tutorial Image Anomaly Detection Image Anomaly Detection Pipeline Usage Tutorial OCR OCR Pipeline Usage Tutorial Table Recognition Table Recognition Pipeline Usage Tutorial Layout Parsing Layout Parsing Pipeline Usage Tutorial Formula Recognition Formula Recognition Pipeline Usage Tutorial Seal Recognition Seal Recognition Pipeline Usage Tutorial Time Series Forecasting Time Series Forecasting Pipeline Usage Tutorial Time Series Anomaly Detection Time Series Anomaly Detection Pipeline Usage Tutorial Time Series Classification Time Series Classification Pipeline Usage Tutorial"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html","title":"PaddleX Pipeline CLI Usage Instructions","text":"

Before using the CLI command line for rapid inference of the pipeline, please ensure that you have completed the installation of PaddleX according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#i-usage-example","title":"I. Usage Example","text":""},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#1-quick-experience","title":"1. Quick Experience","text":"

Taking the image classification pipeline as an example, the usage is as follows:

paddlex --pipeline image_classification \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --device gpu:0 \\\n        --save_path ./output/\n
This single step completes the inference prediction and saves the prediction results. Explanations for the relevant parameters are as follows:

  • pipeline: The name of the pipeline or the local path to the pipeline configuration file, such as the pipeline name \"image_classification\", or the path to the pipeline configuration file \"path/to/image_classification.yaml\";
  • input: The path to the data file to be predicted, supporting local file paths, local directories containing data files to be predicted, and file URL links;
  • device: Used to set the model inference device. If set for GPU, you can specify the card number, such as \"cpu\", \"gpu:2\". When not specified, if GPU is available, it will be used; otherwise, CPU will be used;
  • save_path: The save path for prediction results. When not specified, the prediction results will not be saved;
"},{"location":"en/pipeline_usage/instructions/pipeline_CLI_usage.html#2-custom-pipeline-configuration","title":"2. Custom Pipeline Configuration","text":"

If you need to modify the pipeline configuration, you can retrieve the configuration file and modify it. Still taking the image classification pipeline as an example, the way to retrieve the configuration file is as follows:

paddlex --get_pipeline_config image_classification\n\n# Please enter the path that you want to save the pipeline config file: (default `./`)\n./configs/\n\n# The pipeline config has been saved to: configs/image_classification.yaml\n

After modifying the production line configuration file configs/image_classification.yaml, such as the content for the image classification configuration file:

Global:\n  pipeline_name: image_classification\n  input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\n\nPipeline:\n  model: PP-LCNet_x0_5\n  batch_size: 1\n  device: \"gpu:0\"\n

Once the modification is completed, you can use this configuration file to perform model pipeline inference prediction as follows:

paddlex --pipeline configs/image_classification.yaml \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg \\\n        --save_path ./output/\n\n# {'input_path': '/root/.paddlex/predict_input/general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': array([0.62817, 0.03729, 0.03262, 0.03247, 0.03196]), 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html","title":"PaddleX Model Pipeline Python Usage Instructions","text":"

Before using Python scripts for rapid inference on model pipelines, please ensure you have installed PaddleX following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#i-usage-example","title":"I. Usage Example","text":"

Taking the image classification pipeline as an example, the usage is as follows:

from paddlex import create_pipeline\npipeline = create_pipeline(\"image_classification\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/res.json\")\n
In short, there are only three steps:

  • Call the create_pipeline() method to instantiate the prediction model pipeline object;
  • Call the predict() method of the prediction model pipeline object for inference;
  • Call print(), save_to_xxx() and other related methods to visualize or save the prediction results.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#ii-api-description","title":"II. API Description","text":""},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#1-instantiate-the-prediction-model-pipeline-object-by-calling-create_pipeline","title":"1. Instantiate the Prediction Model Pipeline Object by Calling create_pipeline()","text":"
  • create_pipeline: Instantiates the prediction model pipeline object;
  • Parameters:
    • pipeline_name: str type, the pipeline name or the local pipeline configuration file path, such as \"image_classification\", \"/path/to/image_classification.yaml\";
    • device: str type, used to set the model inference device, such as \"cpu\" or \"gpu:2\" for GPU settings;
    • pp_option: PaddlePredictorOption type, used to set the model inference backend;
  • Return Value: BasePredictor type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#2-perform-inference-by-calling-the-predict-method-of-the-prediction-model-pipeline-object","title":"2. Perform Inference by Calling the predict() Method of the Prediction Model Pipeline Object","text":"
  • predict: Uses the defined prediction model pipeline to predict input data;
  • Parameters:
    • input: Any type, supporting str representing the path of the file to be predicted, or a directory containing files to be predicted, or a network URL; for CV tasks, supports numpy.ndarray representing image data; for TS tasks, supports pandas.DataFrame type data; also supports lists of the above types;
  • Return Value: generator, returns the prediction result of one sample per call;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results","title":"3. Visualize the Prediction Results","text":"

The prediction results of the model pipeline support access, visualization, and saving, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes","title":"Attributes:","text":"
  • str: str type representation of the prediction result;
  • Return Value: str type, string representation of the prediction result;
  • json: Prediction result in JSON format;
  • Return Value: dict type;
  • img: Visualization image of the prediction result;
  • Return Value: PIL.Image type;
  • html: HTML representation of the prediction result;
  • Return Value: str type;
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#3-visualize-the-prediction-results_1","title":"3. Visualize the Prediction Results","text":"

The prediction results support to be accessed, visualized, and saved, which can be achieved through corresponding attributes or methods, specifically as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_1","title":"Attributes:","text":"
  • str: Representation of the prediction result in str type;
  • Returns: A str type, the string representation of the prediction result.
  • json: The prediction result in JSON format;
  • Returns: A dict type.
  • img: The visualization image of the prediction result;
  • Returns: A PIL.Image type.
  • html: The HTML representation of the prediction result;
  • Returns: A str type.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods","title":"Methods:","text":"
  • print(): Outputs the prediction result. Note that when the prediction result is not convenient for direct output, relevant content will be omitted;
  • Parameters:
    • json_format: bool type, default is False, indicating that json formatting is not used;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_json(): Saves the prediction result as a JSON file. Note that when the prediction result contains data that cannot be serialized in JSON, automatic format conversion will be performed to achieve serialization and saving;
  • Parameters:
    • save_path: str type, the path to save the result;
    • indent: int type, default is 4, valid when json_format is True, indicating the indentation level for json formatting;
    • ensure_ascii: bool type, default is False, valid when json_format is True;
  • Return Value: None;
  • save_to_img(): Visualizes the prediction result and saves it as an image;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_csv(): Saves the prediction result as a CSV file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_html(): Saves the prediction result as an HTML file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
  • save_to_xlsx(): Saves the prediction result as an XLSX file;
  • Parameters:
    • save_path: str type, the path to save the result.
  • Returns: None.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#4-inference-backend-configuration","title":"4. Inference Backend Configuration","text":"

PaddleX supports configuring the inference backend through PaddlePredictorOption. Relevant APIs are as follows:

"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#attributes_2","title":"Attributes:","text":"
  • device: Inference device;
  • Supports setting the device type and card number represented by str. Device types include 'gpu', 'cpu', 'npu', 'xpu', 'mlu'. When using an accelerator card, you can specify the card number, e.g., 'gpu:0' for GPU 0. The default is 'gpu:0';
  • Return value: str type, the currently set inference device.
  • run_mode: Inference backend;
  • Supports setting the inference backend as a str type, options include 'paddle', 'trt_fp32', 'trt_fp16', 'trt_int8', 'mkldnn', 'mkldnn_bf16'. 'mkldnn' is only selectable when the inference device is 'cpu'. The default is 'paddle';
  • Return value: str type, the currently set inference backend.
  • cpu_threads: Number of CPU threads for the acceleration library, only valid when the inference device is 'cpu';
  • Supports setting an int type for the number of CPU threads for the acceleration library during CPU inference;
  • Return value: int type, the currently set number of threads for the acceleration library.
"},{"location":"en/pipeline_usage/instructions/pipeline_python_API.html#methods_1","title":"Methods:","text":"
  • get_support_run_mode: Get supported inference backend configurations;
  • Parameters: None;
  • Return value: List type, the available inference backend configurations.
  • get_support_device: Get supported device types for running;
  • Parameters: None;
  • Return value: List type, the available device types.
  • get_device: Get the currently set device;
  • Parameters: None;
  • Return value: str type. ```
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html","title":"Face Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#1-introduction-to-the-face-recognition-pipeline","title":"1. Introduction to the Face Recognition Pipeline","text":"

Face recognition is a crucial component in the field of computer vision, aiming to automatically identify individuals by analyzing and comparing facial features. This task involves not only detecting faces in images but also extracting and matching facial features to find corresponding identity information in a database. Face recognition is widely used in security authentication, surveillance systems, social media, smart devices, and other scenarios.

The face recognition pipeline is an end-to-end system dedicated to solving face detection and recognition tasks. It can quickly and accurately locate face regions in images, extract facial features, and retrieve and compare them with pre-established features in a feature database to confirm identity information.

The face recognition pipeline includes a face detection module and a face feature module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model size, choose models with smaller storage requirements.

Face Detection Module:

ModelModel Download Link AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time Model Size (M) Description BlazeFaceInference Model/Trained Model 77.7/73.4/49.5 0.447 A lightweight and efficient face detection model BlazeFace-FPN-SSHInference Model/Trained Model 83.2/80.5/60.5 0.606 Improved BlazeFace with FPN and SSH structures PicoDet_LCNet_x2_5_faceInference Model/Trained Model 93.7/90.7/68.1 28.9 Face detection model based on PicoDet_LCNet_x2_5 PP-YOLOE_plus-S_faceInference Model/Trained Model 93.9/91.8/79.8 26.5 Face detection model based on PP-YOLOE_plus-S

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640x640. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Face Recognition Module:

ModelModel Download Link Output Feature Dimension AP (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time Model Size (M) Description MobileFaceNetInference Model/Trained Model 128 96.28/96.71/99.58 4.1 Face recognition model trained on MS1Mv3 based on MobileFaceNet ResNet50_faceInference Model/Trained Model 512 98.12/98.56/99.77 87.2 Face recognition model trained on MS1Mv3 based on ResNet50

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can experience the effects of the face recognition pipeline online or locally using command-line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Oneline Experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the facial recognition pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Command line experience is not supported at the moment.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

Please download the test image for testing. In the example of running this pipeline, you need to pre-build a facial feature library. You can refer to the following instructions to download the official demo data to be used for subsequent construction of the facial feature library. You can use the following command to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/face_demo_gallery.tar\ntar -xf ./face_demo_gallery.tar\n

If you wish to build a facial feature library using a private dataset, please refer to Section 2.3: Data Organization for Building a Feature Library. Afterward, you can complete the establishment of the facial feature library and quickly perform inference with the facial recognition pipeline using just a few lines of code.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\n\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a face recognition pipeline object. The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the build_index method of the face recognition pipeline object to build the facial feature library. The specific parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset, with data organization referring to Section 2.3: Data Organization for Building a Feature Library str None index_dir The save path for the feature library. After successfully calling the build_index method, two files will be generated in this path: \"id_map.pkl\" saves the mapping relationship between image IDs and image feature labels; \"vector.index\" stores the feature vectors of each image. str None

(3) Call the predict method of the face recognition pipeline object for inference prediction: The predict method parameter is x, used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory containing the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(4) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(5) Process the prediction results: The prediction result for each sample is of type dict, and it supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: Boolean, whether to format the output with JSON indentation, default is True; - indent: Integer, JSON formatting setting, effective only when format_json is True, default is 4; - ensure_ascii: Boolean, JSON formatting setting, effective only when format_json is True, default is False; save_to_json Save results as a JSON file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name; - indent: Integer, JSON formatting setting, default is 4; - ensure_ascii: Boolean, JSON formatting setting, default is False; save_to_img Save results as an image file - save_path: String, file path for saving; if it's a directory, the saved file name matches the input file name;

If you have obtained the configuration file, you can customize various settings of the facial recognition pipeline by simply modifying the pipeline parameter value in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/face_recognition.yaml, you just need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/face_recognition.yaml\")\npipeline.build_index(data_root=\"face_demo_gallery\", index_dir=\"face_gallery_index\")\noutput = pipeline.predict(\"friends1.jpg\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#223-adding-and-deleting-operations-in-the-face-feature-library","title":"2.2.3 Adding and Deleting Operations in the Face Feature Library","text":"

If you wish to add more face images to the feature library, you can call the add_index method; to delete face image features, you can call the delete_index method.

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"face_recognition\")\n\npipeline.add_index(data_root=\"add_gallery\", index_dir=\"face_gallery_index\")\n\npipeline.delete_index(data_root=\"delete_gallery\", index_dir=\"face_gallery_index\")\n

The add_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be added. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library to which features are added. After successfully calling the add_index method, the face image features in data_root will be added to the face feature library originally saved at index_dir. str None

The delete_index method parameters are described as follows:

Parameter Description Type Default data_root The root directory of the dataset to be deleted. The data organization method is the same as when building the feature library. Refer to Section 2.3 Data Organization for Feature Library Construction. str None index_dir The save path of the feature library from which features are deleted. After successfully calling the delete_index method, the face image features in data_root will be deleted from the face feature library originally saved at index_dir. str None"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#23-data-organization-for-feature-library-construction","title":"2.3 Data Organization for Feature Library Construction","text":"

The face recognition pipeline example in PaddleX requires a pre-constructed feature library for face feature retrieval. If you wish to build a face feature library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u251c\u2500\u2500 ID0           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502   \u251c\u2500\u2500 xxx.jpg   # Image, nested directories are supported\n\u2502   \u2502       ...\n\u2502   \u251c\u2500\u2500 ID1           # Identity ID name, preferably meaningful, such as a person's name\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the face image to be retrieved and the image feature label, separated by a space. Example content: images/Chandler/Chandler00037.jpg Chandler\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/face_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the face recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the face recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is successfully processed, the response status code is 200, and the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result attribute of type object, which stores the operation result information.

  • When the request is not successfully processed, the attributes of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • infer

Obtain OCR results for an image.

POST /ocr

  • The attributes of the request body are as follows:
Name Type Meaning Required image string The URL of an accessible image file or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The attributes of```markdown

Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image to Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64 encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    // Encode the local image to Base64\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    // Call the API\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    // Process the response data\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outputImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outputImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n\n
``````markdown # Tutorial on Artificial Intelligence and Computer Vision This tutorial, intended for numerous developers, covers the basics and applications of AI and Computer Vision. Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\"; // Service URL\n        String imagePath = \"./demo.jpg\"; // Local image path\n        String outputImagePath = \"./out.jpg\"; // Output image path\n\n        // Encode the local image to Base64\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData); // Base64-encoded file content or image URL\n\n        // Create an OkHttpClient instance\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        // Call the API and process the response\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    // Encode the local image to Base64\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData} // Base64-encoded file content or image URL\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    // Call the API\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    // Process the response\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }```markdown\n# An English Tutorial on Artificial Intelligence and Computer Vision\n\nThis tutorial document is intended for numerous developers and covers content related to artificial intelligence and computer vision.\n\n<details>\n<summary>C#</summary>\n\n```csharp\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\nstatic readonly string API_URL = \"http://localhost:8080/ocr\";\nstatic readonly string imagePath = \"./demo.jpg\";\nstatic readonly string outputImagePath = \"./out.jpg\";\n\nstatic async Task Main(string[] args)\n{\nvar httpClient = new HttpClient();\n\n// Encode the local image to Base64\nbyte[] imageBytes = File.ReadAllBytes(imagePath);\nstring image_data = Convert.ToBase64String(imageBytes);\n\nvar payload = new JObject{ { \"image\", image_data } }; // Base64 encoded file content or image URL\nvar content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n// Call the API\nHttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\nresponse.EnsureSuccessStatusCode();\n\n// Process the API response\nstring responseBody = await response.Content.ReadAsStringAsync();\nJObject jsonResponse = JObject.Parse(responseBody);\n\nstring base64Image = jsonResponse[\"result\"][\"image\"].ToString();\nbyte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\nFile.WriteAllBytes(outputImagePath, outputImageBytes);\nConsole.WriteLine($\"Output image saved at {outputImagePath}\");\nConsole.WriteLine(\"\\nDetected texts:\");\nConsole.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n}\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr';\nconst imagePath = './demo.jpg';\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)  // Base64 encoded file content or image URL\n  })\n};\n\n// Encode the local image to Base64\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\n// Call the API\naxios.request(config)\n.then((response) => {\n    // Process the API response\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP ```php $image_data); // Base64 encoded file content or image URL // Call the API $ch = curl_init($API_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process the API response $result = json_decode($response, true)[\"result\"]; file_put_contents($output ``` \ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the [PaddleX Edge Deployment Guide](../../../pipeline_deploy/edge_deploy.en.md). You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration. ## 4. Custom Development If the default model weights provided by the Face Recognition Pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the pipeline in your scenario. ### 4.1 Model Fine-tuning Since the Face Recognition Pipeline consists of two modules (face detection and face recognition), the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If you find that many faces are not detected during the analysis, it may indicate deficiencies in the face detection model. In this case, you need to refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_detection.en.md#IV.-Custom-Development) section in the [Face Detection Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_detection.en.md) and use your private dataset to fine-tune the face detection model. If matching errors occur in detected faces, it suggests that the face feature model needs further improvement. You should refer to the [Custom Development](../../../module_usage/tutorials/cv_modules/face_feature.en.md#IV.-Custom-Development) section in the [Face Feature Module Development Tutorial](../../../module_usage/tutorials/cv_modules/face_feature.en.md) to fine-tune the face feature model. ### 4.2 Model Application After completing fine-tuning training with your private dataset, you will obtain local model weight files. To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights with the corresponding paths in the pipeline configuration file: ```bash ...... Pipeline: device: \"gpu:0\" det_model: \"BlazeFace\" # Can be modified to the local path of the fine-tuned face detection model rec_model: \"MobileFaceNet\" # Can be modified to the local path of the fine-tuned face recognition model det_batch_size: 1 rec_batch_size: 1 device: gpu ...... ``` Subsequently, refer to the command-line method or Python script method in [2.2 Local Experience](#22-Local-Experience) to load the modified pipeline configuration file. Note: Currently, setting separate `batch_size` for face detection and face recognition models is not supported. ## 5. Multi-hardware Support PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the `--device` parameter allows seamless switching between different hardware. For example, when running the face recognition pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the `device` in the script to `npu`: ```python from paddlex import create_pipeline pipeline = create_pipeline( pipeline=\"face_recognition\", device=\"npu:0\" # gpu:0 --> npu:0 ) ``` If you want to use the face recognition pipeline on more types of hardware, please refer to the [PaddleX Multi-device Usage Guide](../../../other_devices_support/multi_devices_use_guide.en.md)."},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html","title":"General Image Recognition Pipeline Usage Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#1-introduction-to-the-general-image-recognition-pipeline","title":"1. Introduction to the General Image Recognition Pipeline","text":"

The General Image Recognition Pipeline aims to solve the problem of open-domain object localization and recognition. Currently, PaddleX's General Image Recognition Pipeline supports PP-ShiTuV2.

PP-ShiTuV2 is a practical general image recognition system mainly composed of three modules: mainbody detection module, image feature module, and vector retrieval module. The system integrates and improves various strategies in multiple aspects, including backbone network, loss function, data augmentation, learning rate scheduling, regularization, pre-trained model, and model pruning and quantization. It optimizes each module and ultimately achieves better performance in multiple application scenarios.

The General Image Recognition Pipeline includes the mainbody detection module and the image feature module, with several models to choose. You can select the model to use based on the benchmark data below. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Object Detection Module:

Model mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_det 41.5 62.0 33.7 537.0 27.54 An mainbody detection model based on PicoDet_LCNet_x2_5, which may detect multiple common objects simultaneously.

Note: The above accuracy metrics are based on the private mainbody detection dataset.

Image Feature Module:

Model Recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2 is a general image feature system consisting of three modules: mainbody detection, feature extraction, and vector retrieval. These models are part of the feature extraction module, and different models can be selected based on system requirements. PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G

Note: The above accuracy metrics are based on AliProducts Recall@1. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can be quickly experienced. You can use Python to experience locally.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General Image Recognition Pipeline locally, please ensure you have installed the PaddleX wheel package according to the PaddleX Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

The pipeline does not support command line experience at this time.

By default, the built-in General Image Recognition Pipeline configuration file is used. If you want to change it, you can run the following command to obtain:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config PP-ShiTuV2\n

After execution, the General Image Recognition Pipeline configuration file will be saved in the current directory. If you want to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ShiTuV2 --save_path ./my_path\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"
  • In the example of using this pipeline, a feature vector library needs to be built beforehand. You can download the officially provided drink recognition test dataset drink_dataset_v2.0 to build the feature vector library. If you want to use a private dataset, you can refer to Section 2.3 Data Organization for Building the Feature Library. After that, you can quickly build the feature vector library and predict using the General Image Recognition Pipeline with just a few lines of code.
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"PP-ShiTuV2\")\n\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\", index_dir=\"index_dir\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n\n````\n\nIn the above Python script, the following steps are executed:\n\n(1) Call the `create_pipeline` function to create a general image recognition pipeline object. The specific parameter descriptions are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>pipeline</code></td>\n<td>The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, <code>index_dir</code> needs to be specified in <code>predict()</code>.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>device</code></td>\n<td>The inference device for the pipeline model. Supports: \"gpu\", \"cpu\".</td>\n<td><code>str</code></td>\n<td><code>gpu</code></td>\n</tr>\n<tr>\n<td><code>use_hpip</code></td>\n<td>Whether to enable high-performance inference, which is only available when the pipeline supports it.</td>\n<td><code>bool</code></td>\n<td><code>False</code></td>\n</tr>\n</tbody>\n</table>\n\n(2) Call the `build_index` function of the general image recognition pipeline object to build the feature vector library. The specific parameters are described as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Parameter Description</th>\n<th>Parameter Type</th>\n<th>Default Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>data_root</code></td>\n<td>The root directory of the dataset. The data organization method refers to <a href=\"#2.3-Data-Organization-for-Building-the-Feature-Library\">Section 2.3 Data Organization for Building the Feature Library</a></td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n<tr>\n<td><code>index_dir</code></td>\n<td>The save path for the feature library. After successfully calling the <code>build_index</code> function, two files will be generated in this path: <code>\"id_map.pkl\"</code> saves the mapping relationship between image IDs and image feature labels; <code>\"vector.index\"</code> stores the feature vectors of each image.</td>\n<td><code>str</code></td>\n<td>None</td>\n</tr>\n</tbody>\n</table>\n\n(3) Call the `predict` function of the general image recognition pipeline object for inference prediction: The `predict` function parameter is `input`, which is used to input the data to be predicted, supporting multiple input methods. Specific examples are as follows:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Python Var</td>\n<td>Supports directly passing in Python variables, such as <code>numpy.ndarray</code> representing image data.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the file path of the data to be predicted, such as the local path of an image file: <code>/root/data/img.jpg</code>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: <a href=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/yuanqisenlin.jpeg\">Example</a>.</td>\n</tr>\n<tr>\n<td>str</td>\n<td>Supports passing in a local directory that contains the data files to be predicted, such as the local path: <code>/root/data/</code>.</td>\n</tr>\n<tr>\n<td>dict</td>\n<td>Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: <code>{\"img\": \"/root/data1\"}</code>.</td>\n</tr>\n<tr>\n<td>list</td>\n<td>Supports passing in a list, where the elements of the list need to be the above types of data, such as <code>[numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]</code>, <code>[\"/root/data1\", \"/root/data2\"]</code>, <code>[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]</code>.</td>\n</tr>\n</tbody>\n</table>\n\nAdditionally, the `predict` method supports the `index_dir` parameter for setting the retrieval database:\n\n<table>\n<thead>\n<tr>\n<th>Parameter Type</th>\n<th>Parameter Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>index_dir</code></td>\n<td>The directory where the retrieval database files used for pipeline inference are located. If this parameter is not passed, the default retrieval database specified through the <code>index_dir</code> parameter in <code>create_pipeline()</code> will be used.</td>\n</tr>\n</tbody>\n</table>\n\n(4) Obtain the prediction results by calling the `predict` method: The `predict` method is a `generator`, so prediction results need to be obtained by iteration. The `predict` method predicts data in batches.\n\n(5) Process the prediction results: The prediction result for each sample is of `dict` type and supports printing or saving to a file. The supported save types are related to the specific pipeline, such as:\n\n<table>\n<thead>\n<tr>\n<th>Method</th>\n<th>Description</th>\n<th>Method Parameters</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>print</td>\n<td>Print the results to the terminal</td>\n<td><code>- format_json</code>: bool type, whether to use json indentation formatting for the output content, default is True;<br><code>- indent</code>: int type, json formatting setting, only effective when format_json is True, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, only effective when format_json is True, default is False;</td>\n</tr>\n<tr>\n<td>save_to_json</td>\n<td>Save the results as a json-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;<br><code>- indent</code>: int type, json formatting setting, default is 4;<br><code>- ensure_ascii</code>: bool type, json formatting setting, default is False;</td>\n</tr>\n<tr>\n<td>save_to_img</td>\n<td>Save the results as an image-formatted file</td>\n<td><code>- save_path</code>: str type, the save file path. When it is a directory, the saved file naming is consistent with the input file type naming;</td>\n</tr>\n</tbody>\n</table>\n\nIf you have a configuration file, you can customize the configurations for the general image recognition pipeline by modifying the `pipeline` parameter value in the `create_pipeline` method to the path of the pipeline configuration file.\n\nFor example, if your configuration file is saved at `./my_path/PP-ShiTuV2.yaml`, you only need to execute:\n\n```python\nfrom paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/PP-ShiTuV2.yaml\", index_dir=\"index_dir\")\n\noutput = pipeline.predict(\"./drink_dataset_v2.0/test_images/\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#223-add-or-remove-features-from-the-feature-library","title":"2.2.3 Add or Remove Features from the Feature Library","text":"

If you want to add more images to the feature library, you can call the append_index function; to remove image features, you can call the remove_index function.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\"PP-ShiTuV2\")\npipeline.build_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.append_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\npipeline.remove_index(data_root=\"drink_dataset_v2.0/\", index_dir=\"index_dir\", index_type=\"IVF\")\n

The parameter descriptions for the above methods are as follows:

Parameter Description Type Default Value data_root The root directory of the dataset to be added. The data organization should be the same as when building the feature library, refer to Section 2.3 Data Organization for Building the Feature Library str None index_dir The storage directory for the feature library. In append_index and remove_index, it is also the path of the feature library to be modified (or deleted). str None index_type Supports HNSW32, IVF, Flat. Among them, HNSW32 has faster retrieval speed and higher accuracy but does not support the remove_index() operation; IVF has faster retrieval speed but relatively lower accuracy, and supports append_index() and remove_index() operations; Flat has lower retrieval speed but higher accuracy, and supports append_index() and remove_index() operations. str HNSW32 metric_type Supports: IP, Inner Product; L2, Euclidean Distance. str IP"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#23-data-organization-for-building-the-feature-library","title":"2.3 Data Organization for Building the Feature Library","text":"

The PaddleX general image recognition pipeline requires a pre-built feature library for feature retrieval. If you want to build a feature vector library with private data, you need to organize the data as follows:

data_root             # Root directory of the dataset, the directory name can be changed\n\u251c\u2500\u2500 images            # Directory for saving images, the directory name can be changed\n\u2502   \u2502   ...\n\u2514\u2500\u2500 gallery.txt       # Annotation file for the feature library dataset, the file name cannot be changed. Each line gives the path of the image to be retrieved and the image label, separated by a space, for example: \u201c0/0.jpg label\u201d\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Meaning errorCode integer Error code. Fixed to 0. errorMsg string Error description. Fixed to \"Success\".

The response body may also have a result property, which is an object type that stores operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Meaning errorCode integer Error code. Same as the response status code. errorMsg string Error description.

The main operations provided by the service are as follows:

  • buildIndex

Build feature vector index.

POST /shitu-index-build

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning indexKey string The key corresponding to the index, used to identify the established index. Can be used as input for other operations. idMap object Mapping from vector ID to label.
  • addImagesToIndex

Add images (corresponding feature vectors) to the index.

POST /shitu-index-add

  • The properties of the request body are as follows:
Name Type Meaning Required imageLabelPairs array Image-label pairs for building the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes

Each element in imageLabelPairs is an object with the following properties:

Name Type Meaning image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. label string Label.
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • removeImagesFromIndex

Remove images (corresponding feature vectors) from the index.

POST /shitu-index-remove

  • The properties of the request body are as follows:
Name Type Meaning Required ids array IDs of the vectors to be removed from the index. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning idMap object Mapping from vector ID to label.
  • infer

Perform image recognition.

POST /shitu-infer

  • The properties of the request body are as follows:
Name Type Meaning Required image string The URL of an image file accessible by the service, or the Base64 encoding result of the image file content. Yes indexKey string The key corresponding to the index. Provided by the buildIndex operation. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Meaning detectedObjects array Information of the detected targets. image string Recognition result image. The image is in JPEG format, encoded with Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Meaning bbox array Target location. The elements in the array are the x-coordinate of the upper-left corner, the y-coordinate of the upper-left corner, the x-coordinate of the lower-right corner, and the y-coordinate of the lower-right corner, respectively. recResults array Recognition results. score number Detection score.

Each element in recResults is an object with the following properties:

Name Type Meaning label string Label. score number Recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\n\nbase_image_label_pairs = [\n    {\"image\": \"./demo0.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo1.jpg\", \"label\": \"\u200b\u5154\u5b50\u200b\"},\n    {\"image\": \"./demo2.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nimage_label_pairs_to_add = [\n    {\"image\": \"./demo3.jpg\", \"label\": \"\u200b\u5c0f\u72d7\u200b\"},\n]\nids_to_remove = [1]\ninfer_image_path = \"./demo4.jpg\"\noutput_image_path = \"./out.jpg\"\n\nfor pair in base_image_label_pairs:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": base_image_label_pairs}\nresp_index_build = requests.post(f\"{API_BASE_URL}/shitu-index-build\", json=payload)\nif resp_index_build.status_code != 200:\n    print(f\"Request to shitu-index-build failed with status code {resp_index_build}.\")\n    pprint.pp(resp_index_build.json())\n    sys.exit(1)\nresult_index_build = resp_index_build.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_build['idMap'])}\")\n\nfor pair in image_label_pairs_to_add:\n    with open(pair[\"image\"], \"rb\") as file:\n        image_bytes = file.read()\n        image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n    pair[\"image\"] = image_data\n\npayload = {\"imageLabelPairs\": image_label_pairs_to_add, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_add = requests.post(f\"{API_BASE_URL}/shitu-index-add\", json=payload)\nif resp_index_add.status_code != 200:\n    print(f\"Request to shitu-index-add failed with status code {resp_index_add}.\")\n    pprint.pp(resp_index_add.json())\n    sys.exit(1)\nresult_index_add = resp_index_add.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_add['idMap'])}\")\n\npayload = {\"ids\": ids_to_remove, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_index_remove = requests.post(f\"{API_BASE_URL}/shitu-index-remove\", json=payload)\nif resp_index_remove.status_code != 200:\n    print(f\"Request to shitu-index-remove failed with status code {resp_index_remove}.\")\n    pprint.pp(resp_index_remove.json())\n    sys.exit(1)\nresult_index_remove = resp_index_remove.json()[\"result\"]\nprint(f\"Number of images indexed: {len(result_index_remove['idMap'])}\")\n\nwith open(infer_image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data, \"indexKey\": result_index_build[\"indexKey\"]}\nresp_infer = requests.post(f\"{API_BASE_URL}/shitu-infer\", json=payload)\nif resp_infer.status_code != 200:\n    print(f\"Request to shitu-infer failed with status code {resp_infer}.\")\n    pprint.pp(resp_infer.json())\n    sys.exit(1)\nresult_infer = resp_infer.json()[\"result\"]\n\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result_infer[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\npprint.pp(result_infer[\"detectedObjects\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Image Recognition Pipeline do not meet your expectations in terms of precision or speed. You can further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-Tuning","text":"

Since the General Image Recognition Pipeline consists of two modules (the mainbody detection module and the image feature module), the suboptimal performance of the pipeline may stem from either module.

You can analyze images with poor recognition results. After analysising, if you find that many mainbody objects are not detected, it may indicate deficiencies in the mainbody detection model. You need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the mainbody detection model. If there are mismatches in the detected mainbody objects, it suggests that the image feature model requires further improvement. You should refer to the Custom Development section in the Image Feature Module Development Tutorial and fine-tune the image feature model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After you complete the fine-tuning training with your private dataset, you will obtain local model files.

To use the fine-tuned model, you only need to modify the pipeline configuration file by replacing with the paths to your fine-tuned model:

Pipeline:\n  device: \"gpu:0\"\n  det_model: \"./PP-ShiTuV2_det_infer/\"        # Can be modified to the local path of the fine-tuned mainbody detection model\n  rec_model: \"./PP-ShiTuV2_rec_infer/\"        # Can be modified to the local path of the fine-tuned image feature model\n  det_batch_size: 1\n  rec_batch_size: 1\n  device: gpu\n
Subsequently, refer to the command-line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply by modifying the --device parameter, seamless switching between different hardware can be achieved.

For example, when running the General Image Recognition Pipeline using Python and changing the running device from an NVIDIA GPU to an Ascend NPU, you only need to modify the device in the script to npu:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ShiTuV2\",\n    device=\"npu:0\" # gpu:0 --> npu:0\n)\n

If you want to use the General Image Recognition Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html","title":"Image Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#1-introduction-to-image-anomaly-detection-pipeline","title":"1. Introduction to Image Anomaly Detection Pipeline","text":"

Image anomaly detection is an image processing technique that identifies unusual or non-conforming patterns within images through analysis. It is widely applied in industrial quality inspection, medical image analysis, and security monitoring. By leveraging machine learning and deep learning algorithms, image anomaly detection can automatically recognize potential defects, anomalies, or abnormal behaviors in images, enabling us to promptly identify issues and take corresponding actions. The image anomaly detection system is designed to automatically detect and mark anomalies in images, enhancing work efficiency and accuracy.

The image anomaly detection pipeline includes an unsupervised anomaly detection module, with the following model benchmarks:

Model NameModel Download Link Avg (%) Model Size (M) STFPMInference Model/Trained Model 96.2 21.5 M

Note: The above accuracy metrics are the average anomaly scores on the MVTec AD validation set. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the anomaly detection pipeline, allowing for quick experience of its effects. You can use the command line or Python to experience the image anomaly detection pipeline locally.

Before using the image anomaly detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config anomaly_detection\n

After execution, the image anomaly detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config anomaly_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./anomaly_detection.yaml, simply execute:

paddlex --pipeline ./anomaly_detection.yaml --input uad_grid.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'uad_grid.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference using the pipeline. Taking the image anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"anomaly_detection\")\n\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n    res.save_to_json(\"./output/\")\n

The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the pipeline object for inference prediction: The predict method takes x as its parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path to the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/anomaly_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/anomaly_detection.yaml\")\noutput = pipeline.predict(\"uad_grid.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs anomaly detection on images.

POST /image-anomaly-detection

  • Request body properties:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order), where 255 represents an anomaly point, and 0 represents a non-anomaly point. size array Image shape. The elements in the array are the height and width of the image in order. image string Anomaly detection result image. The image is in JPEG format and encoded in Base64.

Example of result:

{\n\"labelMap\": [\n0,\n0,\n255,\n0\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-anomaly-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-anomaly-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-anomaly-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-anomaly-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-anomaly-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-anomaly-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the image anomaly detection pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the image anomaly detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the image anomaly detection pipeline includes an unsupervised image anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Unsupervised Anomaly Detection Module Tutorial and use your private dataset to fine-tune the image anomaly detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding position in the pipeline configuration file:

......\nPipeline:\n  model: STFPM   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the image anomaly detection pipeline, the Python command is:

paddlex --pipeline anomaly_detection --input uad_grid.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline anomaly_detection --input uad_grid.png --device npu:0\n
If you want to use the image anomaly detection pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html","title":"General Image Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#1-introduction-to-the-general-image-classification-pipeline","title":"1. Introduction to the General Image Classification Pipeline","text":"

Image classification is a technique that assigns images to predefined categories. It is widely applied in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification.

The General Image Classification Pipeline includes an image classification module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Top1 Acc(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

\u2757 The above list features the 9 core models that the image classification module primarily supports. In total, this module supports 80 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description CLIP_vit_base_patch16_224Inference Model/Trained Model 85.36 13.1957 285.493 306.5 M CLIP is an image classification model based on the correlation between vision and language. It adopts contrastive learning and pre-training methods to achieve unsupervised or weakly supervised image classification, especially suitable for large-scale datasets. By mapping images and texts into the same representation space, the model learns general features, exhibiting good generalization ability and interpretability. With relatively good training errors, it performs well in many downstream tasks. CLIP_vit_large_patch14_224Inference Model/Trained Model 88.1 51.1284 1131.28 1.04 G ConvNeXt_base_224Inference Model/Trained Model 83.84 12.8473 1513.87 313.9 M The ConvNeXt series of models were proposed by Meta in 2022, based on the CNN architecture. This series of models builds upon ResNet, incorporating the advantages of SwinTransformer, including training strategies and network structure optimization ideas, to improve the pure CNN architecture network. It explores the performance limits of convolutional neural networks. The ConvNeXt series of models possesses many advantages of convolutional neural networks, including high inference efficiency and ease of migration to downstream tasks. ConvNeXt_base_384Inference Model/Trained Model 84.90 31.7607 3967.05 313.9 M ConvNeXt_large_224Inference Model/Trained Model 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_384Inference Model/Trained Model 85.27 66.4058 6598.92 700.7 M ConvNeXt_smallInference Model/Trained Model 83.13 9.74075 1127.6 178.0 M ConvNeXt_tinyInference Model/Trained Model 82.03 5.48923 672.559 104.1 M FasterNet-LInference Model/Trained Model 83.5 23.4415 - 357.1 M FasterNet is a neural network designed to improve runtime speed. Its key improvements are as follows: 1. Re-examined popular operators and found that low FLOPS mainly stem from frequent memory accesses, especially in depthwise convolutions; 2. Proposed Partial Convolution (PConv) to extract image features more efficiently by reducing redundant computations and memory accesses; 3. Launched the FasterNet series of models based on PConv, a new design scheme that achieves significantly higher runtime speeds on various devices without compromising model task performance. FasterNet-MInference Model/Trained Model 83.0 21.8936 - 204.6 M FasterNet-SInference Model/Trained Model 81.3 13.0409 - 119.3 M FasterNet-T0Inference Model/Trained Model 71.9 12.2432 - 15.1 M FasterNet-T1Inference Model/Trained Model 75.9 11.3562 - 29.2 M FasterNet-T2Inference Model/Trained Model 79.1 10.703 - 57.4 M MobileNetV1_x0_5Inference Model/Trained Model 63.5 1.86754 7.48297 4.8 M MobileNetV1 is a network released by Google in 2017 for mobile devices or embedded devices. This network decomposes traditional convolution operations into depthwise separable convolutions, which are a combination of Depthwise convolution and Pointwise convolution. Compared to traditional convolutional networks, this combination can significantly reduce the number of parameters and computations. Additionally, this network can be used for image classification and other vision tasks. MobileNetV1_x0_25Inference Model/Trained Model 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_75Inference Model/Trained Model 68.8 2.57903 10.6343 9.3 M MobileNetV1_x1_0Inference Model/Trained Model 71.0 2.78781 13.98 15.2 M MobileNetV2_x0_5Inference Model/Trained Model 65.0 4.94234 11.1629 7.1 M MobileNetV2 is a lightweight network proposed by Google following MobileNetV1. Compared to MobileNetV1, MobileNetV2 introduces Linear bottlenecks and Inverted residual blocks as the basic structure of the network. By stacking these basic modules extensively, the network structure of MobileNetV2 is formed. Finally, it achieves higher classification accuracy with only half the FLOPs of MobileNetV1. MobileNetV2_x0_25Inference Model/Trained Model 53.2 4.50856 9.40991 5.5 M MobileNetV2_x1_0Inference Model/Trained Model 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_5Inference Model/Trained Model 74.1 6.28385 22.5129 25.0 M MobileNetV2_x2_0Inference Model/Trained Model 75.2 6.12888 30.8612 41.2 M MobileNetV3_large_x0_5Inference Model/Trained Model 69.2 6.31302 14.5588 9.6 M MobileNetV3 is a NAS-based lightweight network proposed by Google in 2019. To further enhance performance, relu and sigmoid activation functions are replaced with hard_swish and hard_sigmoid activation functions, respectively. Additionally, some improvement strategies specifically designed to reduce network computations are introduced. MobileNetV3_large_x0_35Inference Model/Trained Model 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_75Inference Model/Trained Model 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x1_0Inference Model/Trained Model 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_25Inference Model/Trained Model 76.4 8.73358 22.1296 26.5 M MobileNetV3_small_x0_5Inference Model/Trained Model 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_35Inference Model/Trained Model 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_75Inference Model/Trained Model 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x1_0Inference Model/Trained Model 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_25Inference Model/Trained Model 70.7 6.9589 14.3995 13.0 M MobileNetV4_conv_largeInference Model/Trained Model 83.4 12.5485 51.6453 125.2 M MobileNetV4 is an efficient architecture specifically designed for mobile devices. Its core lies in the introduction of the UIB (Universal Inverted Bottleneck) module, a unified and flexible structure that integrates IB (Inverted Bottleneck), ConvNeXt, FFN (Feed Forward Network), and the latest ExtraDW (Extra Depthwise) module. Alongside UIB, Mobile MQA, a customized attention block for mobile accelerators, was also introduced, achieving up to 39% significant acceleration. Furthermore, MobileNetV4 introduces a novel Neural Architecture Search (NAS) scheme to enhance the effectiveness of the search process. MobileNetV4_conv_mediumInference Model/Trained Model 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_smallInference Model/Trained Model 74.6 5.24172 11.0893 14.7 M MobileNetV4_hybrid_largeInference Model/Trained Model 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_mediumInference Model/Trained Model 80.5 19.7543 62.2624 42.9 M PP-HGNet_baseInference Model/Trained Model 85.0 14.2969 327.114 249.4 M PP-HGNet (High Performance GPU Net) is a high-performance backbone network developed by Baidu PaddlePaddle's vision team, tailored for GPU platforms. This network combines the fundamentals of VOVNet with learnable downsampling layers (LDS Layer), incorporating the advantages of models such as ResNet_vd and PPHGNet. On GPU platforms, this model achieves higher accuracy compared to other SOTA models at the same speed. Specifically, it outperforms ResNet34-0 by 3.8 percentage points and ResNet50-0 by 2.4 percentage points. Under the same SLSD conditions, it ultimately surpasses ResNet50-D by 4.7 percentage points. Additionally, at the same level of accuracy, its inference speed significantly exceeds that of mainstream Vision Transformers. PP-HGNet_smallInference Model/Trained Model 81.51 5.50661 119.041 86.5 M PP-HGNet_tinyInference Model/Trained Model 79.83 5.22006 69.396 52.4 M PP-HGNetV2-B0Inference Model/Trained Model 77.77 6.53694 23.352 21.4 M PP-HGNetV2 (High Performance GPU Network V2) is the next-generation version of Baidu PaddlePaddle's PP-HGNet, featuring further optimizations and improvements upon its predecessor. It pushes the limits of NVIDIA's \"Accuracy-Latency Balance,\" significantly outperforming other models with similar inference speeds in terms of accuracy. It demonstrates strong performance across various label classification and evaluation scenarios. PP-HGNetV2-B1Inference Model/Trained Model 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B2Inference Model/Trained Model 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B3Inference Model/Trained Model 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B4Inference Model/Trained Model 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B5Inference Model/Trained Model 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B6Inference Model/Trained Model 86.30 21.226 255.279 268.4 M PP-LCNet_x0_5Inference Model/Trained Model 63.14 3.67722 6.66857 6.7 M PP-LCNet is a lightweight backbone network developed by Baidu PaddlePaddle's vision team. It enhances model performance without increasing inference time, significantly surpassing other lightweight SOTA models. PP-LCNet_x0_25Inference Model/Trained Model 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_35Inference Model/Trained Model 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_75Inference Model/Trained Model 68.18 3.91032 8.06953 8.4 M PP-LCNet_x1_0Inference Model/Trained Model 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_5Inference Model/Trained Model 73.71 3.97666 12.3457 16.0 M PP-LCNet_x2_0Inference Model/Trained Model 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_5Inference Model/Trained Model 76.60 4.06028 21.5063 32.1 M PP-LCNetV2_baseInference Model/Trained Model 77.05 5.23428 19.6005 23.7 M The PP-LCNetV2 image classification model is the next-generation version of PP-LCNet, self-developed by Baidu PaddlePaddle's vision team. Based on PP-LCNet, it has undergone further optimization and improvements, primarily utilizing re-parameterization strategies to combine depthwise convolutions with varying kernel sizes and optimizing pointwise convolutions, Shortcuts, etc. Without using additional data, the PPLCNetV2_base model achieves over 77% Top-1 Accuracy on the ImageNet dataset for image classification, while maintaining an inference time of less than 4.4 ms on Intel CPU platforms. PP-LCNetV2_large Inference Model/Trained Model 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_smallInference Model/Trained Model 73.97 3.89762 13.0273 14.6 M ResNet18_vdInference Model/Trained Model 72.3 3.53048 31.3014 41.5 M The ResNet series of models were introduced in 2015, winning the ILSVRC2015 competition with a top-5 error rate of 3.57%. This network innovatively proposed residual structures, which are stacked to construct the ResNet network. Experiments have shown that using residual blocks can effectively improve convergence speed and accuracy. ResNet18 Inference Model/Trained Model 71.0 2.4868 27.4601 41.5 M ResNet34_vdInference Model/Trained Model 76.0 5.60675 56.0653 77.3 M ResNet34Inference Model/Trained Model 74.6 4.16902 51.925 77.3 M ResNet50_vdInference Model/Trained Model 79.1 10.1885 68.446 90.8 M ResNet50Inference Model/Trained Model 76.5 9.62383 64.8135 90.8 M ResNet101_vdInference Model/Trained Model 80.2 20.0563 124.85 158.4 M ResNet101Inference Model/Trained Model 77.6 19.2297 121.006 158.4 M ResNet152_vdInference Model/Trained Model 80.6 29.6439 181.678 214.3 M ResNet152Inference Model/Trained Model 78.3 30.0461 177.707 214.2 M ResNet200_vdInference Model/Trained Model 80.9 39.1628 235.185 266.0 M StarNet-S1Inference Model/Trained Model 73.6 9.895 23.0465 11.2 M StarNet focuses on exploring the untapped potential of \"star operations\" (i.e., element-wise multiplication) in network design. It reveals that star operations can map inputs to high-dimensional, nonlinear feature spaces, a process akin to kernel tricks but without the need to expand the network size. Consequently, StarNet, a simple yet powerful prototype network, is further proposed, demonstrating exceptional performance and low latency under compact network structures and limited computational resources. StarNet-S2 Inference Model/Trained Model 74.8 7.91279 21.9571 14.3 M StarNet-S3Inference Model/Trained Model 77.0 10.7531 30.7656 22.2 M StarNet-S4Inference Model/Trained Model 79.0 15.2868 43.2497 28.9 M SwinTransformer_base_patch4_window7_224Inference Model/Trained Model 83.37 16.9848 383.83 310.5 M SwinTransformer is a novel vision Transformer network that can serve as a general-purpose backbone for computer vision tasks. SwinTransformer consists of a hierarchical Transformer structure represented by shifted windows. Shifted windows restrict self-attention computations to non-overlapping local windows while allowing cross-window connections, thereby enhancing network performance. SwinTransformer_base_patch4_window12_384Inference Model/Trained Model 84.17 37.2855 1178.63 311.4 M SwinTransformer_large_patch4_window7_224Inference Model/Trained Model 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window12_384Inference Model/Trained Model 87.06 74.1768 2105.22 696.1 M SwinTransformer_small_patch4_window7_224Inference Model/Trained Model 83.21 16.3982 285.56 175.6 M SwinTransformer_tiny_patch4_window7_224Inference Model/Trained Model 81.10 8.54846 156.306 100.1 M

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set. All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Image Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Image Classification Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config image_classification\n

After execution, the image classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file take effect. For example, if the configuration file's save path is ./image_classification.yaml, simply execute:

paddlex --pipeline ./image_classification.yaml --input general_image_classification_001.jpg --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If you still specify parameters, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [296, 170, 356, 258, 248], 'scores': [0.62736, 0.03752, 0.03256, 0.0323, 0.03194], 'label_names': ['ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 'Irish wolfhound', 'weasel', 'Samoyed, Samoyede', 'Eskimo dog, husky']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general image classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"image_classification\")\n\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/image_classification.yaml\")\noutput = pipeline.predict(\"general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the results. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string The image classification result image. The image is in JPEG format and encoded using Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image classification pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using data from your specific domain or application scenario to improve the recognition performance of the general image classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image classification pipeline includes an image classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Classification Module Development Tutorial and use your private dataset to fine-tune the image classification model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the image classification pipeline, the Python command is:

paddlex --pipeline image_classification --input general_image_classification_001.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Classification Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html","title":"General Image Multi-Label Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#1-introduction-to-the-general-image-multi-label-classification-pipeline","title":"1. Introduction to the General Image Multi-Label Classification Pipeline","text":"

Image multi-label classification is a technique that assigns multiple relevant categories to a single image simultaneously, widely used in image annotation, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, for example, an image containing both \"dog\" and \"outdoor\" labels. By leveraging deep learning models, image multi-label classification automatically extracts image features and performs accurate classification, providing users with more comprehensive information. This technology is of great significance in applications such as intelligent search engines and automatic content generation.

The General Image Multi-Label Classification Pipeline includes a module for image multi-label classification. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link mAP (%) Model Storage Size (M) CLIP_vit_base_patch16_448_MLInference Model/Trained Model 89.15 - PP-HGNetV2-B0_MLInference Model/Trained Model 80.98 39.6 PP-HGNetV2-B4_MLInference Model/Trained Model 87.96 88.5 PP-HGNetV2-B6_MLInference Model/Trained Model 91.25 286.5 PP-LCNet_x1_0_MLInference Model/Trained Model 77.96 29.4 ResNet50_MLInference Model/Trained Model 83.50 108.9

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017. The GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the General Image Multi-Label Classification Pipeline locally using command line or Python.

Before using the General Image Multi-Label Classification Pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the effects of the image multi-label classification pipeline with a single command:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the image multi-label classification pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default configuration file for the image multi-label classification pipeline is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config multi_label_image_classification\n

After execution, the configuration file for the image multi-label classification pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config multi_label_image_classification --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./multi_label_image_classification.yaml, simply execute:

paddlex --pipeline ./multi_label_image_classification.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device gpu:0\n

Where --model, --device, and other parameters are not specified, the parameters in the configuration file will be used. If parameters are specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'general_image_classification_001.jpg', 'class_ids': [21, 0, 30, 24], 'scores': [0.99257, 0.70596, 0.63001, 0.57852], 'label_names': ['bear', 'person', 'skis', 'backpack']}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general image multi-label classification pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"multi_label_image_classification\")\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result visualization image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path of the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the multi-label classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the file path of the data file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key of the dictionary needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/multi_label_image_classification.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/multi_label_image_classification.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have strict standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed to 0. errorMsg string Error message. Fixed to \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Classify images.

POST /multilabel-image-classification

  • The request body properties are as follows:
Name Type Description Required image string The URL of the image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

The properties of inferenceParams are as follows:

Name Type Description Required topK integer Only the top topK categories with the highest scores will be retained in the result. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description categories array Image category information. image string Image classification result image. The image is in JPEG format and encoded in Base64.

Each element in categories is an object with the following properties:

Name Type Description id integer Category ID. name string Category name. score number Category score.

An example of result is as follows:

{\n\"categories\": [\n{\n\"id\": 5,\n\"name\": \"Rabbit\",\n\"score\": 0.93\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/multilabel-image-classification\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nCategories:\")\nprint(result[\"categories\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/multilabel-image-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto categories = result[\"categories\"];\n        std::cout << \"\\nCategories:\" << std::endl;\n        for (const auto& category : categories) {\n            std::cout << category << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/multilabel-image-classification\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode categories = result.get(\"categories\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nCategories: \" + categories.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/multilabel-image-classification\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Categories []map[string]interface{} `json:\"categories\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nCategories:\")\n    for _, category := range respData.Result.Categories {\n        fmt.Println(category)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/multilabel-image-classification\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nCategories:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"categories\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/multilabel-image-classification'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nCategories:\");\n    console.log(result[\"categories\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/multilabel-image-classification\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nCategories:\\n\";\nprint_r($result[\"categories\"]);\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a way to place computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general image multi-label classification pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general image multi-label classification pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general image multi-label classification pipeline includes an image multi-label classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Image Multi-Label Classification Module Development Tutorial to fine-tune the image multi-label classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#42-model-application","title":"4.2 Model Application","text":"

After you have completed fine-tuning training using your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LCNet_x1_0_ML   # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the image multi-label classification pipeline, the Python command is:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/padd\n

At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the Python command to npu:0:

paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device npu:0\n
If you want to use the General Image Multi-label Classification Pipeline on more diverse hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html","title":"General Instance Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#1-introduction-to-the-general-instance-segmentation-pipeline","title":"1. Introduction to the General Instance Segmentation Pipeline","text":"

Instance segmentation is a computer vision task that not only identifies the object categories in an image but also distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately label each car, person, or animal in an image, ensuring they are independently processed at the pixel level. For example, in a street scene image containing multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robotic vision, often relying on deep learning models (such as Mask R-CNN) to achieve efficient pixel classification and instance differentiation through Convolutional Neural Networks (CNNs), providing powerful support for understanding complex scenes.

The General Instance Segmentation Pipeline includes a Object Detection module. If you prioritize model precision, choose a model with higher precision. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 15 models. The complete list of models is as follows:

\ud83d\udc49Model List Details ModelModel Download Link Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-MaskRCNN-ResNet50-FPNInference Model/Trained Model 36.3 - - 254.8 M Cascade-MaskRCNN is an improved Mask RCNN instance segmentation model that utilizes multiple detectors in a cascade, optimizing segmentation results by leveraging different IOU thresholds to address the mismatch between detection and inference stages, thereby enhancing instance segmentation accuracy. Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 39.1 - - 254.7 M Mask-RT-DETR-HInference Model/Trained Model 50.6 132.693 4896.17 449.9 M Mask-RT-DETR is an instance segmentation model based on RT-DETR. By adopting the high-performance PP-HGNetV2 as the backbone network and constructing a MaskHybridEncoder encoder, along with introducing IOU-aware Query Selection technology, it achieves state-of-the-art (SOTA) instance segmentation accuracy with the same inference time. Mask-RT-DETR-LInference Model/Trained Model 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-MInference Model/Trained Model 42.7 36.8329 - 66.6 M Mask-RT-DETR-SInference Model/Trained Model 41.0 33.5007 - 51.8 M Mask-RT-DETR-XInference Model/Trained Model 47.5 75.755 3358.04 237.5 M MaskRCNN-ResNet50-FPNInference Model/Trained Model 35.6 - - 157.5 M Mask R-CNN is a full-task deep learning model from Facebook AI Research (FAIR) that can perform object classification and localization in a single model, combined with image-level masks to complete segmentation tasks. MaskRCNN-ResNet50-vd-FPNInference Model/Trained Model 36.4 - - 157.5 M MaskRCNN-ResNet50Inference Model/Trained Model 32.8 - - 128.7 M MaskRCNN-ResNet101-FPNInference Model/Trained Model 36.6 - - 225.4 M MaskRCNN-ResNet101-vd-FPNInference Model/Trained Model 38.1 - - 225.1 M MaskRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 39.5 - - 370.0 M PP-YOLOE_seg-SInference Model/Trained Model 32.5 - - 31.5 M PP-YOLOE_seg is an instance segmentation model based on PP-YOLOE. This model inherits PP-YOLOE's backbone and head, significantly enhancing instance segmentation performance and inference speed through the design of a PP-YOLOE instance segmentation head. SOLOv2Inference Model/Trained Model 35.5 - - 179.1 M SOLOv2 is a real-time instance segmentation algorithm that segments objects by location. This model is an improved version of SOLO, achieving a good balance between accuracy and speed through the introduction of mask learning and mask NMS.

Note: The above accuracy metrics are based on the Mask AP of the COCO2017 validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of the effects. You can experience the effects of the General Instance Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Instance Segmentation Pipeline using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Image Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the image classification pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline instance_segmentation --input  general_instance_segmentation_004.png --device gpu:0\n

Parameter Description:

--pipeline: The name of the pipeline, here it refers to the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default instance segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config instance_segmentation\n

After execution, the instance segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config instance_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./instance_segmentation.yaml, simply execute:

paddlex --pipeline ./instance_segmentation.yaml --input general_instance_segmentation_004.png --device gpu:0\n

Where --model, --device, and other parameters do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_instance_segmentation_004.png', 'boxes': [{'cls_id': 0, 'label': 'person', 'score': 0.8698326945304871, 'coordinate': [339, 0, 639, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8571141362190247, 'coordinate': [0, 0, 195, 575]}, {'cls_id': 0, 'label': 'person', 'score': 0.8202633857727051, 'coordinate': [88, 113, 401, 574]}, {'cls_id': 0, 'label': 'person', 'score': 0.7108577489852905, 'coordinate': [522, 21, 767, 574]}, {'cls_id': 27, 'label': 'tie', 'score': 0.554280698299408, 'coordinate': [247, 311, 355, 574]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general instance segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"instance_segmentation\")\n\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualization image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
The results obtained are the same as those obtained through the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the image classification pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the image classification task, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

3\uff09Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/instance_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/instance_segmentation.yaml\")\noutput = pipeline.predict(\"general_instance_segmentation_004.png\")\nfor res in output:\n    res.print() # Print the structured output of prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant speedups in the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Performs instance segmentation on an image.

POST /instance-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description instances array Information about the locations and categories of instances. image string The result image of instance segmentation. The image is in JPEG format and encoded in Base64.

Each element in instances is an object with the following properties:

Name Type Description bbox array The location of the instance. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the instance category. score number The score of the instance. mask object The segmentation mask of the instance.

The properties of mask are as follows:

Name Type Description rleResult str The run-length encoding result of the mask. size array The shape of the mask. The elements in the array are the height and width of the mask, respectively.

An example of result is as follows:

{\n\"instances\": [\n{\n\"bbox\": [\n162.39381408691406,\n83.88176727294922,\n624.0797119140625,\n343.4986877441406\n],\n\"categoryId\": 33,\n\"score\": 0.8691174983978271,\n\"mask\": {\n\"rleResult\": \"xxxxxx\",\n\"size\": [\n259,\n462\n]\n}\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/instance-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nInstances:\")\nprint(result[\"instances\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/instance-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto instances = result[\"instances\"];\n        std::cout << \"\\nInstances:\" << std::endl;\n        for (const auto& inst : instances) {\n            std::cout << inst << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/instance-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode instances = result.get(\"instances\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nInstances: \" + instances.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/instance-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Instances []map[string]interface{} `json:\"instances\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nInstances:\")\n    for _, inst := range respData.Result.Instances {\n        fmt.Println(inst)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/instance-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nInstances:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"instances\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/instance-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nInstances:\");\n    console.log(result[\"instances\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/instance-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nInstances:\\n\";\nprint_r($result[\"instances\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method for your model pipeline based on your needs and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#4-ccustom-development","title":"4. CCustom Development","text":"

If the default model weights provided by the general instance segmentation pipeline do not meet your requirements for accuracy or speed in your scenario, you can try to further fine-tune the existing model using data specific to your domain or application scenario to improve the recognition effect of the general instance segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general instance segmentation pipeline includes an instance segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Instance Segmentation Module Development Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: Mask-RT-DETR-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n

Then, refer to the command line method or Python script method in the local experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/instance_segmentation.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for instance segmentation pipeline inference, the Python command is:

paddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline instance_segmentation --input general_instance_segmentation_004.png --device npu:0\n

If you want to use the General Instance Segmentation Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html","title":"General Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#1-introduction-to-general-object-detection-pipeline","title":"1. Introduction to General Object Detection Pipeline","text":"

Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only requires recognizing what objects are present in an image, such as people, cars, and animals, but also accurately determining the specific position of each object within the image, typically represented by rectangular boxes. This technology is widely used in autonomous driving, surveillance systems, smart photo albums, and other fields, relying on deep learning models (e.g., YOLO, Faster R-CNN) that can efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.

ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Storage Size (M) Description PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm for full-size, wide-angle targets, considering the computational capacity of mobile devices. Compared to traditional object detection algorithms, PP-PicoDet has a smaller model size and lower computational complexity, achieving higher speed and lower latency while maintaining detection accuracy. PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an upgraded version of the high-precision cloud-edge integrated model PP-YOLOE, developed by Baidu's PaddlePaddle vision team. By using the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the model's end-to-end inference speed. PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. The model features an efficient hybrid encoder to meet both model performance and throughput requirements, efficiently handling multi-scale features, and proposes an accelerated and optimized query selection mechanism to optimize the dynamics of decoder queries. RT-DETR supports flexible end-to-end inference speeds by using different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M

\u2757 The above list features the 6 core models that the image classification module primarily supports. In total, this module supports 37 models. The complete list of models is as follows:

\ud83d\udc49Details of Model List ModelModel Download Link mAP(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description Cascade-FasterRCNN-ResNet50-FPNInference Model/Trained Model 41.1 - - 245.4 M Cascade-FasterRCNN is an improved version of the Faster R-CNN object detection model. By coupling multiple detectors and optimizing detection results using different IoU thresholds, it addresses the mismatch problem between training and prediction stages, enhancing the accuracy of object detection. Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 45.0 - - 246.2 M CenterNet-DLA-34Inference Model/Trained Model 37.6 - - 75.4 M CenterNet is an anchor-free object detection model that treats the keypoints of the object to be detected as a single point\u2014the center point of its bounding box, and performs regression through these keypoints. CenterNet-ResNet50Inference Model/Trained Model 38.9 - - 319.7 M DETR-R50Inference Model/Trained Model 42.3 59.2132 5334.52 159.3 M DETR is a transformer-based object detection model proposed by Facebook. It achieves end-to-end object detection without the need for predefined anchor boxes or NMS post-processing strategies. FasterRCNN-ResNet34-FPNInference Model/Trained Model 37.8 - - 137.5 M Faster R-CNN is a typical two-stage object detection model that first generates region proposals and then performs classification and regression on these proposals. Compared to its predecessors R-CNN and Fast R-CNN, Faster R-CNN's main improvement lies in the region proposal aspect, using a Region Proposal Network (RPN) to provide region proposals instead of traditional selective search. RPN is a Convolutional Neural Network (CNN) that shares convolutional features with the detection network, reducing the computational overhead of region proposals. FasterRCNN-ResNet50-FPNInference Model/Trained Model 38.4 - - 148.1 M FasterRCNN-ResNet50-vd-FPNInference Model/Trained Model 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPNInference Model/Trained Model 41.4 - - 148.1 M FasterRCNN-ResNet50Inference Model/Trained Model 36.7 - - 120.2 M FasterRCNN-ResNet101-FPNInference Model/Trained Model 41.4 - - 216.3 M FasterRCNN-ResNet101Inference Model/Trained Model 39.0 - - 188.1 M FasterRCNN-ResNeXt101-vd-FPNInference Model/Trained Model 43.4 - - 360.6 M FasterRCNN-Swin-Tiny-FPNInference Model/Trained Model 42.6 - - 159.8 M FCOS-ResNet50Inference Model/Trained Model 39.6 103.367 3424.91 124.2 M FCOS is an anchor-free object detection model that performs dense predictions. It uses the backbone of RetinaNet and directly regresses the width and height of the target object on the feature map, predicting the object's category and centerness (the degree of offset of pixels on the feature map from the object's center), which is eventually used as a weight to adjust the object score. PicoDet-LInference Model/Trained Model 42.6 16.6715 169.904 20.9 M PP-PicoDet is a lightweight object detection algorithm designed for full-size and wide-aspect-ratio targets, with a focus on mobile device computation. Compared to traditional object detection algorithms, PP-PicoDet boasts smaller model sizes and lower computational complexity, achieving higher speeds and lower latency while maintaining detection accuracy. PicoDet-MInference Model/Trained Model 37.5 16.2311 71.7257 16.8 M PicoDet-SInference Model/Trained Model 29.1 14.097 37.6563 4.4 M PicoDet-XSInference Model/Trained Model 26.2 13.8102 48.3139 5.7 M PP-YOLOE_plus-LInference Model/Trained Model 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus is an iteratively optimized and upgraded version of PP-YOLOE, a high-precision cloud-edge integrated model developed by Baidu PaddlePaddle's Vision Team. By leveraging the large-scale Objects365 dataset and optimizing preprocessing, it significantly enhances the end-to-end inference speed of the model. PP-YOLOE_plus-MInference Model/Trained Model 49.8 19.843 449.261 82.3 M PP-YOLOE_plus-SInference Model/Trained Model 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-XInference Model/Trained Model 54.7 57.8995 1439.93 349.4 M RT-DETR-HInference Model/Trained Model 56.3 114.814 3933.39 435.8 M RT-DETR is the first real-time end-to-end object detector. It features an efficient hybrid encoder that balances model performance and throughput, efficiently processes multi-scale features, and introduces an accelerated and optimized query selection mechanism to dynamize decoder queries. RT-DETR supports flexible end-to-end inference speeds through the use of different decoders. RT-DETR-LInference Model/Trained Model 53.0 34.5252 1454.27 113.7 M RT-DETR-R18Inference Model/Trained Model 46.5 19.89 784.824 70.7 M RT-DETR-R50Inference Model/Trained Model 53.1 41.9327 1625.95 149.1 M RT-DETR-XInference Model/Trained Model 54.8 61.8042 2246.64 232.9 M YOLOv3-DarkNet53Inference Model/Trained Model 39.1 40.1055 883.041 219.7 M YOLOv3 is a real-time end-to-end object detector that utilizes a unique single Convolutional Neural Network (CNN) to frame the object detection problem as a regression task, enabling real-time detection. The model employs multi-scale detection to enhance performance across different object sizes. YOLOv3-MobileNetV3Inference Model/Trained Model 31.4 18.6692 267.214 83.8 M YOLOv3-ResNet50_vd_DCNInference Model/Trained Model 40.6 31.6276 856.047 163.0 M YOLOX-LInference Model/Trained Model 50.1 185.691 1250.58 192.5 M Building upon YOLOv3's framework, YOLOX significantly boosts detection performance in complex scenarios by incorporating Decoupled Head, Data Augmentation, Anchor Free, and SimOTA components. YOLOX-MInference Model/Trained Model 46.9 123.324 688.071 90.0 M YOLOX-NInference Model/Trained Model 26.1 79.1665 155.59 3.4 M YOLOX-SInference Model/Trained Model 40.4 184.828 474.446 32.0 M YOLOX-TInference Model/Trained Model 32.9 102.748 212.52 18.1 M YOLOX-XInference Model/Trained Model 51.8 227.361 2067.84 351.5 M

Note: The precision metrics mentioned are based on the COCO2017 validation set mAP(0.5:0.95). All model GPU inference times are measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Object Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Object Detection Pipeline online using the demo images provided by the official source, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Object Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command can quickly experience the effects of the object detection pipeline, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

Click to expand \ud83d\udc49
paddlex --get_pipeline_config object_detection\n

After execution, the object detection pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is ./object_detection.yaml, simply execute:

paddlex --pipeline ./object_detection.yaml --input general_object_detection_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

{'input_path': 'general_object_detection_002.png', 'boxes': [{'cls_id': 49, 'label': 'orange', 'score': 0.8188097476959229, 'coordinate': [661, 93, 870, 305]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7743489146232605, 'coordinate': [76, 274, 330, 520]}, {'cls_id': 47, 'label': 'apple', 'score': 0.7270504236221313, 'coordinate': [285, 94, 469, 297]}, {'cls_id': 46, 'label': 'banana', 'score': 0.5570532083511353, 'coordinate': [310, 361, 685, 712]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5484835505485535, 'coordinate': [764, 285, 924, 440]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5160726308822632, 'coordinate': [853, 169, 987, 303]}, {'cls_id': 60, 'label': 'dining table', 'score': 0.5142655968666077, 'coordinate': [0, 0, 1072, 720]}, {'cls_id': 47, 'label': 'apple', 'score': 0.5101479291915894, 'coordinate': [57, 23, 213, 176]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#222-integration-via-python-scripts","title":"2.2.2 Integration via Python Scripts","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking General Object Detection as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"object_detection\")\n\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method parameter x is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/object_detection.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/object_detection.yaml\")\noutput = pipeline.predict(\"general_object_detection_002.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures.

Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Object Detection pipeline do not meet your requirements for precision or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the General Object Detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Object Detection pipeline includes an object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Custom Development section in the Object Detection Module Development Tutorial and use your private dataset to fine-tune the object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PicoDet-S  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/object_detection.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the General Object Detection pipeline, the Python command is:

paddlex --pipeline object_detection --input general_object_detection_002.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline object_detection --input general_object_detection_002.png --device npu:0\n
If you want to use the General Object Detection Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html","title":"Pedestrian Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#1-introduction-to-pedestrian-attribute-recognition-pipeline","title":"1. Introduction to Pedestrian Attribute Recognition Pipeline","text":"

Pedestrian attribute recognition is a key function in computer vision systems, used to locate and label specific characteristics of pedestrians in images or videos, such as gender, age, clothing color, and style. This task not only requires accurately detecting pedestrians but also identifying detailed attribute information for each pedestrian. The pedestrian attribute recognition pipeline is an end-to-end serial system for locating and recognizing pedestrian attributes, widely used in smart cities, security surveillance, and other fields, significantly enhancing the system's intelligence level and management efficiency.

The pedestrian attribute recognition pipeline includes a pedestrian detection module and a pedestrian attribute recognition module, with several models in each module. Which models to use specifically can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Pedestrian Detection Module:

ModelModel Download Link mAP(0.5:0.95) mAP(0.5) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-L_humanInference Model/Trained Model 48.0 81.9 32.8 777.7 196.02 Pedestrian detection model based on PP-YOLOE PP-YOLOE-S_humanInference Model/Trained Model 42.5 77.9 15.0 179.3 28.79

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Pedestrian Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_pedestrian_attributeInference Model/Trained Model 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute is a lightweight pedestrian attribute recognition model based on PP-LCNet, covering 26 categories.

Note: The above accuracy metrics are mA on PaddleX's internally built dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX can quickly demonstrate their effectiveness. You can experience the pedestrian attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the pedestrian attribute recognition pipeline locally, ensure you have completed the installation of the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

You can quickly experience the pedestrian attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the pedestrian attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs), or you can choose to use CPU (--device cpu).\n

When executing the above Python script, the default pedestrian attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config pedestrian_attribute_recognition\n

After execution, the pedestrian attribute recognition pipeline configuration file will be saved in the current path. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config pedestrian_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the configuration file is saved at ./pedestrian_attribute_recognition.yaml, simply execute:

paddlex --pipeline ./pedestrian_attribute_recognition.yaml --input pedestrian_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code are sufficient for quick inference of the pipeline. Taking the pedestrian attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"pedestrian_attribute_recognition\")\n\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized image of the result\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line approach.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the pedestrian attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain the data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the pedestrian attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of type dict and supports printing or saving as a file. The supported save types are related to the specific pipeline, such as:

Method Description Method Parameters print Print the results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save the results as a json-formatted file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file name;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save the results as an image file

If you have obtained the configuration file, you can customize various configurations for the pedestrian attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved as ./my_path/pedestrian_attribute_recognition*.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/pedestrian_attribute_recognition.yaml\")\noutput = pipeline.predict(\"pedestrian_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pedestrian attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pedestrian attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get pedestrian attribute recognition results.

POST /pedestrian-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description pedestrians array Information about the pedestrian's location and attributes. image string The pedestrian attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in pedestrians is an object with the following properties:

Name Type Description bbox array The location of the pedestrian. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The pedestrian attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/pedestrian-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected pedestrians:\")\nprint(result[\"pedestrians\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the pedestrian attribute recognition pipeline includes both a pedestrian attribute recognition module and a pedestrian detection module, the unexpected performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the pedestrian detection model. In this case, you need to refer to the Secondary Development section in the Human Detection Module Development Tutorial and use your private dataset to fine-tune the pedestrian detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Secondary Development section in the Pedestrian Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the pedestrian attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning training with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-YOLOE-L_human\n  cls_model: PP-LCNet_x1_0_pedestrian_attribute  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line method or Python script method in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/pedestrian_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports multiple mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference in the pedestrian attribute recognition pipeline, the command used is:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline pedestrian_attribute_recognition --input pedestrian_attribute_002.jpg --device npu:0\n
If you want to use the pedestrian attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html","title":"General Semantic Segmentation Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#1-introduction-to-the-general-semantic-segmentation-pipeline","title":"1. Introduction to the General Semantic Segmentation Pipeline","text":"

Semantic segmentation is a computer vision technique that aims to assign each pixel in an image to a specific category, enabling a detailed understanding of the image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing regions of the same category to be fully labeled. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, the sky, and roads pixel by pixel, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (such as SegFormer, etc.) to extract features by CNN or Transformer, and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M

\u2757 The above list features the 2 core models that the image classification module primarily supports. In total, this module supports 18 models. The complete list of models is as follows:

\ud83d\udc49Model List Details Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Deeplabv3_Plus-R50Inference Model/Trained Model 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R101Inference Model/Trained Model 81.10 100.026 2460.71 162.5 M Deeplabv3-R50Inference Model/Trained Model 79.90 82.2631 1735.83 138.3 M Deeplabv3-R101Inference Model/Trained Model 80.85 121.492 2685.51 205.9 M OCRNet_HRNet-W18Inference Model/Trained Model 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W48Inference Model/Trained Model 82.15 78.9976 2226.95 249.8 M PP-LiteSeg-TInference Model/Trained Model 73.10 7.6827 138.683 28.5 M PP-LiteSeg-BInference Model/Trained Model 75.25 10.9935 194.727 47.0 M SegFormer-B0 (slice)Inference Model/Trained Model 76.73 11.1946 268.929 13.2 M SegFormer-B1 (slice)Inference Model/Trained Model 78.35 17.9998 403.393 48.5 M SegFormer-B2 (slice)Inference Model/Trained Model 81.60 48.0371 1248.52 96.9 M SegFormer-B3 (slice)Inference Model/Trained Model 82.47 64.341 1666.35 167.3 M SegFormer-B4 (slice)Inference Model/Trained Model 82.38 82.4336 1995.42 226.7 M SegFormer-B5 (slice)Inference Model/Trained Model 82.58 97.3717 2420.19 229.7 M

The accuracy metrics of the above models are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Model NameModel Download Link mIoU (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) SeaFormer_base(slice)Inference Model/Trained Model 40.92 24.4073 397.574 30.8 M SeaFormer_large (slice)Inference Model/Trained Model 43.66 27.8123 550.464 49.8 M SeaFormer_small (slice)Inference Model/Trained Model 38.73 19.2295 358.343 14.3 M SeaFormer_tiny (slice)Inference Model/Trained Model 34.58 13.9496 330.132 6.1M

The accuracy metrics of the SeaFormer series models are measured on the ADE20k dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effects of the General Semantic Segmentation Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Semantic Segmentation Pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Semantic Segmentation Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the semantic segmentation pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n

Parameter Explanation:

--pipeline: The name of the pipeline, here it is the semantic segmentation pipeline\n--input: The local path or URL of the input image to be processed\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs), or choose to use CPU (--device cpu)\n

When executing the above command, the default semantic segmentation pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config semantic_segmentation\n

After execution, the semantic segmentation pipeline configuration file will be saved in the current path. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./semantic_segmentation.yaml, simply execute:

paddlex --pipeline ./semantic_segmentation.yaml --input makassaridn-road_demo.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_object_detection_002.png'}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the pipeline. Taking the general semantic segmentation pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"semantic_segmentation\")\n\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: The specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" enable_hpi Whether to enable high-performance inference, which is only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by calling it. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/semantic_segmentation.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"makassaridn-road_demo.png\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs semantic segmentation on an image.

POST /semantic-segmentation

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description labelMap array Records the class label of each pixel in the image (arranged in row-major order). size array Image shape. The elements in the array are the height and width of the image, respectively. image string The semantic segmentation result image. The image is in JPEG format and encoded using Base64.

An example of result is as follows:

{\n\"labelMap\": [\n0,\n0,\n1,\n2\n],\n\"size\": [\n2,\n2\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/semantic-segmentation\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/semantic-segmentation\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/semantic-segmentation\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode labelMap = result.get(\"labelMap\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/semantic-segmentation\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Labelmap []map[string]interface{} `json:\"labelMap\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/semantic-segmentation\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/semantic-segmentation'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/semantic-segmentation\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general semantic segmentation pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general semantic segmentation pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general semantic segmentation pipeline includes a semantic segmentation module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Semantic Segmentation Module Development Tutorial (GitHub can directly link to headings) and use your private dataset to fine-tune the semantic segmentation model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#42-model-application","title":"4.2 Model Application","text":"

After you complete fine-tuning training using your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-LiteSeg-T  # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for semantic segmentation pipeline inference, the Python command is:

paddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline semantic_segmentation --input makassaridn-road_demo.png --device npu:0\n
If you want to use the General Semantic Segmentation Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html","title":"Small Object Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#1-introduction-to-small-object-detection-pipeline","title":"1. Introduction to Small Object Detection Pipeline","text":"

Small object detection is a specialized technique for identifying tiny objects within images, widely applied in fields such as surveillance, autonomous driving, and satellite image analysis. It can accurately locate and classify small-sized objects like pedestrians, traffic signs, or small animals within complex scenes. By leveraging deep learning algorithms and optimized Convolutional Neural Networks (CNNs), small object detection significantly enhances the recognition capabilities for small objects, ensuring no critical information is overlooked in practical applications. This technology plays a pivotal role in enhancing safety and automation levels.

The small object detection pipeline includes a small object detection module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, opt for a model with a smaller storage size.

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-YOLOE_plus_SOD-SInference Model/Trained Model 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-LInference Model/Trained Model 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-largesize-LInference Model/Trained Model 42.7 458.521 11172.7 340.5 M

Note: The above accuracy metrics are based on the VisDrone-DET validation set mAP(0.5:0.95). All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the small object detection pipeline's effects through command line or Python locally.

Before using the small object detection pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the small object detection pipeline with a single command, Use the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline small_object_detection --input small_object_detection.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the small object detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, you can choose to use CPU (--device cpu).\n

When executing the above command, the default small object detection pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config small_object_detection\n

After execution, the small object detection pipeline configuration file will be saved in the current directory. If you wish to customize the save location, execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config small_object_detection --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file's save path is ./small_object_detection.yaml, simply execute:

paddlex --pipeline ./small_object_detection.yaml --input small_object_detection.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file.```markdown

After running, the result will be:

{'input_path': 'small_object_detection.jpg', 'boxes': [{'cls_id': 3, 'label': 'car', 'score': 0.9243856072425842, 'coordinate': [624, 638, 682, 741]}, {'cls_id': 3, 'label': 'car', 'score': 0.9206348061561584, 'coordinate': [242, 561, 356, 613]}, {'cls_id': 3, 'label': 'car', 'score': 0.9194547533988953, 'coordinate': [670, 367, 705, 400]}, {'cls_id': 3, 'label': 'car', 'score': 0.9162291288375854, 'coordinate': [459, 259, 523, 283]}, {'cls_id': 4, 'label': 'van', 'score': 0.9075379371643066, 'coordinate': [467, 213, 498, 242]}, {'cls_id': 4, 'label': 'van', 'score': 0.9066920876502991, 'coordinate': [547, 351, 577, 397]}, {'cls_id': 3, 'label': 'car', 'score': 0.9041045308113098, 'coordinate': [502, 632, 562, 736]}, {'cls_id': 3, 'label': 'car', 'score': 0.8934890627861023, 'coordinate': [613, 383, 647, 427]}, {'cls_id': 3, 'label': 'car', 'score': 0.8803309202194214, 'coordinate': [640, 280, 671, 309]}, {'cls_id': 3, 'label': 'car', 'score': 0.8727016448974609, 'coordinate': [1199, 256, 1259, 281]}, {'cls_id': 3, 'label': 'car', 'score': 0.8705748915672302, 'coordinate': [534, 410, 570, 461]}, {'cls_id': 3, 'label': 'car', 'score': 0.8654043078422546, 'coordinate': [669, 248, 702, 271]}, {'cls_id': 3, 'label': 'car', 'score': 0.8555219769477844, 'coordinate': [525, 243, 550, 270]}, {'cls_id': 3, 'label': 'car', 'score': 0.8522038459777832, 'coordinate': [526, 220, 553, 243]}, {'cls_id': 3, 'label': 'car', 'score': 0.8392605185508728, 'coordinate': [557, 141, 575, 158]}, {'cls_id': 3, 'label': 'car', 'score': 0.8353804349899292, 'coordinate': [537, 120, 553, 133]}, {'cls_id': 3, 'label': 'car', 'score': 0.8322211503982544, 'coordinate': [585, 132, 603, 147]}, {'cls_id': 3, 'label': 'car', 'score': 0.8298957943916321, 'coordinate': [701, 283, 736, 313]}, {'cls_id': 3, 'label': 'car', 'score': 0.8217393159866333, 'coordinate': [885, 347, 943, 377]}, {'cls_id': 3, 'label': 'car', 'score': 0.820313572883606, 'coordinate': [493, 150, 511, 168]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.8183429837226868, 'coordinate': [203, 701, 224, 743]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.815082848072052, 'coordinate': [185, 710, 201, 744]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7892289757728577, 'coordinate': [311, 371, 344, 407]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.7812919020652771, 'coordinate': [345, 380, 388, 405]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7748346328735352, 'coordinate': [295, 500, 309, 532]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.7688500285148621, 'coordinate': [851, 436, 863, 466]}, {'cls_id': 3, 'label': 'car', 'score': 0.7466475367546082, 'coordinate': [565, 114, 580, 128]}, {'cls_id': 3, 'label': 'car', 'score': 0.7156463265419006, 'coordinate': [483, 66, 495, 78]}, {'cls_id': 3, 'label': 'car', 'score': 0.704211950302124, 'coordinate': [607, 138, 642, 152]}, {'cls_id': 3, 'label': 'car', 'score': 0.7021926045417786, 'coordinate': [505, 72, 518, 83]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6897469162940979, 'coordinate': [802, 460, 815, 488]}, {'cls_id': 3, 'label': 'car', 'score': 0.671891450881958, 'coordinate': [574, 123, 593, 136]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.6712754368782043, 'coordinate': [445, 317, 472, 334]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.6695684790611267, 'coordinate': [479, 309, 489, 332]}, {'cls_id': 3, 'label': 'car', 'score': 0.6273623704910278, 'coordinate': [654, 210, 677, 234]}, {'cls_id': 3, 'label': 'car', 'score': 0.6070230603218079, 'coordinate': [640, 166, 667, 185]}, {'cls_id': 3, 'label': 'car', 'score': 0.6064521670341492, 'coordinate': [461, 59, 476, 71]}, {'cls_id': 3, 'label': 'car', 'score': 0.5860581398010254, 'coordinate': [464, 87, 484, 100]}, {'cls_id': 9, 'label': 'motorcycle', 'score': 0.5792551636695862, 'coordinate': [390, 390, 419, 408]}, {'cls_id': 3, 'label': 'car', 'score': 0.5559225678443909, 'coordinate': [481, 125, 496, 140]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5531904697418213, 'coordinate': [869, 306, 880, 331]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.5468509793281555, 'coordinate': [895, 294, 904, 319]}, {'cls_id': 3, 'label': 'car', 'score': 0.5451828241348267, 'coordinate': [505, 94, 518, 108]}, {'cls_id': 3, 'label': 'car', 'score': 0.5398445725440979, 'coordinate': [657, 188, 681, 208]}, {'cls_id': 4, 'label': 'van', 'score': 0.5318890810012817, 'coordinate': [518, 88, 534, 102]}, {'cls_id': 3, 'label': 'car', 'score': 0.5296525359153748, 'coordinate': [527, 71, 540, 81]}, {'cls_id': 6, 'label': 'tricycle', 'score': 0.5168400406837463, 'coordinate': [528, 320, 563, 346]}, {'cls_id': 3, 'label': 'car', 'score': 0.5088561177253723, 'coordinate': [511, 84, 530, 95]}, {'cls_id': 0, 'label': 'pedestrian', 'score': 0.502006471157074, 'coordinate': [841, 266, 850, 283]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#22-integration-via-python-script","title":"2.2 Integration via Python Script","text":"

A few lines of code can quickly enable inference on the production line. Taking the General Small Object Detection Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"small_object_detection\")\n\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualized image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/small_object_detection, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/small_object_detection.yaml\")\noutput = pipeline.predict(\"small_object_detection.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save the visualization image of the result\n    res.save_to_json(\"./output/\")  # Save the structured output of prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment directly.

If you need to apply the pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Performs object detection on an image.

POST /small-object-detection

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description detectedObjects array Information about the location and category of the detected objects. image string The image of the object detection result. The image is in JPEG format and encoded in Base64.

Each element in detectedObjects is an object with the following properties:

Name Type Description bbox array The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. categoryId integer The ID of the object category. score number The score of the object.

An example of result is as follows:

{\n\"detectedObjects\": [\n{\n\"bbox\": [\n404.4967956542969,\n90.15770721435547,\n506.2465515136719,\n285.4187316894531\n],\n\"categoryId\": 0,\n\"score\": 0.7418514490127563\n},\n{\n\"bbox\": [\n155.33145141601562,\n81.10954284667969,\n199.71136474609375,\n167.4235382080078\n],\n\"categoryId\": 1,\n\"score\": 0.7328268885612488\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/small-object-detection\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected objects:\")\nprint(result[\"detectedObjects\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/small-object-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto detectedObjects = result[\"detectedObjects\"];\n        std::cout << \"\\nDetected objects:\" << std::endl;\n        for (const auto& obj : detectedObjects) {\n            std::cout << obj << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/small-object-detection\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode detectedObjects = result.get(\"detectedObjects\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected objects: \" + detectedObjects.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/small-object-detection\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            DetectedObjects []map[string]interface{} `json:\"detectedObjects\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected objects:\")\n    for _, obj := range respData.Result.DetectedObjects {\n        fmt.Println(obj)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/small-object-detection\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected objects:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"detectedObjects\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/small-object-detection'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected objects:\");\n    console.log(result[\"detectedObjects\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/small-object-detection\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected objects:\\n\";\nprint_r($result[\"detectedObjects\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Small Object Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the small object detection pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Small Object Detection Pipeline includes a small object detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Small Object Detection Module Tutorial and use your private dataset to fine-tune the small object detection model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: PP-YOLOE_plus_SOD-L  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/small_object_detection.html#multi-hardware-support","title":"Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the small object detection pipeline, the Python command would be:

paddlex --pipeline multilabel_classification --input small_object_detection.jpg --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline multilabel_classification --input small_object_detection.jpg --device npu:0\n

If you want to use the General Small Object Detection Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html","title":"Vehicle Attribute Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#1-introduction-to-vehicle-attribute-recognition-pipeline","title":"1. Introduction to Vehicle Attribute Recognition Pipeline","text":"

Vehicle attribute recognition is a crucial component in computer vision systems. Its primary task is to locate and label specific attributes of vehicles in images or videos, such as vehicle type, color, and license plate number. This task not only requires accurately detecting vehicles but also identifying detailed attribute information for each vehicle. The vehicle attribute recognition pipeline is an end-to-end serial system for locating and recognizing vehicle attributes, widely used in traffic management, intelligent parking, security surveillance, autonomous driving, and other fields. It significantly enhances system efficiency and intelligence levels, driving the development and innovation of related industries.

The vehicle attribute recognition pipeline includes a vehicle detection module and a vehicle attribute recognition module, with several models in each module. Which models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy; if you prioritize inference speed, choose models with faster inference; if you prioritize model storage size, choose models with smaller storage.

Vehicle Detection Module:

ModelModel Download Link mAP 0.5:0.95 GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-YOLOE-S_vehicleInference Model/Trained Model 61.3 15.4 178.4 28.79 Vehicle detection model based on PP-YOLOE PP-YOLOE-L_vehicleInference Model/Trained Model 63.9 32.6 775.6 196.02

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Vehicle Attribute Recognition Module:

ModelModel Download Link mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_vehicle_attributeInference Model/Trained Model 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute is a lightweight vehicle attribute recognition model based on PP-LCNet.

Note: The above accuracy metrics are mA on the VeRi dataset. GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained models provided by PaddleX can quickly demonstrate results. You can experience the effects of the vehicle attribute recognition pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

Not supported yet.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the vehicle attribute recognition pipeline locally, ensure you have installed the PaddleX wheel package according to the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#221-experience-via-command-line","title":"2.2.1 Experience via Command Line","text":"

You can quickly experience the vehicle attribute recognition pipeline with a single command. Use the test file and replace --input with the local path for prediction.

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
Parameter Description:

--pipeline: The name of the pipeline, here it is the vehicle attribute recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The index of the GPU to use (e.g., gpu:0 means using the first GPU, gpu:1,2 means using the second and third GPUs). You can also choose to use the CPU (--device cpu).\n

When executing the above Python script, the default vehicle attribute recognition pipeline configuration file is loaded. If you need a custom configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config vehicle_attribute_recognition\n

After execution, the vehicle attribute recognition pipeline configuration file will be saved in the current directory. If you wish to specify a custom save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config vehicle_attribute_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it effective. For example, if the saved path of the configuration file is ./vehicle_attribute_recognition.yaml, just execute:

paddlex --pipeline ./vehicle_attribute_recognition.yaml --input vehicle_attribute_002.jpg --device gpu:0\n

Among them, parameters such as --model and --device do not need to be specified, and the parameters in the configuration file will be used. If parameters are still specified, the specified parameters will take precedence.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#222-integrating-via-python-script","title":"2.2.2 Integrating via Python Script","text":"

A few lines of code suffice for rapid inference on the production line, taking the vehicle attribute recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"vehicle_attribute_recognition\")\n\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  ## Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  ## Save the visualized result image\n    res.save_to_json(\"./output/\")  ## Save the structured output of the prediction\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Parameter Type Default Value pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be a pipeline supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the pipeline supports high-performance inference. bool False

(2) Call the predict method of the vehicle attribute recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods. Specific examples are as follows:

Parameter Type Description Python Var Supports directly passing in Python variables, such as image data represented by numpy.ndarray. str Supports passing in the file path of the data to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the data file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain data files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to the specific task, such as \"img\" for the vehicle attribute recognition task, and the value of the dictionary supports the above data types, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the elements of the list need to be the above data types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list representing a set of prediction results.

(4) Processing the Prediction Results: The prediction result for each sample is in dict format, which supports printing or saving to a file. The supported file types for saving depend on the specific pipeline, such as:

Method Description Method Parameters print Print results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only effective when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only effective when format_json is True, default is False; save_to_json Save results as a json file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Save results as an image file - save_path: str, the path to save the file, when it is a directory, the saved file name is consistent with the input file type;

If you have obtained the configuration file, you can customize the configurations for the vehicle attribute recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of your pipeline configuration file.

For example, if your configuration file is saved at ./my_path/vehicle_attribute_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/vehicle_attribute_recognition.yaml\")\noutput = pipeline.predict(\"vehicle_attribute_002.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the visualized result image\n    res.save_to_json(\"./output/\")  # Save the structured output of the prediction\n
"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the vehicle attribute recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the vehicle attribute recognition pipeline in your Python project, you can refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API reference and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • infer

Get vehicle attribute recognition results.

POST /vehicle-attribute-recognition

  • The request body properties are as follows:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description vehicles array Information about the vehicle's location and attributes. image string The vehicle attribute recognition result image. The image is in JPEG format and encoded using Base64.

Each element in vehicles is an object with the following properties:

Name Type Description bbox array The location of the vehicle. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. attributes array The vehicle attributes. score number The detection score.

Each element in attributes is an object with the following properties:

Name Type Description label string The label of the attribute. score number The classification score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/vehicle-attribute-recognition\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected vehicles:\")\nprint(result[\"vehicles\"])\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide. You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the vehicle attribute recognition pipeline do not meet your expectations in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own data from specific domains or application scenarios to enhance the recognition performance of the vehicle attribute recognition pipeline in your context.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the vehicle attribute recognition pipeline includes both a vehicle attribute recognition module and a vehicle detection module, the suboptimal performance of the pipeline may stem from either module. You can analyze images with poor recognition results. If during the analysis, you find that many main targets are not detected, it may indicate deficiencies in the vehicle detection model. In this case, you need to refer to the Custom Development section in the Vehicle Detection Module Development Tutorial and use your private dataset to fine-tune the vehicle detection model. If the detected main attributes are incorrectly recognized, you need to refer to the Custom Development section in the Vehicle Attribute Recognition Module Development Tutorial and use your private dataset to fine-tune the vehicle attribute recognition model.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, you only need to modify the pipeline configuration file by replacing the path to the default model weights with the local path to the fine-tuned model weights:

......\nPipeline:\n  det_model: PP-YOLOE-L_vehicle\n  cls_model: PP-LCNet_x1_0_vehicle_attribute   # Can be modified to the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Subsequently, refer to the command-line or Python script methods in the local experience, and load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/cv_pipelines/vehicle_attribute_recognition.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you use an NVIDIA GPU for inference with the vehicle attribute recognition pipeline, the command is:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, you only need to change --device to npu:0:

paddlex --pipeline vehicle_attribute_recognition --input vehicle_attribute_002.jpg --device npu:0\n
If you want to use the vehicle attribute recognition pipeline on more types of hardware, please refer to the PaddleX Multi-device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html","title":"PP-ChatOCRv3-doc Pipeline utorial","text":""},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#1-introduction-to-pp-chatocrv3-doc-pipeline","title":"1. Introduction to PP-ChatOCRv3-doc Pipeline","text":"

PP-ChatOCRv3-doc is a unique intelligent analysis solution for documents and images developed by PaddlePaddle. It combines Large Language Models (LLM) and OCR technology to provide a one-stop solution for complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating with ERNIE Bot, it fuses massive data and knowledge to achieve high accuracy and wide applicability.

The PP-ChatOCRv3-doc pipeline includes modules for Table Structure Recognition, Layout Region Detection, Text Detection, Text Recognition, Seal Text Detection, Text Image Rectification, and Document Image Orientation Classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference speed. If you prioritize model storage size, choose a model with a smaller storage size. Some benchmarks for these models are as follows:

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines can be quickly experienced. You can experience the effect of the Document Scene Information Extraction v3 pipeline online or locally using Python.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effect of the Document Scene Information Extraction v3 pipeline, using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the PP-ChatOCRv3 pipeline locally, please ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

A few lines of code are all you need to complete the quick inference of the pipeline. Using the test file, taking the PP-ChatOCRv3-doc pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

After running, the output is as follows:

{'chat_res': {'\u200b\u4e59\u65b9\u200b': '\u200b\u80a1\u4efd\u200b\u6d4b\u8bd5\u200b\u6709\u9650\u516c\u53f8\u200b', '\u200b\u624b\u673a\u53f7\u200b': '19331729920'}, 'prompt': ''}\n

In the above Python script, the following steps are executed:

(1) Call the create_pipeline to instantiate a PP-ChatOCRv3-doc pipeline object, related parameters descriptions are as follows:

Parameter Type Default Description pipeline str None Pipeline name or pipeline configuration file path. If it's a pipeline name, it must be supported by PaddleX; llm_name str \"ernie-3.5\" Large Language Model name, we support ernie-4.0 and ernie-3.5, with more models on the way. llm_params dict {} API configuration; device(kwargs) str/None None Running device, support cpu, gpu, gpu:0, etc. None meaning automatic selection;

(2) Call the visual_predict of the PP-ChatOCRv3-doc pipeline object to visual predict, related parameters descriptions are as follows:

Parameter Type Default Description input Python Var - Support to pass Python variables directly, such as numpy.ndarray representing image data; input str - Support to pass the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg; input str - Support to pass the URL of the file to be predicted, such as: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf; input str - Support to pass the local directory, which should contain files to be predicted, such as: /root/data/; input dict - Support to pass a dictionary, where the key needs to correspond to the specific pipeline, such as: {\"img\": \"/root/data1\"}\uff1b input list - Support to pass a list, where the elements must be of the above types of data, such as: [numpy.ndarray, numpy.ndarray]\uff0c[\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"]\uff0c[\"/root/data1\", \"/root/data2\"]\uff0c[{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}]\uff1b use_doc_image_ori_cls_model bool True Whether or not to use the orientation classification model; use_doc_image_unwarp_model bool True Whether or not to use the unwarp model; use_seal_text_det_model bool True Whether or not to use the seal text detection model;

(3) Call the relevant functions of prediction object to save the prediction results. The related functions are as follows:

Function Parameter Description save_to_img save_path Save OCR prediction results, layout results, and table recognition results as image files, with the parameter save_path used to specify the save path; save_to_html save_path Save the table recognition results as an HTML file, with the parameter 'save_path' used to specify the save path; save_to_xlsx save_path Save the table recognition results as an Excel file, with the parameter 'save_path' used to specify the save path;

(4) Call the chat of PP-ChatOCRv3-doc pipeline object to query information with LLM, related parameters are described as follows:

Parameter Type Default Description key_list str - Keywords used to query. A string composed of multiple keywords with \",\" as separators, such as \"Party B, phone number\"; key_list list - Keywords used to query. A list composed of multiple keywords.

(3) Obtain prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through calls. The predict method predicts data in batches, so the prediction results are represented as a list of prediction results.

(4) Interact with the large model by calling the predict.chat method, which takes as input keywords (multiple keywords are supported) for information extraction. The prediction results are represented as a list of information extraction results.

(5) Process the prediction results: The prediction result for each sample is in the form of a dict, which supports printing or saving to a file. The supported file types depend on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves layout analysis, table recognition, etc. results as image files. save_path: str, the file path to save. save_to_html Saves table recognition results as HTML files. save_path: str, the file path to save. save_to_xlsx Saves table recognition results as Excel files. save_path: str, the file path to save.

When executing the above command, the default Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

paddlex --get_pipeline_config PP-ChatOCRv3-doc\n

After execution, the configuration file for the PP-ChatOCRv3-doc pipeline will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n
After obtaining the configuration file, you can customize the various configurations of the PP-ChatOCRv3-doc pipeline:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

In the above configuration, you can modify the models loaded by each module of the pipeline, as well as the large language model used. Please refer to the module documentation for the list of supported models for each module, and the list of supported large language models includes: ernie-4.0, ernie-3.5, ernie-3.5-8k, ernie-lite, ernie-tiny-8k, ernie-speed, ernie-speed-128k, ernie-char-8k.

After making modifications, simply update the pipeline parameter value in the create_pipeline method to the path of your pipeline configuration file to apply the configuration.

For example, if your configuration file is saved at ./my_path/PP-ChatOCRv3-doc.yaml, you would execute:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # Please enter your ak and sk; otherwise, the large model cannot be invoked.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Please enter your access_token; otherwise, the large model cannot be invoked.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/contract.pdf\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\n\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u4e59\u65b9\u200b\", \"\u200b\u624b\u673a\u53f7\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n
"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to directly apply the pipeline in your Python project, you can refer to the example code in 2.2 Local Experience.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics (especially response speed) of deployment strategies to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing to significantly speed up the end-to-end process. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service are as follows:

  • analyzeImages

Analyze images using computer vision models to obtain OCR, table recognition results, and extract key information from the images.

POST /chatocr-vision

  • Request body properties:
Name Type Description Required file string The URL of an accessible image file or PDF file, or the Base64 encoded content of the above file types. For PDF files with more than 10 pages, only the first 10 pages will be used. Yes fileType integer File type. 0 represents PDF files, 1 represents image files. If this property is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This feature is enabled by default. No useImgUnwrapping boolean Whether to enable text image correction. This feature is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This feature is enabled by default. No inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description visionResults array Analysis results obtained using the computer vision model. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file in sequence. visionInfo object Key information in the image, which can be used as input for other operations.

Each element in visionResults is an object with the following properties:

Name Type Description texts array Text locations, contents, and scores. tables array Table locations and contents. inputImage string Input image. The image is in JPEG format and encoded in Base64. ocrImage string OCR result image. The image is in JPEG format and encoded in Base64. layoutImage string Layout area detection result image. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text location. The elements in the array are the vertex coordinates of the polygon enclosing the text in sequence. text string Text content. score number Text recognition score.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table location. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box in sequence. html string Table recognition result in HTML format.
  • buildVectorStore

Builds a vector database.

POST /chatocr-vector

  • The request body properties are as follows:
Name Type Description Required visionInfo object Key information from the image. Provided by the analyzeImages operation. Yes minChars integer Minimum data length to enable the vector database. No llmRequestInterval number Interval time for calling the large language model API. No llmName string Name of the large language model. No llmParams object Parameters for the large language model API. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description vectorStore string Serialized result of the vector database, which can be used as input for other operations.
  • retrieveKnowledge

Perform knowledge retrieval.

POST /chatocr-retrieval

  • The request body properties are as follows:
Name Type Description Required keys array List of keywords. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. Yes llmName string Name of the large language model. No llmParams object API parameters for the large language model. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description retrievalResult string The result of knowledge retrieval, which can be used as input for other operations.
  • chat

Interact with large language models to extract key information.

POST /chatocr-chat

  • Request body properties:
Name Type Description Required keys array List of keywords. Yes visionInfo object Key information from images. Provided by the analyzeImages operation. Yes vectorStore string Serialized result of the vector database. Provided by the buildVectorStore operation. No retrievalResult string Results of knowledge retrieval. Provided by the retrieveKnowledge operation. No taskDescription string Task prompt. No rules string Custom extraction rules, e.g., for output formatting. No fewShot string Example prompts. No llmName string Name of the large language model. No llmParams object API parameters for the large language model. No returnPrompts boolean Whether to return the prompts used. Enabled by default. No

Currently, llmParams can take one of the following forms:

{\n\"apiType\": \"qianfan\",\n\"apiKey\": \"{Qianfan Platform API key}\",\n\"secretKey\": \"{Qianfan Platform secret key}\"\n}\n
{\n\"apiType\": \"aistudio\",\n\"accessToken\": \"{AI Studio access token}\"\n}\n
  • On successful request processing, the result in the response body has the following properties:
Name Type Description chatResult object Extracted key information. prompts object Prompts used.

Properties of prompts:

Name Type Description ocr string OCR prompt. table string Table prompt. html string HTML prompt. Multi-Language Service Invocation Examples Python
import base64\nimport pprint\nimport sys\n\nimport requests\n\nAPI_BASE_URL = \"http://0.0.0.0:8080\"\nAPI_KEY = \"{Qianfan Platform API key}\"\nSECRET_KEY = \"{Qianfan Platform secret key}\"\nLLM_NAME = \"ernie-3.5\"\nLLM_PARAMS = {\n    \"apiType\": \"qianfan\",\n    \"apiKey\": API_KEY,\n    \"secretKey\": SECRET_KEY,\n}\n\nfile_path = \"./demo.jpg\"\nkeys = [\"\u200b\u7535\u8bdd\u200b\"]\n\nwith open(file_path, \"rb\") as file:\n    file_bytes = file.read()\n    file_data = base64.b64encode(file_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": file_data,\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\nresp_vision = requests.post(url=f\"{API_BASE_URL}/chatocr-vision\", json=payload)\nif resp_vision.status_code != 200:\n    print(\n        f\"Request to chatocr-vision failed with status code {resp_vision.status_code}.\"\n    )\n    pprint.pp(resp_vision.json())\n    sys.exit(1)\nresult_vision = resp_vision.json()[\"result\"]\n\nfor i, res in enumerate(result_vision[\"visionResults\"]):\n    print(\"Texts:\")\n    pprint.pp(res[\"texts\"])\n    print(\"Tables:\")\n    pprint.pp(res[\"tables\"])\n    ocr_img_path = f\"ocr_{i}.jpg\"\n    with open(ocr_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"ocrImage\"]))\n    layout_img_path = f\"layout_{i}.jpg\"\n    with open(layout_img_path, \"wb\") as f:\n        f.write(base64.b64decode(res[\"layoutImage\"]))\n    print(f\"Output images saved at {ocr_img_path} and {layout_img_path}\")\n\npayload = {\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"minChars\": 200,\n    \"llmRequestInterval\": 1000,\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_vector = requests.post(url=f\"{API_BASE_URL}/chatocr-vector\", json=payload)\nif resp_vector.status_code != 200:\n    print(\n        f\"Request to chatocr-vector failed with status code {resp_vector.status_code}.\"\n    )\n    pprint.pp(resp_vector.json())\n    sys.exit(1)\nresult_vector = resp_vector.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n}\nresp_retrieval = requests.post(url=f\"{API_BASE_URL}/chatocr-retrieval\", json=payload)\nif resp_retrieval.status_code != 200:\n    print(\n        f\"Request to chatocr-retrieval failed with status code {resp_retrieval.status_code}.\"\n    )\n    pprint.pp(resp_retrieval.json())\n    sys.exit(1)\nresult_retrieval = resp_retrieval.json()[\"result\"]\n\npayload = {\n    \"keys\": keys,\n    \"visionInfo\": result_vision[\"visionInfo\"],\n    \"vectorStore\": result_vector[\"vectorStore\"],\n    \"retrievalResult\": result_retrieval[\"retrievalResult\"],\n    \"taskDescription\": \"\",\n    \"rules\": \"\",\n    \"fewShot\": \"\",\n    \"llmName\": LLM_NAME,\n    \"llmParams\": LLM_PARAMS,\n    \"returnPrompts\": True,\n}\nresp_chat = requests.post(url=f\"{API_BASE_URL}/chatocr-chat\", json=payload)\nif resp_chat.status_code != 200:\n    print(\n        f\"Request to chatocr-chat failed with status code {resp_chat.status_code}.\"\n    )\n    pprint.pp(resp_chat.json())\n    sys.exit(1)\nresult_chat = resp_chat.json()[\"result\"]\nprint(\"\\nPrompts:\")\npprint.pp(result_chat[\"prompts\"])\nprint(\"Final result:\")\nprint(result_chat[\"chatResult\"])\n
Note: Please fill in your API key and secret key at `API_KEY` and `SECRET_KEY`.

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the PP-ChatOCRv3-doc Pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can attempt to further fine-tune the existing models using your own domain-specific or application-specific data to enhance the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the PP-ChatOCRv3-doc Pipeline comprises six modules, unsatisfactory performance may stem from any of these modules (note that the text image rectification module does not support customization at this time).

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., row/column misidentification, cell position errors) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.

  • Misplaced layout elements (e.g., incorrect positioning of tables or seals) may suggest issues with the layout detection module. Consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.

  • Frequent undetected text (i.e., text leakage) may indicate limitations in the text detection model. Refer to the Customization section in the Text Detection Module Development Tutorial and fine-tune the text detection model using your private dataset.

  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest that the text recognition model requires improvement. Follow the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.

  • Frequent recognition errors in detected seal text indicate that the seal text detection model needs further refinement. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.

  • Frequent misidentifications of document or certificate orientations with text regions suggest that the document image orientation classification model requires improvement. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the document image orientation classification model.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#42-model-deployment","title":"4.2 Model Deployment","text":"

After fine-tuning your models using your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the default model weights with those of your fine-tuned models:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_3cls  # Replace with the local path of your fine-tuned model\n  table_model: SLANet_plus  # Replace with the local path of your fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Replace with the local path of your fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Replace with the local path of your fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det  # Replace with the local path of your fine-tuned model\n  doc_image_ori_cls_model: null   # Replace with the local path of your fine-tuned model if applicable\n  doc_image_unwarp_model: null   # Replace with the local path of your fine-tuned model if applicable\n......\n

Subsequently, load the modified pipeline configuration file using the command-line interface or Python script as described in the local experience section.

"},{"location":"en/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Seamless switching between different hardware can be achieved by simply setting the --device parameter.

For example, to perform inference using the PP-ChatOCRv3-doc Pipeline on an NVIDIA GPU. At this point, if you wish to switch the hardware to Ascend NPU, simply modify the --device in the script to npu:

from paddlex import create_pipeline\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"},\n    device=\"npu:0\" # gpu:0 --> npu:0\n    )\n

If you want to use the PP-ChatOCRv3-doc Pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html","title":"General OCR Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#1-introduction-to-ocr-pipeline","title":"1. Introduction to OCR Pipeline","text":"

OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols.

The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, reaching state-of-the-art (SOTA) performance in open-source projects for general scenarios. Based on this project, developers from academia, industry, and research have rapidly deployed various OCR applications across fields such as general use, manufacturing, finance, transportation, and more.

The General OCR Pipeline comprises a text detection module and a text recognition module, each containing several models. The specific models to use can be selected based on the benchmark data provided below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model size, choose models with smaller storage requirements.

Text detection module:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 The server-side text detection model of PP-OCRv4, featuring higher accuracy and suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 The mobile text detection model of PP-OCRv4, optimized for efficiency and suitable for deployment on edge devices

Text recognition module:

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4, developed by Baidu's PaddlePaddle Vision Team, is the next version of the PP-OCRv3 text recognition model. By introducing data augmentation schemes, GTC-NRTR guidance branches, and other strategies, it further improves text recognition accuracy without compromising model inference speed. The model offers both server and mobile versions to meet industrial needs in different scenarios. PP-OCRv4_server_rec Inference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more, with 1.1w images for text recognition. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2, a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University, also won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its A-rank end-to-end recognition accuracy is 6% higher than PP-OCRv4.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 A-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy(%) GPU Inference Time (ms) CPU Inference Time Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M RepSVTR, a mobile text recognition model based on SVTRv2, won first place in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge. Its B-rank end-to-end recognition accuracy is 2.5% higher than PP-OCRv4, with comparable inference speed.

Note: The evaluation set for the above accuracy metrics is the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge - Track 1 B-rank. GPU inference time for all models is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained models for the OCR Pipeline, allowing you to quickly experience its effects. You can try the General OCR Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General OCR Pipeline online using the official demo images for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. You can download the deployment package from the cloud or use the local experience method in Section 2.2. If not satisfied, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#22-local-experience","title":"2.2 Local Experience","text":"

\u2757 Before using the General OCR Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"
  • Experience the OCR Pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Parameter explanations:

--pipeline: The name of the pipeline, here it is OCR.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default OCR Pipeline configuration file is loaded. If you need to customize the configuration file, you can use the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config OCR\n

After execution, the OCR Pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config OCR --save_path ./my_path --device gpu:0\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./OCR.yaml, simply execute:

paddlex --pipeline ./OCR.yaml --input general_ocr_002.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'general_ocr_002.png', 'dt_polys': [[[5, 12], [88, 10], [88, 29], [5, 31]], [[208, 14], [249, 14], [249, 22], [208, 22]], [[695, 15], [824, 15], [824, 60], [695, 60]], [[158, 27], [355, 23], [356, 70], [159, 73]], [[421, 25], [659, 19], [660, 59], [422, 64]], [[337, 104], [460, 102], [460, 127], [337, 129]], [[486, 103], [650, 100], [650, 125], [486, 128]], [[675, 98], [835, 94], [835, 119], [675, 124]], [[64, 114], [192, 110], [192, 131], [64, 134]], [[210, 108], [318, 106], [318, 128], [210, 130]], [[82, 140], [214, 138], [214, 163], [82, 165]], [[226, 136], [328, 136], [328, 161], [226, 161]], [[404, 134], [432, 134], [432, 161], [404, 161]], [[509, 131], [570, 131], [570, 158], [509, 158]], [[730, 138], [771, 138], [771, 154], [730, 154]], [[806, 136], [817, 136], [817, 146], [806, 146]], [[342, 175], [470, 173], [470, 197], [342, 199]], [[486, 173], [616, 171], [616, 196], [486, 198]], [[677, 169], [813, 166], [813, 191], [677, 194]], [[65, 181], [170, 177], [171, 202], [66, 205]], [[96, 208], [171, 205], [172, 230], [97, 232]], [[336, 220], [476, 215], [476, 237], [336, 242]], [[507, 217], [554, 217], [554, 236], [507, 236]], [[87, 229], [204, 227], [204, 251], [87, 254]], [[344, 240], [483, 236], [483, 258], [344, 262]], [[66, 252], [174, 249], [174, 271], [66, 273]], [[75, 279], [264, 272], [265, 297], [76, 303]], [[459, 297], [581, 295], [581, 320], [459, 322]], [[101, 314], [210, 311], [210, 337], [101, 339]], [[68, 344], [165, 340], [166, 365], [69, 368]], [[345, 350], [662, 346], [662, 368], [345, 371]], [[100, 459], [832, 444], [832, 465], [100, 480]]], 'dt_scores': [0.8183103704439653, 0.7609575621092027, 0.8662357274035412, 0.8619508290334809, 0.8495855993183273, 0.8676840017933314, 0.8807986687956436, 0.822308525056085, 0.8686617037621976, 0.8279022169854463, 0.952332847006758, 0.8742692553015098, 0.8477013022907575, 0.8528771493227294, 0.7622965906848765, 0.8492388224448705, 0.8344203789965632, 0.8078477124353284, 0.6300434587457232, 0.8359967356998494, 0.7618617265751318, 0.9481573079350023, 0.8712182945408912, 0.837416955846334, 0.8292475059403851, 0.7860382856406026, 0.7350527486717117, 0.8701022267947695, 0.87172526903969, 0.8779847108088126, 0.7020437651809734, 0.6611684983372949], 'rec_text': ['www.997', '151', 'PASS', '\u200b\u767b\u673a\u724c\u200b', 'BOARDING', '\u200b\u8231\u4f4d\u200b CLASS', '\u200b\u5e8f\u53f7\u200bSERIALNO.', '\u200b\u5ea7\u4f4d\u53f7\u200bSEATNO', '\u200b\u822a\u73ed\u200b FLIGHT', '\u200b\u65e5\u671f\u200bDATE', 'MU 2379', '03DEC', 'W', '035', 'F', '1', '\u200b\u59cb\u53d1\u5730\u200bFROM', '\u200b\u767b\u673a\u53e3\u200b GATE', '\u200b\u767b\u673a\u200b\u65f6\u95f4\u200bBDT', '\u200b\u76ee\u7684\u5730\u200bTO', '\u200b\u798f\u5dde\u200b', 'TAIYUAN', 'G11', 'FUZHOU', '\u200b\u8eab\u4efd\u200b\u8bc6\u522b\u200bIDNO.', '\u200b\u59d3\u540d\u200bNAME', 'ZHANGQIWEI', '\u200b\u7968\u53f7\u200bTKTNO.', '\u200b\u5f20\u797a\u4f1f\u200b', '\u200b\u7968\u4ef7\u200bFARE', 'ETKT7813699238489/1', '\u200b\u767b\u673a\u53e3\u200b\u4e8e\u200b\u8d77\u98de\u524d\u200b10\u200b\u5206\u949f\u200b\u5173\u95ed\u200bGATESCLOSE1OMINUTESBEFOREDEPARTURETIME'], 'rec_score': [0.9617719054222107, 0.4199012815952301, 0.9652514457702637, 0.9978302121162415, 0.9853208661079407, 0.9445787072181702, 0.9714463949203491, 0.9841841459274292, 0.9564052224159241, 0.9959094524383545, 0.9386572241783142, 0.9825271368026733, 0.9356589317321777, 0.9985442161560059, 0.3965512812137604, 0.15236201882362366, 0.9976775050163269, 0.9547433257102966, 0.9974752068519592, 0.9646636843681335, 0.9907559156417847, 0.9895358681678772, 0.9374122023582458, 0.9909093379974365, 0.9796401262283325, 0.9899340271949768, 0.992210865020752, 0.9478569626808167, 0.9982215762138367, 0.9924325942993164, 0.9941263794898987, 0.96443772315979]}\n......\n

Among them, dt_polys is the detected text box coordinates, dt_polys is the detected text box coordinates, dt_scores is the confidence of the detected text box, rec_text is the detected text, rec_score is the detection Confidence in the text.

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#222-integration-via-python-script","title":"2.2.2 Integration via Python Script","text":"
  • Quickly perform inference on the production line with just a few lines of code, taking the general OCR production line as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"OCR\")\n\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the OCR production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the OCR production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/OCR.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/OCR.yaml\")\noutput = pipeline.predict(\"general_ocr_002.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the general OCR pipeline directly in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain OCR results from an image.

POST /ocr

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. image string OCR result image with detected text positions annotated. The image is in JPEG format and encoded in Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score.

Example of result:

{\n\"texts\": [\n{\n\"poly\": [\n[\n444,\n244\n],\n[\n705,\n244\n],\n[\n705,\n311\n],\n[\n444,\n311\n]\n],\n\"text\": \"Beijing South Railway Station\",\n\"score\": 0.9\n},\n{\n\"poly\": [\n[\n992,\n248\n],\n[\n1263,\n251\n],\n[\n1263,\n318\n],\n[\n992,\n315\n]\n],\n\"text\": \"Tianjin Railway Station\",\n\"score\": 0.5\n}\n],\n\"image\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\"\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string outputImagePath = \"./out.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/ocr\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"image\"];\n        std::string decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputImage(outPutImagePath, std::ios::binary | std::ios::out);\n        if (outputImage.is_open()) {\n            outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());\n            outputImage.close();\n            std::cout << \"Output image saved at \" << outPutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outPutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/ocr\";\n        String imagePath = \"./demo.jpg\";\n        String outputImagePath = \"./out.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String base64Image = result.get(\"image\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(base64Image);\n                try (FileOutputStream fos = new FileOutputStream(outputImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + outputImagePath);\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/ocr\"\n    imagePath := \"./demo.jpg\"\n    outputImagePath := \"./out.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Image      string   `json:\"image\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", outputImagePath)\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/ocr\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string outputImagePath = \"./out.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Image = jsonResponse[\"result\"][\"image\"].ToString();\n        byte[] outputImageBytes = Convert.FromBase64String(base64Image);\n\n        File.WriteAllBytes(outputImagePath, outputImageBytes);\n        Console.WriteLine($\"Output image saved at {outputImagePath}\");\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/ocr'\nconst imagePath = './demo.jpg'\nconst outputImagePath = \"./out.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    const imageBuffer = Buffer.from(result[\"image\"], 'base64');\n    fs.writeFile(outputImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${outputImagePath}`);\n    });\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/ocr\";\n$image_path = \"./demo.jpg\";\n$output_image_path = \"./out.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($output_image_path, base64_decode($result[\"image\"]));\necho \"Output image saved at \" . $output_image_path . \"\\n\";\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general OCR pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general OCR pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general OCR pipeline consists of two modules (text detection and text recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many texts are undetected (i.e., text miss detection), it may indicate that the text detection model needs improvement. You should refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model. If many recognition errors occur in detected texts (i.e., the recognized text content does not match the actual text content), it suggests that the text recognition model requires further refinement. You should refer to the Customization section in the Text Recognition Module Development Tutorial and fine-tune the text recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  det_model: PP-OCRv4_server_det  # Can be replaced with the local path of the fine-tuned text detection model\n  det_device: \"gpu\"\n  rec_model: PP-OCRv4_server_rec  # Can be replaced with the local path of the fine-tuned text recognition model\n  rec_batch_size: 1\n  rec_device: \"gpu\"\n......\n

Then, refer to the command line method or Python script method in 2.2 Local Experience to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/OCR.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for OCR pipeline inference, the Python command would be:

paddlex --pipeline OCR --input general_ocr_002.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline OCR --input general_ocr_002.png --device npu:0\n

If you want to use the General OCR pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html","title":"Formula Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#1-introduction-to-the-formula-recognition-pipeline","title":"1. Introduction to the Formula Recognition Pipeline","text":"

Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. Leveraging computer vision and machine learning algorithms, formula recognition converts complex mathematical formula information into editable LaTeX format, facilitating further data processing and analysis for users.

The Formula Recognition Pipeline comprises a layout detection module and a formula recognition module.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

Layout Detection Module Models:

Model NameModel Download Link mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.126 3827.25 470.2M

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout detection dataset, containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX supports experiencing the effects of the formula recognition pipeline through command line or Python locally.

Before using the formula recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

Experience the formula recognition pipeline with a single command, using the test file, and replace --input with your local path for prediction:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n

Parameter Explanation:

--pipeline: The pipeline name, which is formula_recognition for this case.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). Alternatively, use CPU (--device cpu).\n

When executing the above command, the default formula recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_config formula_recognition\n

After execution, the formula recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can run the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config formula_recognition --save_path ./my_path\n

After obtaining the Pipeline configuration file, replace --pipeline with the configuration file's save path to make the configuration file effective. For example, if the configuration file is saved as ./formula_recognition.yaml, simply execute:

paddlex --pipeline ./formula_recognition.yaml --input general_formula_recognition.png --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After execution, the result is:

\ud83d\udc49Click to Expand
{'input_path': 'general_formula_recognition.png', 'layout_result': {'input_path': 'general_formula_recognition.png', 'boxes': [{'cls_id': 3, 'label': 'number', 'score': 0.7580855488777161, 'coordinate': [1028.3635, 205.46213, 1038.953, 222.99033]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.8882032632827759, 'coordinate': [272.75305, 204.50894, 433.7473, 226.17996]}, {'cls_id': 2, 'label': 'text', 'score': 0.9685840606689453, 'coordinate': [272.75928, 282.17773, 1041.9316, 374.44687]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559416770935059, 'coordinate': [272.39056, 385.54114, 1044.1521, 443.8598]}, {'cls_id': 2, 'label': 'text', 'score': 0.9610629081726074, 'coordinate': [272.40817, 467.2738, 1045.1033, 563.4855]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8916195034980774, 'coordinate': [503.45743, 594.6236, 1040.6804, 619.73895]}, {'cls_id': 2, 'label': 'text', 'score': 0.973675549030304, 'coordinate': [272.32007, 648.8599, 1040.8702, 775.15686]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9038916230201721, 'coordinate': [554.2307, 803.5825, 1040.4657, 855.3159]}, {'cls_id': 2, 'label': 'text', 'score': 0.9025381803512573, 'coordinate': [272.535, 875.1402, 573.1086, 898.3587]}, {'cls_id': 2, 'label': 'text', 'score': 0.8336610794067383, 'coordinate': [317.48013, 909.60864, 966.8498, 933.7868]}, {'cls_id': 2, 'label': 'text', 'score': 0.8779091238975525, 'coordinate': [19.704018, 653.322, 72.433235, 1215.1992]}, {'cls_id': 2, 'label': 'text', 'score': 0.8832409977912903, 'coordinate': [272.13028, 958.50806, 1039.7928, 1019.476]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9088466167449951, 'coordinate': [517.1226, 1042.3978, 1040.2208, 1095.7457]}, {'cls_id': 2, 'label': 'text', 'score': 0.9587949514389038, 'coordinate': [272.03336, 1112.9269, 1041.0201, 1206.8417]}, {'cls_id': 2, 'label': 'text', 'score': 0.8885666131973267, 'coordinate': [271.7495, 1231.8752, 710.44495, 1255.7981]}, {'cls_id': 7, 'label': 'formula', 'score': 0.8907185196876526, 'coordinate': [581.2295, 1287.4525, 1039.8014, 1312.772]}, {'cls_id': 2, 'label': 'text', 'score': 0.9559596180915833, 'coordinate': [273.1827, 1341.421, 1041.0299, 1401.7255]}, {'cls_id': 2, 'label': 'text', 'score': 0.875311553478241, 'coordinate': [272.8338, 1427.3711, 789.7108, 1451.1359]}, {'cls_id': 7, 'label': 'formula', 'score': 0.9152213931083679, 'coordinate': [524.9582, 1474.8136, 1041.6333, 1530.7142]}, {'cls_id': 2, 'label': 'text', 'score': 0.9584835767745972, 'coordinate': [272.81665, 1549.524, 1042.9962, 1608.7157]}]}, 'ocr_result': {}, 'table_result': [], 'dt_polys': [array([[ 503.45743,  594.6236 ],\n       [1040.6804 ,  594.6236 ],\n       [1040.6804 ,  619.73895],\n       [ 503.45743,  619.73895]], dtype=float32), array([[ 554.2307,  803.5825],\n       [1040.4657,  803.5825],\n       [1040.4657,  855.3159],\n       [ 554.2307,  855.3159]], dtype=float32), array([[ 517.1226, 1042.3978],\n       [1040.2208, 1042.3978],\n       [1040.2208, 1095.7457],\n       [ 517.1226, 1095.7457]], dtype=float32), array([[ 581.2295, 1287.4525],\n       [1039.8014, 1287.4525],\n       [1039.8014, 1312.772 ],\n       [ 581.2295, 1312.772 ]], dtype=float32), array([[ 524.9582, 1474.8136],\n       [1041.6333, 1474.8136],\n       [1041.6333, 1530.7142],\n       [ 524.9582, 1530.7142]], dtype=float32)], 'rec_formula': ['F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)', 'p(\\mathbf{x})=c(\\mathbf{u})\\prod_{i}p(x_{i}).\\qquad\\qquad\\qquad\\qquad\\qquad\\quad\\quad~~\\quad~~~~~~~~~~~~~~~(2)', 'H_{c}({\\bf x})=-\\int_{{\\bf{u}}}c({\\bf{u}})\\log c({\\bf{u}})d{\\bf{u}}.~~~~~~~~~~~~~~~~~~~~~(3)', 'I({\\bf x})=-H_{c}({\\bf x}).\\qquad\\qquad\\qquad\\qquad(4)', 'H({\\bf x})=\\sum_{i}H(x_{i})+H_{c}({\\bf x}).\\eqno\\qquad\\qquad\\qquad(5)']}\n

Where dt_polys represents the coordinates of the detected formula area, and rec_formula is the detected formula.

The visualization result is as follows:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path. Formula recognition visualization requires a separate environment configuration. Please refer to 2.3 Formula Recognition Pipeline Visualization to install the LaTeX rendering engine.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"
  • Quickly perform inference on the pipeline with just a few lines of code, taking the formula recognition pipeline as an example:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n

\u2757 The results obtained from running the Python script are the same as those from the command line.

The Python script above executes the following steps:

\uff081\uff09Instantiate the formula recognition pipeline object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it is the name of the pipeline, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

\uff082\uff09Invoke the predict method of the formula recognition pipeline object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the formula recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/formula_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/formula_recognition.yaml\")\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#23-formula-recognition-pipeline-visualization","title":"2.3 Formula Recognition Pipeline Visualization","text":"

If you need to visualize the formula recognition pipeline, you need to run the following command to install the LaTeX rendering environment:

apt-get install sudo\nsudo apt-get update\nsudo apt-get install texlive\nsudo apt-get install texlive-latex-base\nsudo apt-get install texlive-latex-extra\n
After that, use the save_to_img method to save the visualization image. The specific command is as follows:
from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"formula_recognition\")\n\noutput = pipeline.predict(\"general_formula_recognition.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\")\n
Note: Since the formula recognition visualization process requires rendering each formula image, it may take a relatively long time. Please be patient.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the formula recognition pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

If you need to apply the formula recognition pipeline directly in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Obtain formula recognition results from an image.

POST /formula-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the layout detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description formulas array Positions and contents of formulas. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in formulas is an object with the following properties:

Name Type Description poly array Formula position. Elements in the array are the vertex coordinates of the polygon enclosing the formula. latex string Formula content.

Example of result:

{\n\"formulas\": [\n{\n\"poly\": [\n[\n444.0,\n244.0\n],\n[\n705.4,\n244.5\n],\n[\n705.8,\n311.3\n],\n[\n444.1,\n311.0\n]\n],\n\"latex\": \"F({\\bf x})=C(F_{1}(x_{1}),\\cdot\\cdot\\cdot,F_{N}(x_{N})).\\qquad\\qquad\\qquad(1)\"\n}\n],\n\"layoutImage\": \"xxxxxx\",\n\"ocrImage\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/formula-recognition\"\nimage_path = \"./demo.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected formulas:\")\nprint(result[\"formulas\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/formula-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto formulas = result[\"formulas\"];\n        std::cout << \"\\nDetected formulas:\" << std::endl;\n        for (const auto& formula : formulas) {\n            std::cout << formula << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/formula-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode formulas = result.get(\"formulas\");\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected formulas: \" + formulas.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/formula-recognition\"\n    imagePath := \"./demo.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            LayoutImage      string   `json:\"layoutImage\"`\n            Formulas []map[string]interface{} `json:\"formulas\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected formulas:\")\n    for _, formula := range respData.Result.Formulas {\n        fmt.Println(formula)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/formula-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected formulas:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"formulas\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/formula-recognition'\nconst imagePath = './demo.jpg'\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected formulas:\");\n    console.log(result[\"formulas\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/formula-recognition\"\n$image_path = \"./demo.jpg\";\n$layout_image_path = \"./layout.jpg\"\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected formulas:\\n\";\nprint_r($result[\"formulas\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. You can choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the formula recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the formula recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the formula recognition pipeline consists of two modules (layout detection and formula recognition), unsatisfactory performance may stem from either module.

You can analyze images with poor recognition results. If you find that many formula are undetected (i.e., formula miss detection), it may indicate that the layout detection model needs improvement. You should refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model. If many recognition errors occur in detected formula (i.e., the recognized formula content does not match the actual formula content), it suggests that the formula recognition model requires further refinement. You should refer to the Customization section in the Formula Recognition Module Development Tutorial and fine-tune the formula recognition model.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

If you need to use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the pipeline configuration file:

......\nPipeline:\n  layout_model: RT-DETR-H_layout_17cls # Can be replaced with the local path of the fine-tuned layout detection model\n  formula_rec_model: LaTeX_OCR_rec # Can be replaced with the local path of the fine-tuned formula recognition model\n  formula_rec_batch_size: 5\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in 2. Quick Start to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/formula_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modifying the --device parameter allows seamless switching between different hardware.

For example, if you are using an NVIDIA GPU for formula pipeline inference, the Python command would be:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device gpu:0\n
Now, if you want to switch the hardware to Ascend NPU, you only need to modify the --device in the Python command:

paddlex --pipeline formula_recognition --input general_formula_recognition.png --device npu:0\n

If you want to use the formula recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html","title":"General Layout Parsing Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#1-introduction-to-the-general-layout-parsing-pipeline","title":"1. Introduction to the General Layout Parsing Pipeline","text":"

Layout parsing is a technology that extracts structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has extensive applications in document management, information extraction, and data digitization. By combining Optical Character Recognition (OCR), image processing, and machine learning algorithms, layout parsing can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. The process typically involves three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data to improve data processing efficiency and accuracy.

The General Layout Parsing Pipeline includes modules for table structure recognition, layout region analysis, text detection, text recognition, formula recognition, seal text detection, text image rectification, and document image orientation classification.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, choose a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

\ud83d\udc49Model List Details

Table Structure Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, the table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves the recognition ability for wireless and complex tables and reduces the model's sensitivity to the accuracy of table positioning, enabling more accurate recognition even with offset table positioning.

Note: The above accuracy metrics are measured on PaddleX's internally built English table recognition dataset. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Detection Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 109 PP-OCRv4's server-side text detection model, featuring higher accuracy, suitable for deployment on high-performance servers PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.7 PP-OCRv4's mobile text detection model, optimized for efficiency, suitable for deployment on edge devices

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4 is the next version of Baidu PaddlePaddle's self-developed text recognition model PP-OCRv3. By introducing data augmentation schemes and GTC-NRTR guidance branches, it further improves text recognition accuracy without compromising inference speed. The model offers both server (server) and mobile (mobile) versions to meet industrial needs in different scenarios. PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition. All GPU inference times are based on NVIDIA Tesla T4 machines with FP32 precision. CPU inference speeds are based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_SVTRv2_recInference Model/Trained Model 68.81 8.36801 165.706 73.9 M SVTRv2 is a server-side text recognition model developed by the OpenOCR team at the Vision and Learning Lab (FVL) of Fudan University. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 6% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the A-list.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task A-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

ModelModel Download Link Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description ch_RepSVTR_recInference Model/Trained Model 65.07 10.5047 51.5647 22.1 M The RepSVTR text recognition model is a mobile-oriented text recognition model based on SVTRv2. It won the first prize in the OCR End-to-End Recognition Task of the PaddleOCR Algorithm Model Challenge, with a 2.5% improvement in end-to-end recognition accuracy compared to PP-OCRv4 on the B-list, while maintaining similar inference speed.

Note: The evaluation set for the above accuracy metrics is the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task B-list. GPU inference time is based on NVIDIA Tesla T4 with FP32 precision. CPU inference speed is based on Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Formula Recognition Module Models:

Model NameModel Download Link BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size LaTeX_OCR_recInference Model/Trained Model 0.8821 0.0823 40.01 - - 89.7 M

Note: The above accuracy metrics are measured on the LaTeX-OCR Formula Recognition Test Set. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Text Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal text detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal text detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Image Rectification Module Models:

ModelModel Download Link MS-SSIM (%) Model Size (M) Description UVDocInference Model/Trained Model 54.40 30.3 M High-precision text image rectification model

The accuracy metrics of the models are measured from the DocUNet benchmark.

Document Image Orientation Classification Module Models:

ModelModel Download Link Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-LCNet_x1_0_doc_oriInference Model/Trained Model 99.06 3.84845 9.23735 7 A document image classification model based on PP-LCNet_x1_0, with four categories: 0\u00b0, 90\u00b0, 180\u00b0, 270\u00b0

Note: The above accuracy metrics are evaluated on a self-built dataset covering various scenarios such as certificates and documents, containing 1000 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effect of the General Image Classification pipeline online, or locally using command line or Python.

Before using the General Layout Parsing pipeline locally, please ensure you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#21-experience-via-command-line","title":"2.1 Experience via Command Line","text":"

One command is all you need to quickly experience the effect of the Layout Parsing pipeline. Use the test file and replace --input with your local path to make predictions.

paddlex --pipeline layout_parsing --input demo_paper.png --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the Layout Parsing pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 indicates using the first GPU, gpu:1,2 indicates using the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default Layout Parsing pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config layout_parsing\n

After execution, the layout parsing pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config layout_parsing --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the saved path of the configuration file to make it take effect. For example, if the configuration file is saved as ./layout_parsing.yaml, simply execute:

paddlex --pipeline ./layout_parsing.yaml --input layout_parsing.jpg\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If these parameters are still specified, the specified parameters will take precedence.

After running, the result will be:

\ud83d\udc49Click to expand
{'input_path': PosixPath('/root/.paddlex/temp/tmp5jmloefs.png'), 'parsing_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmpshsq8_w0.png'), 'layout_bbox': [51.46833, 74.22329, 542.4082, 232.77504], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [213, 221, 238],\n        [217, 223, 240],\n        [233, 234, 241]],\n\n       [[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpcd2q9uyu.png'), 'layout_bbox': [47.68295, 243.08054, 546.28253, 295.71045], 'figure_title': 'Overview of RT-DETR, We feed th', 'layout': 'single'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpr_iqa8b3.png'), 'layout_bbox': [58.416977, 304.1531, 275.9134, 400.07513], 'image': {'img': array([[[255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255],\n        ...,\n        [255, 255, 255],\n        [255, 255, 255],\n        [255, 255, 255]]], dtype=uint8), 'image_text': ''}, 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmphpblxl3p.png'), 'layout_bbox': [100.62961, 405.97458, 234.79774, 414.77414], 'figure_title': 'Figure 5. The fusion block in CCFF.', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmplgnczrsf.png'), 'layout_bbox': [47.81724, 421.9041, 288.01566, 550.538], 'text': 'D, Ds, not only significantly reduces latency (35% faster),\\nRut\\nnproves accuracy (0.4% AP higher), CCFF is opti\\nased on the cross-scale fusion module, which\\nnsisting of convolutional lavers intc\\npath.\\nThe role of the fusion block is t\\n into a new feature, and its\\nFigure 5. The f\\nblock contains tw\\n1 x1\\nchannels, /V RepBlock\\n. anc\\n: two-path outputs are fused by element-wise add. We\\ntormulate the calculation ot the hvbrid encoder as:', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpsq0ey9md.png'), 'layout_bbox': [94.60716, 558.703, 288.04193, 600.19434], 'formula': '\\\\begin{array}{l}{{\\\\Theta=K=\\\\mathrm{p.s.sp{\\\\pm}}\\\\mathrm{i.s.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}(\\\\mathrm{l.s.}}),{\\\\qquad\\\\mathrm{{a.s.}}\\\\mathrm{s.}}}\\\\\\\\ {{\\\\tau_{\\\\mathrm{{s.s.s.s.s.}}(\\\\mathrm{l.s.},\\\\mathrm{l.s.},\\\\mathrm{s.s.}}\\\\mathrm{s.}\\\\mathrm{s.}}\\\\end{array}),}}\\\\\\\\ {{\\\\bar{\\\\mathrm{e-c.c.s.s.}(\\\\mathrm{s.},\\\\mathrm{s.s.},\\\\ s_{s}}\\\\mathrm{s.s.},\\\\tau),}}\\\\end{array}', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpv30qy0v4.png'), 'layout_bbox': [47.975555, 607.12024, 288.5776, 629.1252], 'text': 'tened feature to the same shape as Ss.\\nwhere Re shape represents restoring the shape of the flat-', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp0jejzwwv.png'), 'layout_bbox': [48.383354, 637.581, 245.96404, 648.20496], 'paragraph_title': '4.3. Uncertainty-minimal Query Selection', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpushex416.png'), 'layout_bbox': [47.80134, 656.002, 288.50192, 713.24994], 'text': 'To reduce the difficulty of optimizing object queries in\\nDETR, several subsequent works [42, 44, 45] propose query\\nselection schemes, which have in common that they use the\\nconfidence score to select the top K\u2019 features from the en-\\ncoder to initialize object queries (or just position queries).', 'layout': 'left'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpki7e_6wc.png'), 'layout_bbox': [306.6371, 302.1026, 546.3772, 419.76724], 'text': 'The confidence score represents the likelihood that the fea\\nture includes foreground objects. Nevertheless, the \\nare required to simultaneously model the category\\nojects, both of which determine the quality of the\\npertor\\ncore of the fes\\nBased on the analysis, the current query\\n considerable level of uncertainty in the\\nresulting in sub-optimal initialization for\\nand hindering the performance of the detector.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmppbxrfehp.png'), 'layout_bbox': [306.0642, 422.7347, 546.9216, 539.45734], 'text': 'To address this problem, we propose the uncertainty mini\\nmal query selection scheme, which explicitly const\\noptim\\n the epistemic uncertainty to model the\\nfeatures, thereby providing \\nhigh-quality\\nr the decoder. Specifically,\\n the discrepancy between i\\nalization P\\nand classificat\\n.(2\\ntunction for the gradie', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp1mgiyd21.png'), 'layout_bbox': [331.52808, 549.32635, 546.5229, 586.15546], 'formula': '\\\\begin{array}{c c c}{{}}&{{}}&{{\\\\begin{array}{c}{{i\\\\langle X\\\\rangle=({\\\\bar{Y}}({\\\\bar{X}})+{\\\\bar{Z}}({\\\\bar{X}})\\\\mid X\\\\in{\\\\bar{\\\\pi}}^{\\\\prime}}}&{{}}\\\\\\\\ {{}}&{{}}&{{}}\\\\end{array}}}&{{\\\\emptyset}}\\\\\\\\ {{}}&{{}}&{{C(\\\\bar{X},{\\\\bar{X}})=C..\\\\scriptstyle(\\\\bar{0},{\\\\bar{Y}})+{\\\\mathcal{L}}_{{\\\\mathrm{s}}}({\\\\bar{X}}),\\\\ 6)}}&{{}}\\\\end{array}', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmp8t73dpym.png'), 'layout_bbox': [306.44016, 592.8762, 546.84314, 630.60126], 'text': 'where  and y denote the prediction and ground truth,\\n= (c, b), c and b represent the category and bounding\\nbox respectively, X represent the encoder feature.', 'layout': 'right'}, {'input_path': PosixPath('/root/.paddlex/temp/tmpftnxeyjm.png'), 'layout_bbox': [306.15652, 632.3142, 546.2463, 713.19073], 'text': 'Effectiveness analysis. To analyze the effectiveness of the\\nuncertainty-minimal query selection, we visualize the clas-\\nsificatior\\nscores and IoU scores of the selected fe\\nCOCO\\na 12017, Figure 6. We draw the scatterplo\\nt with\\ndots\\nrepresent the selected features from the model trained\\nwith uncertainty-minimal query selection and vanilla query', 'layout': 'right'}]}\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference on your production line. Taking the general layout parsing pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"layout_parsing\")\n\noutput = pipeline.predict(\"demo_paper.png\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the result as an image file\n    res.save_to_xlsx(\"./output/\")  # Save the result as an Excel file\n    res.save_to_html(\"./output/\")  # Save the result as an HTML file\n
The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object to perform inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above data types, e.g., [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

(4) Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving as files, with the supported file types depending on the specific pipeline, such as:

Method Description Method Parameters save_to_img Saves the result as an image file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name. save_to_html Saves the result as an HTML file. - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

| save_to_xlsx | Saves the result as an Excel file. | - save_path: str type, the path to save the file. When it's a directory, the saved file name is consistent with the input file name.

Within this tutorial on Artificial Intelligence and Computer Vision, we will explore the capabilities of saving and exporting results from various processes, including OCR (Optical Character Recognition), layout analysis, and table structure recognition. Specifically, the save_to_img function enables saving visualization results, save_to_html converts tables directly into HTML files, and save_to_xlsx exports tables as Excel files.

Upon obtaining the configuration file, you can customize various settings for the layout parsing pipeline by simply modifying the pipeline parameter within the create_pipeline method to point to your configuration file path.

For instance, if your configuration file is saved at ./my_path/layout_parsing.yaml, you can execute the following code:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/layout_parsing.yaml\")\noutput = pipeline.predict(\"layout_parsing.jpg\")\nfor res in output:\n    res.print()  # Prints the structured output of the layout parsing prediction\n    res.save_to_img(\"./output/\")  # Saves the img format results from each submodule of the pipeline\n    res.save_to_xlsx(\"./output/\")  # Saves the xlsx format results from the table recognition module\n    res.save_to_html(\"./output/\")  # Saves the html results from the table recognition module\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements in terms of inference speed and accuracy, you can proceed with development integration or deployment.

To directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX offers three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In production environments, many applications require stringent performance metrics, especially response speed, to ensure efficient operation and smooth user experience. PaddleX provides a high-performance inference plugin that deeply optimizes model inference and pre/post-processing for significant end-to-end speedups. For detailed instructions on high-performance inference, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service Deployment: Service deployment is a common form in production environments, where reasoning functions are encapsulated as services accessible via network requests. PaddleX enables cost-effective service deployment of pipelines. For detailed instructions on service deployment, refer to the PaddleX Service Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body attributes are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result attribute, of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body attributes are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs layout parsing.

POST /layout-parsing

  • Request body attributes:
Name Type Description Required file string The URL of an image file or PDF file accessible by the service, or the Base64 encoded result of the content of the above-mentioned file types. For PDF files with more than 10 pages, only the content of the first 10 pages will be used. Yes fileType integer File type. 0 indicates a PDF file, 1 indicates an image file. If this attribute is not present in the request body, the service will attempt to infer the file type automatically based on the URL. No useImgOrientationCls boolean Whether to enable document image orientation classification. This function is enabled by default. No useImgUnwrapping boolean Whether to enable text image rectification. This function is enabled by default. No useSealTextDet boolean Whether to enable seal text detection. This function is enabled by default. No inferenceParams object Inference parameters. No

Attributes of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following attributes:
Name Type Description layoutParsingResults array Layout parsing results. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file.

Each element in layoutParsingResults is an object with the following attributes:

Name Type Description layoutElements array Layout element information.

Each element in layoutElements is an object with the following attributes:

Name Type Description bbox array Position of the layout element. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. label string Label of the layout element. text string Text contained in the layout element. layoutType string Arrangement of the layout element. image string Image of the layout element, in JPEG format, encoded using Base64. Multi-language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/layout-parsing\" # \u200b\u670d\u52a1\u200bURL\n\n# \u200b\u5bf9\u200b\u672c\u5730\u200b\u56fe\u50cf\u200b\u8fdb\u884c\u200bBase64\u200b\u7f16\u7801\u200b\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\n    \"file\": image_data, # Base64\u200b\u7f16\u7801\u200b\u7684\u200b\u6587\u4ef6\u200b\u5185\u5bb9\u200b\u6216\u8005\u200b\u6587\u4ef6\u200bURL\n    \"fileType\": 1,\n    \"useImgOrientationCls\": True,\n    \"useImgUnwrapping\": True,\n    \"useSealTextDet\": True,\n}\n\n# \u200b\u8c03\u7528\u200bAPI\nresponse = requests.post(API_URL, json=payload)\n\n# \u200b\u5904\u7406\u200b\u63a5\u53e3\u200b\u8fd4\u56de\u200b\u6570\u636e\u200b\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(\"\\nDetected layout elements:\")\nfor res in result[\"layoutParsingResults\"]:\n    for ele in res[\"layoutElements\"]:\n        print(\"===============================\")\n        print(\"bbox:\", ele[\"bbox\"])\n        print(\"label:\", ele[\"label\"])\n        print(\"text:\", repr(ele[\"text\"]))\n

\ud83d\udcf1 Edge Deployment: Edge deployment refers to placing computational and data processing capabilities directly on user devices, enabling them to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can choose an appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general layout parsing pipeline do not meet your requirements in terms of accuracy or speed for your specific scenario, you can try to further fine-tune the existing models using your own domain-specific or application-specific data to improve the recognition performance of the general layout parsing pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general layout parsing pipeline consists of 7 modules, unsatisfactory performance may stem from any of these modules.

You can analyze images with poor recognition results and follow the guidelines below for analysis and model fine-tuning:

  • Incorrect table structure detection (e.g., wrong row/column recognition, incorrect cell positions) may indicate deficiencies in the table structure recognition module. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and fine-tune the table structure recognition model using your private dataset.
  • Misplaced layout elements (e.g., incorrect positioning of tables, seals) may suggest issues with the layout detection module. You should consult the Customization section in the Layout Detection Module Development Tutorial and fine-tune the layout detection model with your private dataset.
  • Frequent undetected texts (i.e., text missing detection) indicate potential weaknesses in the text detection model. Follow the Customization section in the Text Detection Module Development Tutorial to fine-tune the text detection model using your private dataset.
  • High text recognition errors (i.e., recognized text content does not match the actual text) suggest further improvements to the text recognition model. Refer to the Customization section in the Text Recognition Module Development Tutorial to fine-tune the text recognition model.
  • Frequent recognition errors in detected seal texts indicate the need for improvements to the seal text detection model. Consult the Customization section in the Seal Text Detection Module Development Tutorials to fine-tune the seal text detection model.
  • High recognition errors in detected formulas (i.e., recognized formula content does not match the actual formula) suggest further enhancements to the formula recognition model. Follow the Customization section in the Formula Recognition Module Development Tutorial to fine-tune the formula recognition model.
  • Frequent misclassifications of document or certificate orientations with text areas indicate the need for improvements to the document image orientation classification model. Refer to the Customization section in the Document Image Orientation Classification Module Development Tutorial to fine-tune the model.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local paths of the fine-tuned model weights to the corresponding positions in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet_plus  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_server_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_server_rec  # Can be modified to the local path of the fine-tuned model\n  formula_rec_model: LaTeX_OCR_rec  # Can be modified to the local path of the fine-tuned model\n  seal_text_det_model: PP-OCRv4_server_seal_det   # Can be modified to the local path of the fine-tuned model\n  doc_image_unwarp_model: UVDoc  # Can be modified to the local path of the fine-tuned model\n  doc_image_ori_cls_model: PP-LCNet_x1_0_doc_ori  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script methods in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/layout_parsing.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference in the layout parsing pipeline, the Python command is:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device gpu:0\n
At this point, if you want to switch the hardware to Ascend NPU, simply modify --device to npu in the Python command:

paddlex --pipeline layout_parsing --input layout_parsing.jpg --device npu:0\n
If you want to use the general layout parsing pipeline on more types of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html","title":"Seal Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#1-introduction-to-the-seal-recognition-pipeline","title":"1. Introduction to the Seal Recognition Pipeline","text":"

Seal recognition is a technology that automatically extracts and recognizes seal content from documents or images. The recognition of seal is part of document processing and has various applications in many scenarios, such as contract comparison, inventory access approval, and invoice reimbursement approval.

The Seal Recognition pipeline includes a layout area analysis module, a seal detection module, and a text recognition module.

If you prioritize model accuracy, please choose a model with higher accuracy. If you prioritize inference speed, please choose a model with faster inference. If you prioritize model storage size, please choose a model with a smaller storage footprint.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Seal Detection Module Models:

ModelModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PP-OCRv4_server_seal_detInference Model/Trained Model 98.21 84.341 2425.06 109 PP-OCRv4's server-side seal detection model, featuring higher accuracy, suitable for deployment on better-equipped servers PP-OCRv4_mobile_seal_detInference Model/Trained Model 96.47 10.5878 131.813 4.6 PP-OCRv4's mobile seal detection model, offering higher efficiency, suitable for deployment on edge devices

Note: The above accuracy metrics are evaluated on a self-built dataset containing 500 circular seal images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Recognition Module Models:

Model NameModel Download Link Average Recognition Accuracy (%) GPU Inference Time (ms) CPU Inference Time Model Size (M) PP-OCRv4_mobile_recInference Model/Trained Model 78.20 7.95018 46.7868 10.6 M PP-OCRv4_server_recInference Model/Trained Model 79.20 7.19439 140.179 71.2 M

Note: The evaluation set for the above accuracy indicators is a self-built Chinese dataset from PaddleOCR, covering various scenarios such as street scenes, web images, documents, and handwriting. The text recognition subset includes 11,000 images. The GPU inference time for all models above is based on an NVIDIA Tesla T4 machine with a precision type of FP32. The CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads, and the precision type is also FP32.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#2-quick-start","title":"2. Quick Start","text":"

The pre trained model production line provided by PaddleX can quickly experience the effect. You can experience the effect of the seal recognition production line online, or use the command line or Python locally to experience the effect of the seal recognition production line.

Before using the seal recognition production line locally, please ensure that you have completed the wheel package installation of PaddleX according to the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#21-command-line-experience","title":"2.1 Command line experience","text":"

One command can quickly experience the effect of seal recognition production line, use test file, and replace --input with the local path for prediction

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

Parameter description:

--Pipeline: Production line name, here is the seal recognition production line\n--Input: The local path or URL of the input image to be processed\n--The GPU serial number used by the device (e.g. GPU: 0 indicates the use of the 0th GPU, GPU: 1,2 indicates the use of the 1st and 2nd GPUs), or the CPU (-- device CPU) can be selected for use\n

When executing the above Python script, the default seal recognition production line configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49 Click to expand
paddlex --get_pipeline_config seal_recognition\n

After execution, the seal recognition production line configuration file will be saved in the current path. If you want to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config seal_recognition --save_path ./my_path --save_path output\n

After obtaining the production line configuration file, you can replace '-- pipeline' with the configuration file save path to make the configuration file effective. For example, if the configuration file save path is / seal_recognition.yaml\uff0c Just need to execute:

paddlex --pipeline ./seal_recognition.yaml --input seal_text_det.png --save_path output\n

Among them, parameters such as --model and --device do not need to be specified and will use the parameters in the configuration file. If the parameters are still specified, the specified parameters will prevail.

After running, the result obtained is:

\ud83d\udc49 Click to expand
{'input_path': 'seal_text_det.png', 'layout_result': {'input_path': 'seal_text_det.png', 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9813116192817688, 'coordinate': [0, 5.2238655, 639.59766, 637.6985]}]}, 'ocr_result': [{'input_path': PosixPath('/root/.paddlex/temp/tmp19fn93y5.png'), 'dt_polys': [array([[468, 469],\n       [472, 469],\n       [477, 471],\n       [507, 501],\n       [509, 505],\n       [509, 509],\n       [508, 513],\n       [506, 514],\n       [456, 553],\n       [454, 555],\n       [391, 581],\n       [388, 581],\n       [309, 590],\n       [306, 590],\n       [234, 577],\n       [232, 577],\n       [172, 548],\n       [170, 546],\n       [121, 504],\n       [118, 501],\n       [118, 496],\n       [119, 492],\n       [121, 490],\n       [152, 463],\n       [156, 461],\n       [160, 461],\n       [164, 463],\n       [202, 495],\n       [252, 518],\n       [311, 530],\n       [371, 522],\n       [425, 501],\n       [464, 471]]), array([[442, 439],\n       [445, 442],\n       [447, 447],\n       [449, 490],\n       [448, 494],\n       [446, 497],\n       [440, 499],\n       [197, 500],\n       [193, 499],\n       [190, 496],\n       [188, 491],\n       [188, 448],\n       [189, 444],\n       [192, 441],\n       [197, 439],\n       [438, 438]]), array([[465, 341],\n       [470, 344],\n       [472, 346],\n       [476, 356],\n       [476, 419],\n       [475, 424],\n       [472, 428],\n       [467, 431],\n       [462, 433],\n       [175, 434],\n       [170, 433],\n       [166, 430],\n       [163, 426],\n       [161, 420],\n       [161, 354],\n       [162, 349],\n       [165, 345],\n       [170, 342],\n       [175, 340],\n       [460, 340]]), array([[326,  34],\n       [481,  85],\n       [485,  88],\n       [488,  90],\n       [584, 220],\n       [586, 225],\n       [587, 229],\n       [589, 378],\n       [588, 383],\n       [585, 388],\n       [581, 391],\n       [576, 393],\n       [570, 392],\n       [507, 373],\n       [502, 371],\n       [498, 367],\n       [496, 359],\n       [494, 255],\n       [423, 162],\n       [322, 129],\n       [246, 151],\n       [205, 169],\n       [144, 252],\n       [139, 360],\n       [137, 365],\n       [134, 369],\n       [128, 373],\n       [ 66, 391],\n       [ 61, 392],\n       [ 56, 390],\n       [ 51, 387],\n       [ 48, 382],\n       [ 47, 377],\n       [ 49, 230],\n       [ 50, 225],\n       [ 52, 221],\n       [149,  89],\n       [153,  86],\n       [157,  84],\n       [318,  34],\n       [322,  33]])], 'dt_scores': [0.9943362380813267, 0.9994290391836306, 0.9945320407374245, 0.9908104427126033], 'rec_text': ['5263647368706', '\u200b\u5417\u200b\u7e41\u7269\u200b', '\u200b\u53d1\u7968\u200b\u4e13\u7528\u7ae0\u200b', '\u200b\u5929\u6d25\u200b\u541b\u548c\u7f18\u200b\u5546\u8d38\u200b\u6709\u9650\u516c\u53f8\u200b'], 'rec_score': [0.9921098351478577, 0.997374951839447, 0.9999369382858276, 0.9901710152626038]}]}\n

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code can complete the fast inference of the production line. Taking the seal recognition production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"seal_recognition\")\n\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print()\n    res.save_to_img(\"./output/\") # Save the results in img\n

The result obtained is the same as the command line method.

In the above Python script, the following steps were executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images).

If you have a configuration file, you can customize the configurations of the seal recognition pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved in / my_path/seal_recognition.yaml \uff0c Then only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/seal_recognition.yaml\")\noutput = pipeline.predict(\"seal_text_det.png\")\nfor res in output:\n    res.print() ## \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_img(\"./output/\") ## \u200b\u4fdd\u5b58\u200b\u53ef\u89c6\u5316\u200b\u7ed3\u679c\u200b\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#3-development-integrationdeployment","title":"3. Development integration/deployment","text":"

If the production line can meet your requirements for inference speed and accuracy, you can directly develop integration/deployment.

If you need to directly apply the production line to your Python project, you can refer to the example code in [2.2.2 Python scripting] (# 222 python scripting integration).

In addition, PaddleX also offers three other deployment methods, detailed as follows:

\ud83d\ude80 ** High performance deployment: In actual production environments, many applications have strict standards for the performance indicators of deployment strategies, especially response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deep performance optimization of model inference and pre-processing, achieving significant acceleration of end-to-end processes. For a detailed high-performance deployment process, please refer to the [PaddleX High Performance Deployment Guide] (../../../pipelin_deploy/high_performance_deploy. md).

\u2601\ufe0f ** Service deployment * *: Service deployment is a common form of deployment in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users to achieve service-oriented deployment of production lines at low cost. For detailed service-oriented deployment processes, please refer to the PaddleX Service Deployment Guide (../../../ipeline_deploy/service_deploy. md).

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Obtain seal recognition results from an image.

POST /seal-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description texts array Positions, contents, and scores of texts. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in texts is an object with the following properties:

Name Type Description poly array Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text. text string Text content. score number Text recognition score. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/seal-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/seal-recognition\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedLayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto texts = result[\"texts\"];\n        std::cout << \"\\nDetected texts:\" << std::endl;\n        for (const auto& text : texts) {\n            std::cout << text << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/seal-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode texts = result.get(\"texts\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected texts: \" + texts.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/seal-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Texts []map[string]interface{} `json:\"texts\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected texts:\")\n    for _, text := range respData.Result.Texts {\n        fmt.Println(text)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/seal-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected texts:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"texts\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/seal-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected texts:\");\n    console.log(result[\"texts\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/seal-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected texts:\\n\";\nprint_r($result[\"texts\"]);\n\n?>\n

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#4-secondary-development","title":"4. Secondary development","text":"

If the default model weights provided by the seal recognition production line are not satisfactory in terms of accuracy or speed in your scenario, you can try using your own specific domain or application scenario data to further fine tune the existing model to improve the recognition performance of the seal recognition production line in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#41-model-fine-tuning","title":"4.1 Model fine-tuning","text":"

Due to the fact that the seal recognition production line consists of three modules, the performance of the model production line may not be as expected due to any of these modules.

You can analyze images with poor recognition performance and refer to the following rules for analysis and model fine-tuning:

  • If the seal area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If there is a significant amount of text that has not been detected (i.e. text miss detection phenomenon), it may be due to the shortcomings of the text detection model. You need to refer to the Secondary Development section in the Seal Text Detection Module Development Tutorial to fine tune the text detection model using your private dataset.
  • If seal texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.

  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After completing fine-tuning training using a private dataset, you can obtain a local model weight file.

If you need to use the fine tuned model weights, simply modify the production line configuration file and replace the local path of the fine tuned model weights with the corresponding position in the production line configuration file

......\n Pipeline:\n  layout_model: RT-DETR-H_layout_3cls #can be modified to the local path of the fine tuned model\n  text_det_model: PP-OCRv4_server_seal_det  #can be modified to the local path of the fine tuned model\n  text_rec_model: PP-OCRv4_server_rec #can be modified to the local path of the fine tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  device: \"gpu:0\"\n......\n
Subsequently, refer to the command line or Python script in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/seal_recognition.html#5-multiple-hardware-support","title":"5. Multiple hardware support","text":"

PaddleX supports various mainstream hardware devices such as Nvidia GPU, Kunlun Core XPU, Ascend NPU, and Cambrian MLU, and can seamlessly switch between different hardware devices by simply modifying the --device parameter.

For example, if you use Nvidia GPU for inference on a seal recognition production line, the Python command you use is:

paddlex --pipeline seal_recognition --input seal_text_det.png --device gpu:0 --save_path output\n

At this point, if you want to switch the hardware to Ascend NPU, simply modify the --device in the Python command to NPU:

paddlex --pipeline seal_recognition --input seal_text_det.png --device npu:0 --save_path output\n

If you want to use the seal recognition production line on a wider range of hardware, please refer to the PaddleX Multi Hardware Usage Guide\u3002

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html","title":"General Table Recognition Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#1-introduction-to-the-general-table-recognition-pipeline","title":"1. Introduction to the General Table Recognition Pipeline","text":"

Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis for users.

The General Table Recognition Pipeline comprises modules for table structure recognition, layout analysis, text detection, and text recognition.

If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model size, choose a model with a smaller storage footprint.

\ud83d\udc49Model List Details

Table Recognition Module Models:

ModelModel Download Link Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description SLANetInference Model/Trained Model 59.52 522.536 1845.37 6.9 M SLANet is a table structure recognition model developed by Baidu PaddleX Team. The model significantly improves the accuracy and inference speed of table structure recognition by adopting a CPU-friendly lightweight backbone network PP-LCNet, a high-low-level feature fusion module CSP-PAN, and a feature decoding module SLA Head that aligns structural and positional information. SLANet_plusInference Model/Trained Model 63.69 522.536 1845.37 6.9 M SLANet_plus is an enhanced version of SLANet, a table structure recognition model developed by Baidu PaddleX Team. Compared to SLANet, SLANet_plus significantly improves its recognition capabilities for wireless and complex tables, while reducing the model's sensitivity to the accuracy of table localization. Even when there are offsets in table localization, it can still perform relatively accurate recognition.

Note: The above accuracy metrics are measured on PaddleX's internal self-built English table recognition dataset. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Layout Analysis Module Models:

ModelModel Download Link mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1xInference Model/Trained Model 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3clsInference Model/Trained Model 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17clsInference Model/Trained Model 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3clsInference Model/Trained Model 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17clsInference Model/Trained Model 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3clsInference Model/Trained Model 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17clsInference Model/Trained Model 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The above accuracy metrics are evaluated on PaddleX's self-built layout analysis dataset containing 10,000 images. All GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

Text Detection Module Models:

Model NameModel Download Link Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-OCRv4_mobile_detInference Model/Trained Model 77.79 10.6923 120.177 4.2 M PP-OCRv4_server_detInference Model/Trained Model 82.69 83.3501 2434.01 100.1M"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX's pre-trained model pipelines allow for quick experience of their effects. You can experience the effects of the General Image Classification pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Table Recognition pipeline by using the demo images provided by the official. For example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the models in the pipeline online.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Table Recognition pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Guide.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#21-command-line-experience","title":"2.1 Command Line Experience","text":"

Experience the effects of the table recognition pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the table recognition pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the 1st and 2nd GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default table recognition pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config table_recognition\n

After execution, the table recognition pipeline configuration file will be saved in the current directory. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config table_recognition --save_path ./my_path\n

After obtaining the pipeline configuration file, replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./table_recognition.yaml, simply execute:

paddlex --pipeline ./table_recognition.yaml --input table_recognition.jpg --device gpu:0\n

Here, parameters like --model and --device do not need to be specified, as they will use the parameters in the configuration file. If they are still specified, the specified parameters will take precedence.

After running, the result is:

The visualized image not saved by default. You can customize the save path through --save_path, and then all results will be saved in the specified path.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#22-python-script-integration","title":"2.2 Python Script Integration","text":"

A few lines of code are all you need to quickly perform inference with the pipeline. Taking the General Table Recognition pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"table_recognition\")\n\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_img(\"./output/\")  # Save the results in img format\n    res.save_to_xlsx(\"./output/\")  # Save the results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
The results are the same as those obtained through the command line.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_img Save the results as an img format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_html Save the results as an html format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type; save_to_xlsx Save the results as a spreadsheet format file - save_path: str, the path to save the file. When it's a directory, the saved file name will be consistent with the input file type;

Where save_to_img can save visualization results (including OCR result images, layout analysis result images, table structure recognition result images), save_to_html can directly save the table as an html file (including text and table formatting), and save_to_xlsx can save the table as an Excel format file (including text and formatting).

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/table_recognition.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/table_recognition.yaml\")\noutput = pipeline.predict(\"table_recognition.jpg\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_img(\"./output/\")  # Save results in img format\n    res.save_to_xlsx(\"./output/\")  # Save results in Excel format\n    res.save_to_html(\"./output/\") # Save results in HTML format\n
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that aim to deeply optimize model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Locate and recognize tables in images.

POST /table-recognition

  • Request body properties:
Name Type Description Required image string The URL of an image file accessible by the service or the Base64 encoded result of the image file content. Yes inferenceParams object Inference parameters. No

Properties of inferenceParams:

Name Type Description Required maxLongSide integer During inference, if the length of the longer side of the input image for the text detection model is greater than maxLongSide, the image will be scaled so that the length of the longer side equals maxLongSide. No
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description tables array Positions and contents of tables. layoutImage string Layout area detection result image. The image is in JPEG format and encoded using Base64. ocrImage string OCR result image. The image is in JPEG format and encoded using Base64.

Each element in tables is an object with the following properties:

Name Type Description bbox array Table position. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. html string Table recognition result in HTML format. Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/table-recognition\"\nimage_path = \"./demo.jpg\"\nocr_image_path = \"./ocr.jpg\"\nlayout_image_path = \"./layout.jpg\"\n\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(ocr_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"ocrImage\"]))\nprint(f\"Output image saved at {ocr_image_path}\")\nwith open(layout_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"layoutImage\"]))\nprint(f\"Output image saved at {layout_image_path}\")\nprint(\"\\nDetected tables:\")\nprint(result[\"tables\"])\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string imagePath = \"./demo.jpg\";\n    const std::string ocrImagePath = \"./ocr.jpg\";\n    const std::string layoutImagePath = \"./layout.jpg\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(imagePath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedImage = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"image\"] = encodedImage;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/table-recognition\", headers, body, \"application/json\");\n\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedImage = result[\"ocrImage\"];\n        std::string decoded_string = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedOcrImage(decoded_string.begin(), decoded_string.end());\n        std::ofstream outputOcrFile(ocrImagePath, std::ios::binary | std::ios::out);\n        if (outputOcrFile.is_open()) {\n            outputOcrFile.write(reinterpret_cast<char*>(decodedOcrImage.data()), decodedOcrImage.size());\n            outputOcrFile.close();\n            std::cout << \"Output image saved at \" << ocrImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << ocrImagePath << std::endl;\n        }\n\n        encodedImage = result[\"layoutImage\"];\n        decodedString = base64::from_base64(encodedImage);\n        std::vector<unsigned char> decodedLayoutImage(decodedString.begin(), decodedString.end());\n        std::ofstream outputLayoutFile(layoutImagePath, std::ios::binary | std::ios::out);\n        if (outputLayoutFile.is_open()) {\n            outputLayoutFile.write(reinterpret_cast<char*>(decodedLayoutImage.data()), decodedlayoutImage.size());\n            outputLayoutFile.close();\n            std::cout << \"Output image saved at \" << layoutImagePath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << layoutImagePath << std::endl;\n        }\n\n        auto tables = result[\"tables\"];\n        std::cout << \"\\nDetected tables:\" << std::endl;\n        for (const auto& table : tables) {\n            std::cout << table << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/table-recognition\";\n        String imagePath = \"./demo.jpg\";\n        String ocrImagePath = \"./ocr.jpg\";\n        String layoutImagePath = \"./layout.jpg\";\n\n        File file = new File(imagePath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String imageData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"image\", imageData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                String ocrBase64Image = result.get(\"ocrImage\").asText();\n                String layoutBase64Image = result.get(\"layoutImage\").asText();\n                JsonNode tables = result.get(\"tables\");\n\n                byte[] imageBytes = Base64.getDecoder().decode(ocrBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(ocrImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + ocrBase64Image);\n\n                imageBytes = Base64.getDecoder().decode(layoutBase64Image);\n                try (FileOutputStream fos = new FileOutputStream(layoutImagePath)) {\n                    fos.write(imageBytes);\n                }\n                System.out.println(\"Output image saved at \" + layoutImagePath);\n\n                System.out.println(\"\\nDetected tables: \" + tables.toString());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/table-recognition\"\n    imagePath := \"./demo.jpg\"\n    ocrImagePath := \"./ocr.jpg\"\n    layoutImagePath := \"./layout.jpg\"\n\n    imageBytes, err := ioutil.ReadFile(imagePath)\n    if err != nil {\n        fmt.Println(\"Error reading image file:\", err)\n        return\n    }\n    imageData := base64.StdEncoding.EncodeToString(imageBytes)\n\n    payload := map[string]string{\"image\": imageData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            OcrImage      string   `json:\"ocrImage\"`\n            LayoutImage      string   `json:\"layoutImage\"`\n            Tables []map[string]interface{} `json:\"tables\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", ocrImagePath)\n\n    layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.LayoutImage)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 image data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing image to file:\", err)\n        return\n    }\n    fmt.Printf(\"Image saved at %s.jpg\\n\", layoutImagePath)\n\n    fmt.Println(\"\\nDetected tables:\")\n    for _, table := range respData.Result.Tables {\n        fmt.Println(table)\n    }\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/table-recognition\";\n    static readonly string imagePath = \"./demo.jpg\";\n    static readonly string ocrImagePath = \"./ocr.jpg\";\n    static readonly string layoutImagePath = \"./layout.jpg\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] imageBytes = File.ReadAllBytes(imagePath);\n        string image_data = Convert.ToBase64String(imageBytes);\n\n        var payload = new JObject{ { \"image\", image_data } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string ocrBase64Image = jsonResponse[\"result\"][\"ocrImage\"].ToString();\n        byte[] ocrImageBytes = Convert.FromBase64String(ocrBase64Image);\n        File.WriteAllBytes(ocrImagePath, ocrImageBytes);\n        Console.WriteLine($\"Output image saved at {ocrImagePath}\");\n\n        string layoutBase64Image = jsonResponse[\"result\"][\"layoutImage\"].ToString();\n        byte[] layoutImageBytes = Convert.FromBase64String(layoutBase64Image);\n        File.WriteAllBytes(layoutImagePath, layoutImageBytes);\n        Console.WriteLine($\"Output image saved at {layoutImagePath}\");\n\n        Console.WriteLine(\"\\nDetected tables:\");\n        Console.WriteLine(jsonResponse[\"result\"][\"tables\"].ToString());\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/table-recognition'\nconst imagePath = './demo.jpg'\nconst ocrImagePath = \"./ocr.jpg\";\nconst layoutImagePath = \"./layout.jpg\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'image': encodeImageToBase64(imagePath)\n  })\n};\n\nfunction encodeImageToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const imageBuffer = Buffer.from(result[\"ocrImage\"], 'base64');\n    fs.writeFile(ocrImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${ocrImagePath}`);\n    });\n\n    imageBuffer = Buffer.from(result[\"layoutImage\"], 'base64');\n    fs.writeFile(layoutImagePath, imageBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output image saved at ${layoutImagePath}`);\n    });\n\n    console.log(\"\\nDetected tables:\");\n    console.log(result[\"tables\"]);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/table-recognition\";\n$image_path = \"./demo.jpg\";\n$ocr_image_path = \"./ocr.jpg\";\n$layout_image_path = \"./layout.jpg\";\n\n$image_data = base64_encode(file_get_contents($image_path));\n$payload = array(\"image\" => $image_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\nfile_put_contents($ocr_image_path, base64_decode($result[\"ocrImage\"]));\necho \"Output image saved at \" . $ocr_image_path . \"\\n\";\n\nfile_put_contents($layout_image_path, base64_decode($result[\"layoutImage\"]));\necho \"Output image saved at \" . $layout_image_path . \"\\n\";\n\necho \"\\nDetected tables:\\n\";\nprint_r($result[\"tables\"]);\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the general table recognition pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the general table recognition pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the general table recognition pipeline consists of four modules, unsatisfactory performance may stem from any of these modules.

Analyze images with poor recognition results and follow the rules below for analysis and model fine-tuning:

  • If the detected table structure is incorrect (e.g., row and column recognition errors, incorrect cell positions), the table structure recognition module may be insufficient. You need to refer to the Customization section in the Table Structure Recognition Module Development Tutorial and use your private dataset to fine-tune the table structure recognition model.
  • If the table area is incorrectly located within the overall layout, the layout detection module may be insufficient. You need to refer to the Customization section in the Layout Detection Module Development Tutorial and use your private dataset to fine-tune the layout detection model.
  • If many texts are undetected (i.e., text miss detection), the text detection model may be insufficient. You need to refer to the Customization section in the Text Detection Module Development Tutorial and use your private dataset to fine-tune the text detection model.
  • If many detected texts contain recognition errors (i.e., the recognized text content does not match the actual text content), the text recognition model requires further improvement. You need to refer to the Customization section.
"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning your model with a private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the production line configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the configuration file:

......\n Pipeline:\n  layout_model: PicoDet_layout_1x  # Can be modified to the local path of the fine-tuned model\n  table_model: SLANet  # Can be modified to the local path of the fine-tuned model\n  text_det_model: PP-OCRv4_mobile_det  # Can be modified to the local path of the fine-tuned model\n  text_rec_model: PP-OCRv4_mobile_rec  # Can be modified to the local path of the fine-tuned model\n  layout_batch_size: 1\n  text_rec_batch_size: 1\n  table_batch_size: 1\n  device: \"gpu:0\"\n......\n
Then, refer to the command line or Python script method in the local experience to load the modified production line configuration file.

"},{"location":"en/pipeline_usage/tutorials/ocr_pipelines/table_recognition.html#5-multi-hardware-support","title":"5. Multi-Hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPU, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for table recognition pipeline inference, the Python command is:

paddlex --pipeline table_recognition --input table_recognition.jpg --device gpu:0\n
At this time, if you want to switch the hardware to Ascend NPU, simply modify --device in the Python command to npu:

paddlex --pipeline table_recognition --input table_recognition.jpg --device npu:0\n
If you want to use the general table recognition pipeline on more types of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html","title":"Time Series Anomaly Detection Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#1-introduction-to-the-general-time-series-anomaly-detection-pipeline","title":"1. Introduction to the General Time Series Anomaly Detection Pipeline","text":"

Time series anomaly detection is a technique for identifying abnormal patterns or behaviors in time series data. It is widely applied in fields such as network security, equipment monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly deviate from expected behaviors, such as sudden spikes in network traffic or unusual transaction activities. Time series anomaly detection enable automatic identification of anomalies in data. This technology provides real-time alerts for enterprises and organizations, helping them promptly address potential risks and issues. It plays a crucial role in ensuring system stability and security.

The General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module. If you prioritize model accuracy, choose a model with higher precision. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage footprint.

Model NameModel Download Link Precision Recall F1-Score Model Storage Size (M) AutoEncoder_adInference Model/Trained Model 99.36 84.36 91.25 52K DLinear_adInference Model/Trained Model 98.98 93.96 96.41 112K Nonstationary_adInference Model/Trained Model 98.55 88.95 93.51 1.8M PatchTST_adInference Model/Trained Model 98.78 90.70 94.57 320K TimesNet_adInference Model/Trained Model 98.37 94.80 96.56 1.3M

Note: The above precision metrics are measured on the PSM dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Anomaly Detection Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Anomaly Detection Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online experience of time series tasks are only model solutions for a specific scenario and are not universal. They are not applicable to other scenarios. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Anomaly Detection Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

A single command is all you need to quickly experience the effects of the time series anomaly detection pipeline:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it's the image anomaly detection pipeline.\n--input: The local path or URL of the input image to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). CPU can also be selected (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_ad --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_ad.yaml --input ts_ad.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result obtained is:

{'input_path': 'ts_ad.csv', 'anomaly':            label\ntimestamp\n220226         0\n220227         0\n220228         0\n220229         0\n220230         0\n...          ...\n220317         1\n220318         1\n220319         1\n220320         1\n220321         0\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the rapid inference of the pipeline. Taking the general time series anomaly detection pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_ad\")\n\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the result in CSV format\n

The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

\uff081\uff09Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str gpu use_hpip Whether to enable high-performance inference, only available if the production line supports it. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters save_to_csv Saves results as a csv file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_xlsx Saves results as table file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_ad.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_ad.yaml\")\noutput = pipeline.predict(\"ts_ad.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for the performance metrics of deployment strategies (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error description. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the properties of the response body are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error description.

Main operations provided by the service:

  • infer

Performs time-series anomaly detection.

POST /time-series-anomaly-detection

  • Attributes of the request body:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string Time-series anomaly detection results in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-anomaly-detection\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-anomaly-detection\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-anomaly-detection\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-anomaly-detection'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-anomaly-detection\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Anomaly Detection Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Anomaly Detection Pipeline includes a time series anomaly detection module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Modules Development Tutorial to fine-tune the time series anomaly detection model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weights files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear_ad  # Can be modified to the local path of the fine-tuned model\n  batch_size: 1\n  device: \"gpu:0\"\n......\n

Then, refer to the command line method or Python script method in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference of the time series anomaly detection pipeline, the Python command is:

paddlex --pipeline ts_ad --input ts_ad.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_ad --input ts_ad.csv --device npu:0\n
If you want to use the General Time-Series Anomaly Detection Pipeline on more diverse hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html","title":"Time Series Classification Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#1-introduction-to-general-time-series-classification-pipeline","title":"1. Introduction to General Time Series Classification Pipeline","text":"

Time series classification is a technique that categorizes time-series data into predefined classes, widely applied in fields such as behavior recognition and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, for example, classifying a speech signal as \"greeting\" or \"request,\" or categorizing stock price movements as \"rising\" or \"falling.\" Time series classification typically employs machine learning and deep learning models, effectively capturing temporal dependencies and variation patterns to provide accurate classification labels for data. This technology plays a pivotal role in applications such as intelligent monitoring and market forecasting.

The General Time Series Classification Pipeline includes a Time Series Classification module.

Model NameModel Download Link Acc(%) Model Size (M) TimesNet_clsInference Model/Trained Model 87.5 792K

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX provides pre-trained model pipelines that can be quickly experienced. You can experience the effects of the General Time Series Classification Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience online the effects of the General Time Series Classification Pipeline using the official demo for recognition, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model in the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in model for online experience of time series tasks is only a model solution for a specific scenario and is not a general solution applicable to other scenarios. Therefore, the experience method does not support using arbitrary files to experience the effect of the official model solution. However, after training a model for your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Classification Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the effects of the time series classification pipeline quickly with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series classification pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default time series classification pipeline configuration file is loaded. If you need to customize the configuration file, you can execute the following command to obtain it:

\ud83d\udc49Click to Expand
paddlex --get_pipeline_yaml ts_cls\n

After execution, the time series classification pipeline configuration file will be saved in the current path. If you wish to customize the save location, you can execute the following command (assuming the custom save location is ./my_path):

paddlex --get_pipeline_config ts_cls --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_ad.yaml, simply execute:

paddlex --pipeline ./ts_cls.yaml --input ts_cls.csv --device gpu:0\n

In this command, parameters such as --model and --device are not required to be specified, as they will use the parameters defined in the configuration file. If these parameters are specified, the specified values will take precedence.

After execution, the result is:

{'input_path': 'ts_cls.csv', 'classification':         classid     score\nsample\n0             0  0.617688}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete rapid inference for production lines. Taking the General Time Series Classification Pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_cls\")\n\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n

The results obtained are the same as those from the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the create_pipeline to create a pipeline object: Specific parameter descriptions are as follows:

Parameter Description Type Default pipeline The name of the pipeline or the path to the pipeline configuration file. If it's a pipeline name, it must be supported by PaddleX. str None device The device for pipeline model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference. Available only if the pipeline supports it. bool False

(2) Call the predict method of the pipeline object for inference: The predict method takes x as a parameter, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Description Python Var Supports directly passing Python variables, such as numpy.ndarray representing image data. str Supports passing the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing a dictionary type, where the key needs to correspond to the specific task, e.g., \"img\" for image classification tasks, and the value of the dictionary supports the above data types, e.g., {\"img\": \"/root/data1\"}. list Supports passing a list, where the list elements need to be of the above types, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

(3) Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained by iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_cls.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_cls.yaml\")\noutput = pipeline.predict(\"ts_cls.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins that deeply optimize model inference and pre/post-processing to significantly speed up the end-to-end process. Refer to the PaddleX High-Performance Inference Guide for detailed high-performance inference procedures.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX enables users to achieve low-cost service-oriented deployment of pipelines. Refer to the PaddleX Service-Oriented Deployment Guide for detailed service-oriented deployment procedures.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service:

  • infer

Classify time-series data.

POST /time-series-classification

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result in the response body has the following properties:
Name Type Description label string Class label. score number Class score.

An example of result is as follows:

{\n\"label\": \"running\",\n\"score\": 0.97\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-classification\"\ncsv_path = \"./test.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nprint(f\"label: {result['label']}, score: {result['score']}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-classification\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n        std::cout << \"label: \" << result[\"label\"] << \", score: \" << result[\"score\"] << std::endl;\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-classification\";\n        String csvPath = \"./test.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n                System.out.println(\"label: \" + result.get(\"label\").asText() + \", score: \" + result.get(\"score\").asText());\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-classification\"\n    csvPath := \"./test.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Label string `json:\"label\"`\n            Score string `json:\"score\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    fmt.Printf(\"label: %s, score: %s\\n\", respData.Result.Label, respData.Result.Score)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-classification\";\n    static readonly string csvPath = \"./test.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csveBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csveBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string label = jsonResponse[\"result\"][\"label\"].ToString();\n        string score = jsonResponse[\"result\"][\"score\"].ToString();\n        Console.WriteLine($\"label: {label}, score: {score}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-classification'\nconst csvPath = \"./test.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n    console.log(`label: ${result[\"label\"]}, score: ${result[\"score\"]}`);\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-classification\";\n$csv_path = \"./test.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\necho \"label: \" . $result[\"label\"] . \", score: \" . $result[\"score\"];\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing capabilities on user devices themselves, allowing devices to process data directly without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. Refer to the PaddleX Edge Deployment Guide for detailed edge deployment procedures. Choose the appropriate deployment method based on your needs to proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Classification Pipeline do not meet your requirements for accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Classification Pipeline includes a time series classification module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Classification Module Tutorial to fine-tune the time series classification model using your private dataset.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning the model with your private dataset, you will obtain local model weights.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: TimesNet_cls  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 1\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_classification.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for time series classification pipeline inference, the Python command is:

paddlex --pipeline ts_cls --input ts_cls.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` flag in the Python command as follows:\n\n```bash\npaddlex --pipeline ts_cls --input ts_cls.csv --device npu:0\n

If you intend to use the General Time Series Classification Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Hardware Usage Guide.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html","title":"Time Series Forecasting Pipeline Tutorial","text":""},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#1-introduction-to-the-general-time-series-forecasting-pipeline","title":"1. Introduction to the General Time Series Forecasting Pipeline","text":"

Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing the patterns of change in time series data. It is widely applied in fields such as financial markets, weather forecasting, and sales prediction. Time series forecasting often employs statistical methods or deep learning models (e.g., LSTM, ARIMA), capable of handling temporal dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in various industries, including energy management, supply chain optimization, and market analysis.

The General Time Series Forecasting Pipeline includes a time series forecasting module. If you prioritize model accuracy, choose a model with higher accuracy. If you prioritize inference speed, select a model with faster inference. If you prioritize model storage size, choose a model with a smaller storage size.

Model NameModel Download Link MSE MAE Model Storage Size (M) DLinearInference Model/Trained Model 0.382 0.394 72K NLinearInference Model/Trained Model 0.386 0.392 40K NonstationaryInference Model/Trained Model 0.600 0.515 55.5 M PatchTSTInference Model/Trained Model 0.385 0.397 2.0M RLinearInference Model/Trained Model 0.384 0.392 40K TiDEInference Model/Trained Model 0.405 0.412 31.7M TimesNetInference Model/Trained Model 0.417 0.431 4.9M

Note: The above accuracy metrics are measured on ETTH1. All model GPU inference times are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#2-quick-start","title":"2. Quick Start","text":"

The pre-trained model pipelines provided by PaddleX allow for quick experience of their effects. You can experience the effects of the General Time Series Forecasting Pipeline online or locally using command line or Python.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#21-online-experience","title":"2.1 Online Experience","text":"

You can experience the General Time Series Forecasting Pipeline online using the demo provided by the official team, for example:

If you are satisfied with the pipeline's performance, you can directly integrate and deploy it. If not, you can also use your private data to fine-tune the model within the pipeline online.

Note: Due to the close relationship between time series data and scenarios, the official built-in models for online time series tasks are scenario-specific and not universal. Therefore, the experience mode does not support using arbitrary files to experience the effects of the official model solutions. However, after training a model with your own scenario data, you can select your trained model solution and use data from the corresponding scenario for online experience.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#22-local-experience","title":"2.2 Local Experience","text":"

Before using the General Time Series Forecasting Pipeline locally, ensure you have installed the PaddleX wheel package following the PaddleX Local Installation Tutorial.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#221-command-line-experience","title":"2.2.1 Command Line Experience","text":"

Experience the time series forecasting pipeline with a single command:

Experience the image anomaly detection pipeline with a single command\uff0cUse the test file, and replace --input with the local path to perform prediction.

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n
Parameter Explanation:

--pipeline: The name of the pipeline, here it is the time series forecasting pipeline.\n--input: The local path or URL of the input sequence to be processed.\n--device: The GPU index to use (e.g., gpu:0 for the first GPU, gpu:1,2 for the second and third GPUs). You can also choose to use CPU (--device cpu).\n

When executing the above command, the default image anomaly detection pipeline configuration file is loaded. If you need to customize the configuration file, you can run the following command to obtain it:

\ud83d\udc49Click to expand
paddlex --get_pipeline_config ts_fc --save_path ./my_path\n

After obtaining the pipeline configuration file, you can replace --pipeline with the configuration file save path to make the configuration file take effect. For example, if the configuration file save path is ./ts_fc.yaml, simply execute:

paddlex --pipeline ./ts_fc.yaml --input ts_fc.csv --device gpu:0\n

Here, parameters such as --model and --device do not need to be specified, as they will use the parameters in the configuration file. If parameters are still specified, the specified parameters will take precedence.

After running, the result is:

{'input_path': 'ts_fc.csv', 'forecast':                            OT\ndate\n2018-06-26 20:00:00  9.586131\n2018-06-26 21:00:00  9.379762\n2018-06-26 22:00:00  9.252275\n2018-06-26 23:00:00  9.249993\n2018-06-27 00:00:00  9.164998\n...                       ...\n2018-06-30 15:00:00  8.830340\n2018-06-30 16:00:00  9.291553\n2018-06-30 17:00:00  9.097666\n2018-06-30 18:00:00  8.905430\n2018-06-30 19:00:00  8.993793\n\n[96 rows x 1 columns]}\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#222-python-script-integration","title":"2.2.2 Python Script Integration","text":"

A few lines of code can complete the quick inference of the production line. Taking the general time series prediction production line as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(pipeline=\"ts_fc\")\n\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of the prediction\n    res.save_to_csv(\"./output/\")  # Save the results in CSV format\n
The result obtained is the same as that of the command line method.

In the above Python script, the following steps are executed:

(1) Instantiate the production line object using create_pipeline: Specific parameter descriptions are as follows:

Parameter Description Type Default Value pipeline The name of the production line or the path to the production line configuration file. If it is the name of the production line, it must be supported by PaddleX. str None device The device for production line model inference. Supports: \"gpu\", \"cpu\". str \"gpu\" use_hpip Whether to enable high-performance inference, only available when the production line supports high-performance inference. bool False

\uff082\uff09Invoke the predict method of the production line object for inference prediction: The predict method parameter is x, which is used to input data to be predicted, supporting multiple input methods, as shown in the following examples:

Parameter Type Parameter Description Python Var Supports directly passing in Python variables, such as numpy.ndarray representing image data. str Supports passing in the path of the file to be predicted, such as the local path of an image file: /root/data/img.jpg. str Supports passing in the URL of the file to be predicted, such as the network URL of an image file: Example. str Supports passing in a local directory, which should contain files to be predicted, such as the local path: /root/data/. dict Supports passing in a dictionary type, where the key needs to correspond to a specific task, such as \"img\" for image classification tasks. The value of the dictionary supports the above types of data, for example: {\"img\": \"/root/data1\"}. list Supports passing in a list, where the list elements need to be of the above types of data, such as [numpy.ndarray, numpy.ndarray], [\"/root/data/img1.jpg\", \"/root/data/img2.jpg\"], [\"/root/data1\", \"/root/data2\"], [{\"img\": \"/root/data1\"}, {\"img\": \"/root/data2/img.jpg\"}].

\uff083\uff09Obtain the prediction results by calling the predict method: The predict method is a generator, so prediction results need to be obtained through iteration. The predict method predicts data in batches, so the prediction results are in the form of a list.

\uff084\uff09Process the prediction results: The prediction result for each sample is of dict type and supports printing or saving to files, with the supported file types depending on the specific pipeline. For example:

Method Description Method Parameters print Prints results to the terminal - format_json: bool, whether to format the output content with json indentation, default is True;- indent: int, json formatting setting, only valid when format_json is True, default is 4;- ensure_ascii: bool, json formatting setting, only valid when format_json is True, default is False; save_to_json Saves results as a json file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;- indent: int, json formatting setting, default is 4;- ensure_ascii: bool, json formatting setting, default is False; save_to_img Saves results as an image file - save_path: str, the path to save the file, when it's a directory, the saved file name is consistent with the input file type;

If you have a configuration file, you can customize the configurations of the image anomaly detection pipeline by simply modifying the pipeline parameter in the create_pipeline method to the path of the pipeline configuration file.

For example, if your configuration file is saved at ./my_path/ts_fc.yaml, you only need to execute:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"./my_path/ts_fc.yaml\")\noutput = pipeline.predict(\"ts_fc.csv\")\nfor res in output:\n    res.print()  # Print the structured output of prediction\n    res.save_to_csv(\"./output/\")  # Save results in CSV format\n
"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#3-development-integrationdeployment","title":"3. Development Integration/Deployment","text":"

If the pipeline meets your requirements for inference speed and accuracy in production, you can proceed with development integration/deployment.

If you need to directly apply the pipeline in your Python project, refer to the example code in 2.2.2 Python Script Integration.

Additionally, PaddleX provides three other deployment methods, detailed as follows:

\ud83d\ude80 High-Performance Inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, refer to the PaddleX High-Performance Inference Guide.

\u2601\ufe0f Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment of pipelines. For detailed service-oriented deployment procedures, refer to the PaddleX Service-Oriented Deployment Guide.

Below are the API references and multi-language service invocation examples:

API Reference

For main operations provided by the service:

  • The HTTP request method is POST.
  • The request body and the response body are both JSON data (JSON objects).
  • When the request is processed successfully, the response status code is 200, and the response body properties are as follows:
Name Type Description errorCode integer Error code. Fixed as 0. errorMsg string Error message. Fixed as \"Success\".

The response body may also have a result property of type object, which stores the operation result information.

  • When the request is not processed successfully, the response body properties are as follows:
Name Type Description errorCode integer Error code. Same as the response status code. errorMsg string Error message.

Main operations provided by the service are as follows:

  • infer

Performs time-series forecasting.

POST /time-series-forecasting

  • The request body properties are as follows:
Name Type Description Required csv string The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8. Yes
  • When the request is processed successfully, the result of the response body has the following properties:
Name Type Description csv string The time-series forecasting result in CSV format. Encoded in UTF-8+Base64.

An example of result is as follows:

{\n\"csv\": \"xxxxxx\"\n}\n
Multi-Language Service Invocation Examples Python
import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/time-series-forecasting\"\ncsv_path = \"./test.csv\"\noutput_csv_path = \"./out.csv\"\n\nwith open(csv_path, \"rb\") as file:\n    csv_bytes = file.read()\n    csv_data = base64.b64encode(csv_bytes).decode(\"ascii\")\n\npayload = {\"csv\": csv_data}\n\nresponse = requests.post(API_URL, json=payload)\n\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_csv_path, \"wb\") as f:\n    f.write(base64.b64decode(result[\"csv\"]))\nprint(f\"Output time-series data saved at  {output_csv_path}\")\n
C++
#include <iostream>\n#include \"cpp-httplib/httplib.h\" // https://github.com/Huiyicc/cpp-httplib\n#include \"nlohmann/json.hpp\" // https://github.com/nlohmann/json\n#include \"base64.hpp\" // https://github.com/tobiaslocker/base64\n\nint main() {\n    httplib::Client client(\"localhost:8080\");\n    const std::string csvPath = \"./test.csv\";\n    const std::string outputCsvPath = \"./out.csv\";\n\n    httplib::Headers headers = {\n        {\"Content-Type\", \"application/json\"}\n    };\n\n    std::ifstream file(csvPath, std::ios::binary | std::ios::ate);\n    std::streamsize size = file.tellg();\n    file.seekg(0, std::ios::beg);\n\n    std::vector<char> buffer(size);\n    if (!file.read(buffer.data(), size)) {\n        std::cerr << \"Error reading file.\" << std::endl;\n        return 1;\n    }\n    std::string bufferStr(reinterpret_cast<const char*>(buffer.data()), buffer.size());\n    std::string encodedCsv = base64::to_base64(bufferStr);\n\n    nlohmann::json jsonObj;\n    jsonObj[\"csv\"] = encodedCsv;\n    std::string body = jsonObj.dump();\n\n    auto response = client.Post(\"/time-series-forecasting\", headers, body, \"application/json\");\n    if (response && response->status == 200) {\n        nlohmann::json jsonResponse = nlohmann::json::parse(response->body);\n        auto result = jsonResponse[\"result\"];\n\n        encodedCsv = result[\"csv\"];\n        decodedString = base64::from_base64(encodedCsv);\n        std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());\n        std::ofstream outputCsv(outputCsvPath, std::ios::binary | std::ios::out);\n        if (outputCsv.is_open()) {\n            outputCsv.write(reinterpret_cast<char*>(decodedCsv.data()), decodedCsv.size());\n            outputCsv.close();\n            std::cout << \"Output time-series data saved at \" << outputCsvPath << std::endl;\n        } else {\n            std::cerr << \"Unable to open file for writing: \" << outputCsvPath << std::endl;\n        }\n    } else {\n        std::cout << \"Failed to send HTTP request.\" << std::endl;\n        std::cout << response->body << std::endl;\n        return 1;\n    }\n\n    return 0;\n}\n
Java
import okhttp3.*;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.node.ObjectNode;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.Base64;\n\npublic class Main {\n    public static void main(String[] args) throws IOException {\n        String API_URL = \"http://localhost:8080/time-series-forecasting\";\n        String csvPath = \"./test.csv\";\n        String outputCsvPath = \"./out.csv\";\n\n        File file = new File(csvPath);\n        byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());\n        String csvData = Base64.getEncoder().encodeToString(fileContent);\n\n        ObjectMapper objectMapper = new ObjectMapper();\n        ObjectNode params = objectMapper.createObjectNode();\n        params.put(\"csv\", csvData);\n\n        OkHttpClient client = new OkHttpClient();\n        MediaType JSON = MediaType.Companion.get(\"application/json; charset=utf-8\");\n        RequestBody body = RequestBody.Companion.create(params.toString(), JSON);\n        Request request = new Request.Builder()\n                .url(API_URL)\n                .post(body)\n                .build();\n\n        try (Response response = client.newCall(request).execute()) {\n            if (response.isSuccessful()) {\n                String responseBody = response.body().string();\n                JsonNode resultNode = objectMapper.readTree(responseBody);\n                JsonNode result = resultNode.get(\"result\");\n\n                String base64Csv = result.get(\"csv\").asText();\n                byte[] csvBytes = Base64.getDecoder().decode(base64Csv);\n                try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {\n                    fos.write(csvBytes);\n                }\n                System.out.println(\"Output time-series data saved at \" + outputCsvPath);\n            } else {\n                System.err.println(\"Request failed with code: \" + response.code());\n            }\n        }\n    }\n}\n
Go
package main\n\nimport (\n    \"bytes\"\n    \"encoding/base64\"\n    \"encoding/json\"\n    \"fmt\"\n    \"io/ioutil\"\n    \"net/http\"\n)\n\nfunc main() {\n    API_URL := \"http://localhost:8080/time-series-forecasting\"\n    csvPath := \"./test.csv\";\n    outputCsvPath := \"./out.csv\";\n\n    csvBytes, err := ioutil.ReadFile(csvPath)\n    if err != nil {\n        fmt.Println(\"Error reading csv file:\", err)\n        return\n    }\n    csvData := base64.StdEncoding.EncodeToString(csvBytes)\n\n    payload := map[string]string{\"csv\": csvData}\n    payloadBytes, err := json.Marshal(payload)\n    if err != nil {\n        fmt.Println(\"Error marshaling payload:\", err)\n        return\n    }\n\n    client := &http.Client{}\n    req, err := http.NewRequest(\"POST\", API_URL, bytes.NewBuffer(payloadBytes))\n    if err != nil {\n        fmt.Println(\"Error creating request:\", err)\n        return\n    }\n\n    res, err := client.Do(req)\n    if err != nil {\n        fmt.Println(\"Error sending request:\", err)\n        return\n    }\n    defer res.Body.Close()\n\n    body, err := ioutil.ReadAll(res.Body)\n    if err != nil {\n        fmt.Println(\"Error reading response body:\", err)\n        return\n    }\n    type Response struct {\n        Result struct {\n            Csv string `json:\"csv\"`\n        } `json:\"result\"`\n    }\n    var respData Response\n    err = json.Unmarshal([]byte(string(body)), &respData)\n    if err != nil {\n        fmt.Println(\"Error unmarshaling response body:\", err)\n        return\n    }\n\n    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)\n    if err != nil {\n        fmt.Println(\"Error decoding base64 csv data:\", err)\n        return\n    }\n    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)\n    if err != nil {\n        fmt.Println(\"Error writing csv to file:\", err)\n        return\n    }\n    fmt.Printf(\"Output time-series data saved at %s.csv\", outputCsvPath)\n}\n
C#
using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json.Linq;\n\nclass Program\n{\n    static readonly string API_URL = \"http://localhost:8080/time-series-forecasting\";\n    static readonly string csvPath = \"./test.csv\";\n    static readonly string outputCsvPath = \"./out.csv\";\n\n    static async Task Main(string[] args)\n    {\n        var httpClient = new HttpClient();\n\n        byte[] csvBytes = File.ReadAllBytes(csvPath);\n        string csvData = Convert.ToBase64String(csvBytes);\n\n        var payload = new JObject{ { \"csv\", csvData } };\n        var content = new StringContent(payload.ToString(), Encoding.UTF8, \"application/json\");\n\n        HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);\n        response.EnsureSuccessStatusCode();\n\n        string responseBody = await response.Content.ReadAsStringAsync();\n        JObject jsonResponse = JObject.Parse(responseBody);\n\n        string base64Csv = jsonResponse[\"result\"][\"csv\"].ToString();\n        byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);\n        File.WriteAllBytes(outputCsvPath, outputCsvBytes);\n        Console.WriteLine($\"Output time-series data saved at {outputCsvPath}\");\n    }\n}\n
Node.js
const axios = require('axios');\nconst fs = require('fs');\n\nconst API_URL = 'http://localhost:8080/time-series-forecasting'\nconst csvPath = \"./test.csv\";\nconst outputCsvPath = \"./out.csv\";\n\nlet config = {\n   method: 'POST',\n   maxBodyLength: Infinity,\n   url: API_URL,\n   data: JSON.stringify({\n    'csv': encodeFileToBase64(csvPath)\n  })\n};\n\nfunction encodeFileToBase64(filePath) {\n  const bitmap = fs.readFileSync(filePath);\n  return Buffer.from(bitmap).toString('base64');\n}\n\naxios.request(config)\n.then((response) => {\n    const result = response.data[\"result\"];\n\n    const csvBuffer = Buffer.from(result[\"csv\"], 'base64');\n    fs.writeFile(outputCsvPath, csvBuffer, (err) => {\n      if (err) throw err;\n      console.log(`Output time-series data saved at ${outputCsvPath}`);\n    });\n})\n.catch((error) => {\n  console.log(error);\n});\n
PHP
<?php\n\n$API_URL = \"http://localhost:8080/time-series-forecasting\";\n$csv_path = \"./test.csv\";\n$output_csv_path = \"./out.csv\";\n\n$csv_data = base64_encode(file_get_contents($csv_path));\n$payload = array(\"csv\" => $csv_data);\n\n$ch = curl_init($API_URL);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n$result = json_decode($response, true)[\"result\"];\n\nfile_put_contents($output_csv_path, base64_decode($result[\"csv\"]));\necho \"Output time-series data saved at \" . $output_csv_path . \"\\n\";\n\n?>\n

\ud83d\udcf1 Edge Deployment: Edge deployment is a method that places computing and data processing functions on user devices themselves, enabling devices to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, refer to the PaddleX Edge Deployment Guide. Choose the appropriate deployment method for your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#4-custom-development","title":"4. Custom Development","text":"

If the default model weights provided by the General Time Series Forecasting Pipeline do not meet your requirements in terms of accuracy or speed in your specific scenario, you can try to further fine-tune the existing model using your own domain-specific or application-specific data to improve the recognition performance of the pipeline in your scenario.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#41-model-fine-tuning","title":"4.1 Model Fine-tuning","text":"

Since the General Time Series Forecasting Pipeline includes a time series forecasting module, if the performance of the pipeline does not meet expectations, you need to refer to the Customization section in the Time Series Forecasting Module Development Tutorial and use your private dataset to fine-tune the time series forecasting model.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#42-model-application","title":"4.2 Model Application","text":"

After fine-tuning with your private dataset, you will obtain local model weight files.

To use the fine-tuned model weights, simply modify the pipeline configuration file by replacing the local path of the fine-tuned model weights to the corresponding location in the pipeline configuration file:

......\nPipeline:\n  model: DLinear  # Replace with the local path of the fine-tuned model\n  device: \"gpu\"\n  batch_size: 0\n......\n
Then, refer to the command line or Python script methods in the local experience section to load the modified pipeline configuration file.

"},{"location":"en/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting.html#5-multi-hardware-support","title":"5. Multi-hardware Support","text":"

PaddleX supports various mainstream hardware devices such as NVIDIA GPUs, Kunlun XPU, Ascend NPU, and Cambricon MLU. Simply modify the --device parameter to seamlessly switch between different hardware.

For example, if you use an NVIDIA GPU for inference with the time series forecasting pipeline, the Python command would be:

paddlex --pipeline ts_fc --input ts_fc.csv --device gpu:0\n``````\nAt this point, if you wish to switch the hardware to Ascend NPU, simply modify the `--device` in the Python command to `npu:0`:\n\n```bash\npaddlex --pipeline ts_fc --input ts_fc.csv --device npu:0\n
If you want to use the General Time Series Forecasting Pipeline on a wider range of hardware, please refer to the PaddleX Multi-Device Usage Guide.

"},{"location":"en/practical_tutorials/deployment_tutorial.html","title":"PaddleX 3.0 Pipeline Deployment Tutorial","text":"

Before using this tutorial, you need to install PaddleX. For installation instructions, please refer to the PaddleX Installation guide.

The three deployment methods of PaddleX are detailed below:

  • High-Performance Inference: In actual production environments, many applications have stringent performance standards for deployment strategies, especially in terms of response speed, to ensure efficient system operation and smooth user experience. To this end, PaddleX provides a high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end speedups. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.
  • Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving low-cost service-oriented deployment in pipelines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  • Edge Deployment: Edge deployment is a method where computing and data processing functions are placed on the user's device itself, allowing the device to directly process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

This tutorial will introduce the three deployment methods of PaddleX through three practical application examples.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#1-high-performance-inference-example","title":"1 High-Performance Inference Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#11-obtain-serial-number-and-activation","title":"1.1 Obtain Serial Number and Activation","text":"

On the Baidu AIStudio Community - AI Learning and Training Community page, select \"Get Now\" in the \"Consultation and Acquisition of Serial Numbers for Open Source Pipeline Deployment\" section, as shown in the figure below:

Select the pipeline you need to deploy and click \"Get\". Afterward, you can find the obtained serial number in the \"Serial Number Management for Open Source Pipeline Deployment SDK\" section below:

After using the serial number to complete activation, you can use the high-performance inference plugin. PaddleX provides both offline and online activation methods (both only support Linux systems):

  • Online Activation: When using the inference API or CLI, specify the serial number and activate online, allowing the program to complete activation automatically.
  • Offline Activation: Follow the instructions on the serial number management interface (click \"Offline Activation\" in \"Operations\") to obtain the device fingerprint of the machine and bind the serial number with the device fingerprint to obtain a certificate for activation. To use this activation method, you need to manually store the certificate in the ${HOME}/.baidu/paddlex/licenses directory on the machine (create the directory if it does not exist) and specify the serial number when using the inference API or CLI. Please note: Each serial number can only be bound to a unique device fingerprint and can only be bound once. This means that if users deploy models on different machines, they must prepare separate serial numbers for each machine.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#12-install-high-performance-inference-plugin","title":"1.2 Install High-Performance Inference Plugin","text":"

Find the corresponding installation command in the table below based on processor architecture, operating system, device type, Python version, and other information, and execute it in the deployment environment:

Processor Architecture Operating System Device Type Python Version Installation Command x86-64 Linux CPU 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device cpu --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device cpu --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310 GPU (CUDA 11.8 + cuDNN 8.6) 3.8 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.8 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 38 3.9 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.9 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 39 3.10 curl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device gpu_cuda118_cudnn86 --py 310
  • When the device type is GPU, please use the installation command corresponding to the CUDA and cuDNN versions that match your environment; otherwise, the high-performance inference plugin will not function properly.
  • For Linux systems, use Bash to execute the installation command.
  • When the device type is CPU, the installed high-performance inference plugin only supports inference using the CPU; for other device types, the installed high-performance inference plugin supports inference using the CPU or other devices.
"},{"location":"en/practical_tutorials/deployment_tutorial.html#13-enabling-high-performance-inference-plugins","title":"1.3 Enabling High-Performance Inference Plugins","text":"

Before enabling high-performance plugins, ensure that the LD_LIBRARY_PATH in the current environment does not specify the shared library directory of TensorRT, as the plugins already integrate TensorRT to avoid conflicts caused by different TensorRT versions that may prevent the plugins from functioning properly.

For PaddleX CLI, specify --use_hpip and set the serial number to enable the high-performance inference plugin. If you wish to activate online, specify --update_license when using the serial number for the first time, taking the General OCR pipeline as an example:

paddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --serial_number {serial_number}\n\n# If you wish to activate online\npaddlex \\\n    --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \\\n    --device gpu:0 \\\n    --use_hpip \\\n    --update_license \\\n    --serial_number {serial_number}\n

For the PaddleX Python API, the method to enable the high-performance inference plugin is similar. Again, taking the General OCR pipeline as an example:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"OCR\",\n    use_hpip=True,\n    hpi_params={\"serial_number\": xxx}\n)\n\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png \")\n

The inference results obtained with the high-performance inference plugin are consistent with those without the plugin enabled. For some models, enabling the high-performance inference plugin for the first time may take a longer time to complete the construction of the inference engine. PaddleX will cache relevant information in the model directory after the first construction of the inference engine and reuse the cached content in subsequent initializations to improve speed.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#14-inference-steps","title":"1.4 Inference Steps","text":"

This inference process is based on PaddleX CLI, online activation of serial numbers, Python 3.10.0, and using a CPU device with the high-performance inference plugin. For other usage methods (such as different Python versions, device types, or PaddleX Python API), refer to the PaddleX High-Performance Inference Guide to replace the corresponding commands.

# Install the high-performance inference plugin\ncurl -s https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/deploy/paddlex_hpi/install_script/latest/install_paddlex_hpi.py | python3.10 - --arch x86_64 --os linux --device cpu --py 310\n# Ensure that the `LD_LIBRARY_PATH` in the current environment does not specify the shared library directory of TensorRT. You can use the following command to remove it or manually remove it.\nexport LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\\n' | grep -v TensorRT | tr '\\n' ':' | sed 's/:*$//')\n# Perform inference\npaddlex --pipeline OCR --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

Output:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#15-changing-pipelines-or-models","title":"1.5 Changing Pipelines or Models","text":"
  • Changing Pipelines:

If you want to use a different pipeline with the high-performance inference plugin, simply replace the value passed to --pipeline. Here is an example using the General Object Detection pipeline:

paddlex --pipeline object_detection --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n
  • Changing Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to use other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./OCR.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to use another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific operations are as follows:

# 1. Obtain the OCR pipeline configuration file and save it to ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Use the modified configuration file when performing inference\npaddlex --pipeline ./object_detection.yaml --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0 --use_hpip --serial_number {serial_number} --update_license True --save_path ./output\n

The operations for other pipelines are similar to those for the above two pipelines. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#2-service-deployment-example","title":"2 Service Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#21-installing-the-service-deployment-plugin","title":"2.1 Installing the Service Deployment Plugin","text":"

Execute the following command to install the service deployment plugin:

paddlex --install serving\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#22-starting-the-service","title":"2.2 Starting the Service","text":"

Start the service through the PaddleX CLI with the command format:

paddlex --serve --pipeline {Pipeline name or pipeline configuration file path} [{Other command-line options}]\n

Taking the General OCR pipeline as an example:

paddlex --serve --pipeline OCR\n

After the service starts successfully, you will see information similar to the following:

INFO:     Started server process [63108]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n

--pipeline can be specified as an official pipeline name or a local pipeline configuration file path. PaddleX constructs the pipeline based on this and deploys it as a service. To adjust configurations (such as model path, batch_size, deployment device), please refer to the \"Model Application\" section in the General OCR Pipeline Tutorial.

The command-line options related to service deployment are as follows:

Name Description --pipeline Pipeline name or pipeline configuration file path. --device Deployment device for the pipeline. Default is cpu (if GPU is not available) or gpu (if GPU is available). --host Hostname or IP address bound to the server. Default is 0.0.0.0. --port Port number listened to by the server. Default is 8080. --use_hpip Enables the high-performance inference plugin if specified. --serial_number Serial number used by the high-performance inference plugin. Only valid when the high-performance inference plugin is enabled. Please note that not all pipelines and models support the use of the high-performance inference plugin. For detailed support, please refer to the PaddleX High-Performance Inference Guide. --update_license Performs online activation if specified. Only valid when the high-performance inference plugin is enabled."},{"location":"en/practical_tutorials/deployment_tutorial.html#23-calling-the-service","title":"2.3 Calling the Service","text":"

Here, only the Python calling example is shown. For API references and service calling examples in other languages, please refer to the \"Calling the Service\" section in the \"Development Integration/Deployment\" part of each pipeline usage tutorial in the PaddleX Serving Deployment Guide.

import base64\nimport requests\n\nAPI_URL = \"http://localhost:8080/ocr\" # Service URL\nimage_path = \"./demo.jpg\"\noutput_image_path = \"./out.jpg\"\n\n# Encode the local image in Base64\nwith open(image_path, \"rb\") as file:\n    image_bytes = file.read()\n    image_data = base64.b64encode(image_bytes).decode(\"ascii\")\n\npayload = {\"image\": image_data}  # Base64-encoded file content or image URL\n\n# Call the API\nresponse = requests.post(API_URL, json=payload)\n\n# Process the response data\nassert response.status_code == 200\nresult = response.json()[\"result\"]\nwith open(output_image_path, \"wb\") as file:\n    file.write(base64.b64decode(result[\"image\"]))\nprint(f\"Output image saved at {output_image_path}\")\nprint(\"\\nDetected texts:\")\nprint(result[\"texts\"])\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#24-deployment-steps","title":"2.4 Deployment Steps","text":"
# Install the service deployment plugin\npaddlex --install serving\n# Start the service\npaddlex --serve --pipeline OCR\n# Call the service | The code in fast_test.py is a Python calling example from the previous section\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

Running Results:

"},{"location":"en/practical_tutorials/deployment_tutorial.html#25-change-pipelines-or-models","title":"2.5 Change Pipelines or Models","text":"
  • Change Pipelines:

If you want to deploy another pipeline for service, simply replace the value passed to --pipeline. The following example uses the General Object Detection pipeline:

paddlex --serve --pipeline object_detection\n
  • Change Models:

The OCR pipeline defaults to using the PP-OCRv4_mobile_det and PP-OCRv4_mobile_rec models. If you want to switch to other models, such as PP-OCRv4_server_det and PP-OCRv4_server_rec, refer to the General OCR Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the OCR pipeline configuration file and save it as ./OCR.yaml\npaddlex --get_pipeline_config OCR --save_path ./OCR.yaml\n\n# 2. Modify the ./OCR.yaml configuration file\n#    Change the value of Pipeline.text_det_model to the path of the PP-OCRv4_server_det model\n#    Change the value of Pipeline.text_rec_model to the path of the PP-OCRv4_server_rec model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./OCR.yaml\n# 4. Call the service\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The General Object Detection pipeline defaults to using the PicoDet-S model. If you want to switch to another model, such as RT-DETR, refer to the General Object Detection Pipeline Tutorial. The specific steps are as follows:

# 1. Obtain the object detection pipeline configuration file and save it as ./object_detection.yaml\npaddlex --get_pipeline_config object_detection --save_path ./object_detection.yaml\n\n# 2. Modify the ./object_detection.yaml configuration file\n#    Change the value of Pipeline.model to the path of the RT-DETR model\n\n# 3. Start the service using the modified configuration file\npaddlex --serve --pipeline ./object_detection.yaml\n# 4. Call the service | fast_test.py needs to be replaced with the Python calling example from the General Object Detection Pipeline Tutorial\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png -O demo.jpg\npython fast_test.py\n

The operations for other pipelines are similar to the above two. For more details, refer to the pipeline usage tutorials.

"},{"location":"en/practical_tutorials/deployment_tutorial.html#3-edge-deployment-example","title":"3 Edge Deployment Example","text":""},{"location":"en/practical_tutorials/deployment_tutorial.html#31-environment-preparation","title":"3.1 Environment Preparation","text":"
  1. Install the CMake compilation tool locally and download the required version of the NDK software package from the Android NDK official website. For example, if developing on a Mac, download the NDK software package for the Mac platform from the Android NDK website.

    Environment Requirements - CMake >= 3.10 (the minimum version is not verified, but 3.20 and above are recommended) - Android NDK >= r17c (the minimum version is not verified, but r20b and above are recommended)

    Testing Environment Used in This Guide: - cmake == 3.20.0 - android-ndk == r20b

  2. Prepare an Android phone and enable USB debugging mode. Enable method: Phone Settings -> Find Developer Options -> Turn on Developer Options and USB Debugging Mode.

  3. Install the ADB tool on your computer for debugging. The ADB installation methods are as follows:

    3.1. Install ADB on Mac

     brew cask install android-platform-tools\n

    3.2. Install ADB on Linux

     # Installation method for Debian-based Linux distributions\n sudo apt update\n sudo apt install -y wget adb\n\n # Installation method for Red Hat-based Linux distributions\n sudo yum install adb\n

    3.3. Install ADB on Windows

    To install on Windows, go to Google's Android platform to download the ADB software package for installation: Link

    Open the terminal, connect the phone to the computer, and enter in the terminal

     adb devices\n

    If there is a device output, it indicates successful installation.

     List of devices attached\n 744be294    device\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#32-material-preparation","title":"3.2 Material Preparation","text":"
  1. Clone the feature/paddle-x branch of the Paddle-Lite-Demo repository into the PaddleX-Lite-Deploy directory.

    git clone -b feature/paddle-x https://github.com/PaddlePaddle/Paddle-Lite-Demo.git PaddleX-Lite-Deploy\n
  2. Fill out the survey to download the compressed package, place the compressed package in the specified extraction directory, switch to the specified extraction directory, and execute the extraction command.

    # 1. Switch to the specified extraction directory\ncd PaddleX-Lite-Deploy/ocr/android/shell/ppocr_demo\n\n# 2. Execute the extraction command\nunzip ocr.zip\n
"},{"location":"en/practical_tutorials/deployment_tutorial.html#33-deployment-steps","title":"3.3 Deployment Steps","text":"
  1. Switch the working directory to PaddleX-Lite-Deploy/libs, run the download.sh script to download the required Paddle Lite prediction library. This step only needs to be executed once to support each demo.

  2. Switch the working directory to PaddleX-Lite-Deploy/ocr/assets, run the download.sh script to download the model files optimized by the paddle_lite_opt tool.

  3. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the build.sh script to complete the compilation of the executable file.

  4. Switch the working directory to PaddleX-Lite-Deploy/ocr/android/shell/cxx/ppocr_demo, run the run.sh script to complete the inference on the edge side.

Notes: - Before running the build.sh script, you need to change the path specified by NDK_ROOT to the actual installed NDK path. - You can execute the deployment steps using Git Bash on a Windows system. - If compiling on a Windows system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to windows. - If compiling on a Mac system, set CMAKE_SYSTEM_NAME in CMakeLists.txt to darwin. - Maintain an ADB connection when running the run.sh script. - The download.sh and run.sh scripts support passing parameters to specify models. If not specified, the PP-OCRv4_mobile model is used by default. Currently, two models are supported: - PP-OCRv3_mobile - PP-OCRv4_mobile

Here are examples of actual operations:

# 1. Download the required Paddle Lite prediction library\ncd PaddleX-Lite-Deploy/libs\nsh download.sh\n\n# 2. Download the model files optimized by the paddle_lite_opt tool\ncd ../ocr/assets\nsh download.sh PP-OCRv4_mobile\n\n# 3. Complete the compilation of the executable file\ncd ../android/shell/ppocr_demo\nsh build.sh\n\n# 4. Inference\nsh run.sh PP-OCRv4_mobile\n

Detection Results:

Recognition Results:

The detection visualized image saved in ./test_img_result.jpg\n0       Pure Nutrition Hair Conditioner  0.993706\n1       Product Information/Parameters   0.991224\n2       (45 yuan/kg, minimum order 100 kg)    0.938893\n3       Each bottle 22 yuan, minimum order 1000 bottles)  0.988353\n4       [Brand]: OEM/ODM Manufacturing   0.97557\n5       [Product Name]: Pure Nutrition Hair Conditioner  0.986914\n6       OEM/ODM  0.929891\n7       [Product Number]: YM-X-3011 0.964156\n8       [Net Content]: 220ml      0.976404\n9       [Suitable for]: All skin types  0.987942\n10      [Main Ingredients]: Cetyl Stearyl Alcohol, Oat \u03b2-Glucan,  0.968315\n11      Cocoamide Propyl Betaine, Panthenol    0.941537\n12      (Finished Product Packaging)    0.974796\n13      [Main Function]: Can tighten the hair\u200b\u9cde\u7247\u200b, achieving  0.988799\n14      immediate and lasting improvement in hair gloss, providing sufficient nourishment to dry hair  0.989547\n15      [Main Function Continued]: Nourishment    0.998413\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Paper and Literature Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Document information extraction is a part of document processing with widespread applications in numerous scenarios, such as academic research, library management, scientific and technological intelligence analysis, and literature review writing. Through document information extraction technology, we can automatically extract key information from academic papers, including titles, authors, abstracts, keywords, publication years, journal names, citation information, and more, and store this information in a structured format for easy subsequent retrieval, analysis, and application. This not only enhances the work efficiency of researchers but also provides strong support for the in-depth development of academic research.

Firstly, it is necessary to select the corresponding PaddleX pipeline based on the task scenario. This section takes information extraction from academic papers as an example to introduce how to conduct secondary development for tasks related to the Document Scene Information Extraction v3 pipeline, which corresponds to the Document Scene Information Extraction v3 in PaddleX. If you are unsure about the correspondence between tasks and pipelines, you can refer to the capability introductions of related pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpfnss9sq9_layout.jpg.\nThe result has been saved in output/tmpfnss9sq9_ocr.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9_table.jpg.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.html.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\nThe result has been saved in output/tmpfnss9sq9/tmpfnss9sq9.xlsx.\n\n{'chat_res': {'\u200b\u9875\u7709\u200b': '\u200b\u672a\u77e5\u200b', '\u200b\u56fe\u8868\u200b\u6807\u9898\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of layout area detection, OCR, table recognition, as well as the table results in HTML and XLSX formats, are saved.

Among them, the visualization of the layout area detection results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. Due to the current limitation of the official model, which only distinguishes among figures, tables, and seals, it is currently unable to accurately locate and extract other information such as headers and table titles. The results for these in {'chat_res': {'header': 'unknown', 'table caption': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of academic papers. Utilizing a dataset of academic paper documents, with the extraction of header and chart title information as examples, the layout analysis model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract header and table title information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Paper Document File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 4 end-to-end layout detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description PicoDet_layout_1x 86.8 13.0 91.3 7.4 An efficient layout area localization model trained on the PubLayNet dataset based on PicoDet-1x can locate five types of areas, including text, titles, tables, images, and lists. PicoDet-S_layout_3cls 87.1 13.5 45.8 4.8 An high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-S_layout_17cls 70.3 13.6 46.2 4.8 A high-efficient layout area localization model trained on a self-constructed dataset based on PicoDet-S_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. PicoDet-L_layout_3cls 89.3 15.7 159.8 22.6 An efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. PicoDet-L_layout_17cls 79.9 17.2 160.2 22.6 A efficient layout area localization model trained on a self-constructed dataset based on PicoDet-L_layout_17cls for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals. RT-DETR-H_layout_3cls 95.9 114.6 3832.6 470.1 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes three categories: tables, images, and seals. RT-DETR-H_layout_17cls 92.6 115.1 3827.2 470.2 A high-precision layout area localization model trained on a self-constructed dataset based on RT-DETR-H for scenarios such as Chinese and English papers, magazines, and research reports includes 17 common layout categories, namely: paragraph titles, images, text, numbers, abstracts, content, chart titles, formulas, tables, table titles, references, document titles, footnotes, headers, algorithms, footers, and seals.

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout region analysis dataset, containing 10,000 images of common document types, including English and Chinese papers, magazines, research reports, etc. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Academic paper literature Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/paperlayout.tar -P ./dataset\ntar -xf ./dataset/paperlayout.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/paperlayout/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 4734,\n    \"train_sample_paths\": [\n      \"check_dataset\\/demo_img\\/train_4612.jpg\",\n      \"check_dataset\\/demo_img\\/train_4844.jpg\",\n      \"check_dataset\\/demo_img\\/train_0084.jpg\",\n      \"check_dataset\\/demo_img\\/train_0448.jpg\",\n      \"check_dataset\\/demo_img\\/train_4703.jpg\",\n      \"check_dataset\\/demo_img\\/train_3572.jpg\",\n      \"check_dataset\\/demo_img\\/train_4516.jpg\",\n      \"check_dataset\\/demo_img\\/train_2836.jpg\",\n      \"check_dataset\\/demo_img\\/train_1353.jpg\",\n      \"check_dataset\\/demo_img\\/train_0225.jpg\"\n    ],\n    \"val_samples\": 928,\n    \"val_sample_paths\": [\n      \"check_dataset\\/demo_img\\/val_0982.jpg\",\n      \"check_dataset\\/demo_img\\/val_0607.jpg\",\n      \"check_dataset\\/demo_img\\/val_0623.jpg\",\n      \"check_dataset\\/demo_img\\/val_0890.jpg\",\n      \"check_dataset\\/demo_img\\/val_0036.jpg\",\n      \"check_dataset\\/demo_img\\/val_0654.jpg\",\n      \"check_dataset\\/demo_img\\/val_0895.jpg\",\n      \"check_dataset\\/demo_img\\/val_0059.jpg\",\n      \"check_dataset\\/demo_img\\/val_0142.jpg\",\n      \"check_dataset\\/demo_img\\/val_0088.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/paperlayout\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 4734;
  • attributes.val_samples: The number of validation set samples in this dataset is 928;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/paperlayout\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate four experiments based on the RT-DETR-H_layout_3cls model, with learning rates of: 0.001\uff0c0.0005\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 50 and 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate mAP@@0.50:0.95 1 0.00001 88.90 2 0.0001 92.41 3 0.0005 92.27 4 0.001 90.66

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [2, 4, 5] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate mAP@@0.50:0.95 2 30 92.41 4 50 92.63 5 100 92.88

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/paperlayout \\\n    -o Train.num_classes=4 \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#54-model-inference","title":"5.4 Model Inference","text":"

You can test the fine-tuned single model using test file

python main.py -c paddlex/configs/structure_analysis/RT-DETR-H_layout_3cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\"\n

By following the above steps, prediction results can be generated under the ./output directory. The layout prediction result for test.jpg is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the academic paper literature test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.layout_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: ./output/best_model/inference\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: PP-OCRv4_server_seal_det\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'header': '\u200b\u7b2c\u200b43\u200b\u5377\u200b\\n \u200b\u822a\u7a7a\u200b\u53d1\u52a8\u673a\u200b\\n 44', 'table caption': '\u200b\u8868\u200b1\u200b\u6a21\u62df\u200b\u6765\u6d41\u200bMa=5\u200b\u98de\u884c\u200b\u7684\u200b\u7a7a\u6c14\u200b\u52a0\u70ed\u5668\u200b\u5de5\u4f5c\u200b\u53c2\u6570\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the layout is as follows, with the correctly added ability to locate the areas of headers and table titles:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28layout_detection%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_layout/test.jpg\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"header\", \"table caption\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html","title":"PaddleX 3.0 Document Scene Information Extraction v3 (PP-ChatOCRv3_doc) \u2014\u2014 Tutorial on Seal Information Extraction","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

Seal information extraction is a part of document processing and has applications in many scenarios, such as contract comparison, inventory review, and invoice reimbursement review. Using artificial intelligence technology for automatic seal recognition can effectively save labor costs and improve efficiency for enterprises.

Firstly, it is necessary to select the corresponding PaddleX production line based on the task scenario. This section is about the seal information extraction task, and it is not difficult to find that the seal information extraction task is closely related to the document scenario information extraction task. Document scene information extraction, which extracts text information from documents or images, is a classic problem in the field of computer vision. Corresponding to PaddleX's document scene information extraction v3 production line. If you are unable to determine the correspondence between tasks and production lines, you can learn about the capabilities of the relevant production lines in PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience its capabilities. You can try out the Document Scene Information Extraction v3 pipeline online, or you can use Python locally to experience the effects of the Document Scene Information Extraction v3 pipeline.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#21-local-experience","title":"2.1 Local Experience","text":"

Before using the Document Scene Information Extraction v3 pipeline locally, please ensure that you have completed the installation of the PaddleX wheel package according to the PaddleX Local Installation Tutorial. With just a few lines of code, you can quickly perform inference using the pipeline:

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"PP-ChatOCRv3-doc\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

Note: Currently, the large language model only supports Ernie. You can obtain the relevant ak/sk (access_token) on the Baidu Cloud Qianfan Platform or Baidu AIStudio Community. If you use the Baidu Cloud Qianfan Platform, you can refer to the AK and SK Authentication API Calling Process to obtain ak/sk. If you use Baidu AIStudio Community, you can obtain the access_token from the Baidu AIStudio Community Access Token.

The printed output results are as follows:

The result has been saved in output/tmpx5tmgsem_curve_0.jpg.\nThe result has been saved in output/tmpx5tmgsem_layout.jpg.\nThe result has been saved in output/tmpx5tmgsem_ocr.jpg.\nThe retrieved vectorstore is not for PaddleX and will return vectorstore directly\n\n{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u672a\u77e5\u200b'}, 'prompt': ''}\n

In the output directory, the visualization results of seal_recognition and OCR (if table exits, table recognition, as well as the table results in HTML and XLSX formats), are saved.

Among them, the visualization of the seal_recognition results is as follows:

Through the online experience of the document scene information extraction, a Badcase analysis can be conducted to identify issues with the official model of the document scene information extraction pipeline. The official model of the document scene information extraction production line has been found to have the following issues in the current demand scenario: in the visualization of OCR recognition, there is a deviation in the text bending detection box of the seal, resulting in incorrect seal text recognition; The information on the seal was not correctly extracted. The results for these in {'chat_res': {'seal': 'unknown'}, 'prompt': ''} are unknown. Therefore, this section focuses on the scenario of Seal Text Recognitions. Utilizing a dataset of Seal Text Recognition, with the extraction of seal information as examples, the seal text detection model within the document scene information extraction pipeline is fine-tuned to achieve the ability to accurately extract seal information from the document.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#22-online-experience","title":"2.2 Online Experience","text":"

You can experience the effectiveness of the Document Scene Information Extraction v3 pipeline on the AIStudio Community. Click the link to download the Test Seal File, and then upload it to the official Document Scene Information Extraction v3 application to experience the extraction results. The process is as follows:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 2 end-to-end seal text detection models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model mAP(0.5) (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) Description - - - - - - PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7M PP-OCRv4_mobile_seal_det.yaml PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml

Note: The evaluation set for the above accuracy metrics is our self-built seal text detection dataset, containing 500 images of circle seal types. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Seal Text Detection Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Object Detection Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/practical_seal.tar -P ./dataset\ntar -xf ./dataset/practical_seal.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/practical_seal/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 793,\n    \"train_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4055390_00006_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3712248_00008_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4227328_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3745965_00007_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3980931_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC5896212_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC3838814_00003_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4677212_00002_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4058803_00001_seal_0_crop.png\",\n      \"..\\/dataset\\/practical_seal\\/images\\/PMC4925966_00001_seal_0_crop.png\"\n    ],\n    \"val_samples\": 277,\n    \"val_sample_paths\": [\n      \"..\\/dataset\\/practical_seal\\/images\\/15.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/16.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/17.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/18.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/19.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/20.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/21.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/22.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/23.jpg\",\n      \"..\\/dataset\\/practical_seal\\/images\\/24.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \".\\/dataset\\/practical_seal\\/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of training set samples in this dataset is 739;
  • attributes.val_samples: The number of validation set samples in this dataset is 277;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all boxes's width and height in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4 \\\n    -o Train.learning_rate=0.0001\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/practical_seal\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 30, and set the batch size to 4 due to the small size of the training dataset.
  2. Initiate 3 experiments based on the PP-OCRv4_server_seal_det model, with learning rates of: 0.001\uff0c0.0001\uff0c0.00001.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results:

Experiment ID Learning Rate Hmean(%) 1 0.001 97.35 2 0.0001 93.32 3 0.00001 87.63

Next, we can increase the number of training epochs based on a learning rate set to 0.001. Comparing experiments [1, 4] below, it can be seen that as the number of training epochs increases, the model's accuracy further improves.

Experiment ID Learning Rate Hmean(%) 1 30 97.35 4 100 98.13

Note: This tutorial is designed for a 4-GPU setup. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align perfectly with the above indicators, which is normal.

When selecting a training environment, it is important to consider the relationship between the number of training GPUs, the total batch_size, and the learning rate. Firstly, the total batch_size is equal to the number of training GPUs multiplied by the batch_size per GPU. Secondly, the total batch_size and the learning rate are related, and the learning rate should be adjusted in synchronization with the total batch_size. The default learning rate corresponds to a total batch_size based on 4 GPUs. If you plan to train in a single-GPU environment, you need to divide the learning rate by 4 accordingly. If you plan to train in an 8-GPU environment, you need to multiply the learning rate by 2 accordingly.

For reference, the command to execute training with different parameter adjustments can be:

python main.py -c paddlex/configs/text_detection_seal/PP-OCRv4_server_seal_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/practical_seal \\\n    -o Train.learning_rate=0.0001 \\\n    -o Train.epochs_iters=30 \\\n    -o Train.batch_size=4\n
"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#6-pipeline-inference","title":"6. Pipeline Inference","text":"

Replace the model in the production line with the fine-tuned model for testing, and use the test file to perform predictions.

First, obtain and update the configuration file for the Document Information Extraction v3. Execute the following command to retrieve the configuration file (assuming a custom save location of ./my_path):

paddlex --get_pipeline_config PP-ChatOCRv3-doc --save_path ./my_path\n

Modify the Pipeline.seal_text_det_model field in PP-ChatOCRv3-doc.yaml to the path of the fine-tuned model mentioned above. The modified configuration is as follows:

Pipeline:\n  layout_model: RT-DETR-H_layout_3cls\n  table_model: SLANet_plus\n  text_det_model: PP-OCRv4_server_det\n  text_rec_model: PP-OCRv4_server_rec\n  seal_text_det_model: ./output/best_accuracy/inference\n  doc_image_ori_cls_model: null\n  doc_image_unwarp_model: null\n  llm_name: \"ernie-3.5\"\n  llm_params:\n    api_type: qianfan\n    ak:\n    sk:\n

After making the modifications, you only need to change the value of the pipeline parameter in the create_pipeline method to the path of the production line configuration file to apply the configuration.

from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # \u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200bak\u200b\u4e0e\u200bsk\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # \u200b\u6216\u8005\u200b\u4f7f\u7528\u200bAIStudio\u200b\u63a5\u53e3\u200b\uff0c\u200b\u8bf7\u200b\u586b\u5165\u200b\u60a8\u200b\u7684\u200baccess_token\uff0c\u200b\u5426\u5219\u200b\u65e0\u6cd5\u200b\u8c03\u7528\u200b\u5927\u200b\u6a21\u578b\u200b\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output_ft\")\n    res.save_to_html('./output_ft')\n    res.save_to_xlsx('./output_ft')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

By following the above steps, prediction results can be generated under ./output_ft, and the printed key information extraction results are as follows:

{'chat_res': {'\u200b\u5370\u7ae0\u200b\u540d\u79f0\u200b': '\u200b\u5e7f\u5173\u5e02\u200b\u56fd\u58eb\u200b\u8d44\u6e90\u200b\u5c40\u200b'}, 'prompt': ''}\n

It can be observed that after fine-tuning the model, the key information has been correctly extracted.

The visualization result of the seal is as follows, with the correctly added ability to extract the seal text information:

"},{"location":"en/practical_tutorials/document_scene_information_extraction%28seal_recognition%29_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the Document Scene Information Extraction v3 production line meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model production line in your Python project, as shown in the following code:
from paddlex import create_pipeline\n\npipeline = create_pipeline(\n    pipeline=\"./my_path/PP-ChatOCRv3-doc.yaml\",\n    llm_name=\"ernie-3.5\",\n    llm_params={\"api_type\": \"qianfan\", \"ak\": \"\", \"sk\": \"\"} # To use the Qianfan API, please fill in your Access Key (ak) and Secret Key (sk), as you will not be able to invoke large models without them.\n    # llm_params={\"api_type\": \"aistudio\", \"access_token\": \"\"} # Or, to use the AIStudio API, please fill in your access_token, as you will not be able to invoke large models without it.\n    )\n\nvisual_result, visual_info = pipeline.visual_predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/PP-ChatOCRv3_doc_seal/test.png\")\n\nfor res in visual_result:\n    res.save_to_img(\"./output\")\n    res.save_to_html('./output')\n    res.save_to_xlsx('./output')\n\nvector = pipeline.build_vector(visual_info=visual_info)\nchat_result = pipeline.chat(\n    key_list=[\"seal\"],\n    visual_info=visual_info,\n    vector=vector,\n    )\nchat_result.print()\n

For more parameters, please refer to the Document Scene Information Extraction Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html","title":"PaddleX 3.0 General Image Classification Pipeline \u2014 Garbage Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a garbage classification task as an example.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For garbage classification, it falls under the general image classification task, corresponding to PaddleX's universal image classification pipeline. If you're unsure about the task-pipeline correspondence, you can check the capabilities of relevant pipelines in the PaddleX Supported Pipelines List.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline image_classification \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a General Image Classification pipeline for a quick trial.

Quick Trial Output Example:

After trying the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is not satisfactory, you can test alternative models and decide if further fine-tuning is needed. Since this tutorial aims to classify specific garbage types, the default weights (trained on the ImageNet-1k dataset) are insufficient. You need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#3-choosing-a-model","title":"3. Choosing a Model","text":"

PaddleX provides 80 end-to-end image classification models, which can be referenced in the Model List. Some of the benchmarks for these models are as follows:

Model List Top-1 Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) PP-HGNetV2_B6 86.30 10.46 240.18 288 CLIP_vit_base_patch16_224 85.39 12.03 234.85 331 PP-HGNetV2_B4 83.57 2.45 38.10 76 SwinTransformer_base_patch4_window7_224 83.37 12.35 - 342 PP-HGNet_small 81.51 4.24 108.21 94 PP-HGNetV2_B0 77.77 0.68 6.41 23 ResNet50 76.50 3.12 50.90 98 PP-LCNet_x1_0 71.32 1.01 3.39 7 MobileNetV3_small_x1_0 68.24 1.09 3.65 12

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial will use the PP-LCNet_x1_0 model as an example to complete the full model development process. You can select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within your pipeline and ultimately use them in real-world scenarios.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the Garbage Classification Dataset as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to the PaddleX Image Classification Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/trash40.tar -P ./dataset\ntar -xf ./dataset/trash40.tar -C ./dataset/\n
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply run the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/trash40/\n

After executing the above command, PaddleX will verify the dataset and count the basic information of the dataset. If the command runs successfully, it will print Check dataset passed ! in the log, and the relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized example images and a histogram of sample distribution. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"label_file\": ../../dataset/trash40/label.txt\",\n    \"num_classes\": 40,\n    \"train_samples\": 1605,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/img_14950.jpg\",\n      \"check_dataset/demo_img/img_12045.jpg\",\n    ],\n    \"val_samples\": 3558,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/img_198.jpg\",\n      \"check_dataset/demo_img/img_19627.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/trash40/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"ClsDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 40, which is the number of classes that need to be passed in for subsequent training;
  • attributes.train_samples: The number of training set samples in this dataset is 1605;
  • attributes.val_samples: The number of validation set samples in this dataset is 3558;
  • attributes.train_sample_paths: A list of relative paths to the visualized images of the training set samples in this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualized images of the validation set samples in this dataset;

In addition, the dataset verification also analyzes the sample number distribution of all categories in the dataset and draws a distribution histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. When set to True, the dataset format will be converted. The default is False;
      • train_percent: If the dataset is to be re-split, you need to set the percentage of the training set. The type is any integer between 0-100, and it needs to ensure that the sum with val_percent is 100;
      • val_percent: If the dataset is to be re-split, you need to set the percentage of the validation set. The type is any integer between 0-100, and it needs to ensure that the sum with train_percent is 100;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#data-splitting","title":"Data Splitting","text":"

When splitting data, the original annotation files will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the ratio of training set to validation set: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/trash40 \\\n    -o Train.num_classes=40\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics and related file paths;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/trash40\n

Similar to model training, model evaluation supports setting by modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 20, and set the batch size to 64 due to the small size of the training dataset.
  2. Initiate three experiments based on the PP-LCNet_x1_0 model, with learning rates of: 0.01, 0.001, 0.1.
  3. It can be observed that the configuration with the highest accuracy in Experiment 1 is a learning rate of 0.01. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 2 20 0.001 64 4 GPUs 30.64% Experiment 3 20 0.1 64 4 GPUs 71.53%

Changing Epochs Experiment Results: Experiment Epochs Learning Rate batch_size Training Environment Top-1 Acc Experiment 1 20 0.01 64 4 GPUs 73.83% Experiment 1 (Increased Epochs) 50 0.01 64 4 GPUs 77.32% Experiment 1 (Increased Epochs) 80 0.01 64 4 GPUs 77.60% Experiment 1 (Increased Epochs) 100 0.01 64 4 GPUs 77.80%

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set. GPU inference time is based on an NVIDIA Tesla T4 machine, with FP32 precision. CPU inference speed is based on an Intel\u00ae Xeon\u00ae Gold 5117 CPU @ 2.00GHz, with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing. Use the test file to perform predictions:

python main.py -c paddlex/configs/image_classification/PP-LCNet_x1_0.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/garbage_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for garbage_demo.png is shown below:

"},{"location":"en/practical_tutorials/image_classification_garbage_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Image Classification Pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/image_classification.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/image_classification.yaml\")\noutput = pipeline.predict(\"./dataset/trash40/images/test/0/img_154.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Image Classification Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugin aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html","title":"PaddleX 3.0 General Instance Segmentation Pipeline \u2014 Tutorial for Remote Sensing Image Instance Segmentation","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can tackle specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of remote sensing image segmentation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For remote sensing image segmentation, this falls under the category of instance segmentation, corresponding to PaddleX's Universal Instance Segmentation Pipeline. If unsure about the task-pipeline correspondence, refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline instance_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Instance Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the included model needs further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for testing until satisfied. If the final results are unsatisfactory, fine-tuning the model is necessary. This tutorial aims to produce a model that segments geospatial objects, and the default weights (trained on the COCO dataset) cannot meet this requirement. Data collection and annotation are required for training and fine-tuning.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides 15 end-to-end instance segmentation models. Refer to the Model List for details. Benchmarks for some models are as follows:

Model List mAP(%) GPU Inference Time(ms) Model Size(M) Mask-RT-DETR-H 48.8 61.40 486 Mask-RT-DETR-X 47.5 45.70 257 Mask-RT-DETR-L 45.7 37.40 123 Mask-RT-DETR-S 40.9 32.40 57

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA V100 machine with FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the Mask-RT-DETR-H model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally apply them in real-world scenarios.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Remote Sensing Image Instance Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you are using your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Instance Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/intseg_remote_sense_coco.tar -P ./dataset\ntar -xf ./dataset/intseg_remote_sense_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

When verifying the dataset, you only need one command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print Check dataset passed !, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is as follows:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 10,\n    \"train_samples\": 2989,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/524.jpg\",\n      \"check_dataset/demo_img/024.jpg\",\n    ],\n    \"val_samples\": 932,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/326.jpg\",\n      \"check_dataset/demo_img/596.jpg\",\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/intseg_remote_sense_coco/\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCOInstSegDataset\"\n}\n

In the above verification results, check_pass being true indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 10, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 2989.
  • attributes.val_samples: The number of validation samples in this dataset is 932.
  • attributes.train_sample_paths: A list of relative paths to the visualized training samples.
  • attributes.val_sample_paths: A list of relative paths to the visualized validation samples.

Additionally, the dataset verification also analyzes the sample number distribution of all categories in the dataset and generates a distribution histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. The following are example explanations of some parameters in the configuration file:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format needs to be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If re-splitting the dataset, the percentage of the training set needs to be set, which is an integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If re-splitting the dataset, the percentage of the validation set needs to be set, which is an integer between 0-100, and the sum with train_percent must be 100;

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in the original path. The above parameters also support setting through appending command line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco \\\n    -o Train.num_classes=10\n

PaddleX model training supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. The following are example explanations of some parameters in the configuration file:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, which logs whether the training task completed successfully, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, which records changes in model metrics, loss variations, etc. during the training process;
  • config.yaml: Training configuration file, which records the hyperparameter configurations for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer states, EMA (Exponential Moving Average), static graph network parameters, and static graph network structures;
"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight files on the validation set to verify the model's accuracy. To perform model evaluation using PaddleX, simply use the following command:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/intseg_remote_sense_coco\n

Similar to model training, model evaluation supports setting configurations by modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 80 and the batch size at 2.
  2. Launch three experiments based on the Mask-RT-DETR-H model with learning rates of: 0.0005, 0.005, 0.0001
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results for different epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 80 0.0005 2 4 GPUs 0.695 Experiment 2 80 0.0001 2 4 GPUs 0.825 Experiment 3 80 0.00005 2 4 GPUs 0.706

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 80 0.0001 2 4 GPUs 0.825 Reduced Epochs in Experiment 2 30 0.0001 2 4 GPUs 0.287 Reduced Epochs in Experiment 2 50 0.0001 2 4 GPUs 0.545 Increased Epochs in Experiment 2 100 0.0001 2 4 GPUs 0.813

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above, which is normal.

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for remotesensing_demo.png is as follows:

"},{"location":"en/practical_tutorials/instance_segmentation_remote_sensing_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general instance segmentation pipeline meets your requirements for inference speed and accuracy, you can proceed with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/instance_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/instance_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remotesensing_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the result visualization image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General Instance Segmentation Pipline User Guide\u3002

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial on Pedestrian Fall Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of pedestrian fall detection.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the appropriate PaddleX pipeline based on your task scenario. For pedestrian fall detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipelines: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\n

  • AIStudio Community Experience: Navigate to Baidu AIStudio Community, click \"Create Pipeline,\" and create a General Object Detection pipeline for a quick trial.

Quick trial output example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. Since the default weights (trained on the COCO dataset) are unlikely to meet the requirements for detecting pedestrian falls, you'll need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Here's a benchmark of some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom offer faster inference speeds, while those from bottom to top offer higher accuracy. This tutorial uses the PP-YOLOE_plus-S model as an example to complete the full model development process. Choose a suitable model based on your actual usage scenario, train it, evaluate the model weights within the pipeline, and finally deploy

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Pedestrian Fall Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/fall_det.tar -P ./dataset\ntar -xf ./dataset/fall_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/fall_det\n

After executing the above command, PaddleX will verify the dataset and count its basic information. Upon successful execution, the log will print out Check dataset passed ! information, and relevant outputs will be saved in the current directory's ./output/check_dataset folder. The output directory includes visualized example images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 1,\n    \"train_samples\": 1224,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/fall_1168.jpg\",\n      \"check_dataset/demo_img/fall_1113.jpg\"\n    ],\n    \"val_samples\": 216,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/fall_349.jpg\",\n      \"check_dataset/demo_img/fall_394.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/fall_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the check_pass being True means the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 1, which is the number of classes that need to be passed in for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 1224.
  • attributes.val_samples: The number of validation samples in this dataset is 216.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False.
      • src_dataset_type: If dataset format conversion is performed, the source dataset format must be specified. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False.
      • train_percent: If dataset splitting is performed, the percentage of the training set must be set. The value should be an integer between 0 and 100, and the sum with val_percent must be 100.
      • val_percent: If dataset splitting is performed, the percentage of the validation set must be set. The value should be an integer between 0 and 100, and the sum with train_percent must be 100.

Data conversion and data splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support setting through appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/fall_det \\\n    -o Train.num_classes=1\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command-line parameters.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Explanation of Training Outputs:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/fall_det\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line parameters.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line parameter, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve model accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The learning rate setting affects the speed and stability of model convergence. Therefore, when optimizing model performance, carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the control variable method when debugging parameters:

  1. First, fix the number of training epochs to 10 and the batch size to 8.
  2. Start three experiments based on the PP-YOLOE_plus-S model with learning rates of: 0.00002, 0.0001, 0.0005.
  3. You may find that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.0001. Based on this training hyperparameter, change the number of epochs and observe the accuracy results of different epochs. It is found that the best accuracy is basically achieved at 100 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 10 0.00002 8 4 GPUs 0.880 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 3 10 0.0005 8 4 GPUs 0.888

Changing Epochs Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 10 0.0001 8 4 GPUs 0.910 Experiment 2 (Increased Epochs) 50 0.0001 8 4 GPUs 0.944 Experiment 2 (Increased Epochs) 100 0.0001 8 4 GPUs 0.947

Note: The above accuracy metrics are based on the mAP(0.5:0.95) of the COCO2017 validation set. GPU inference time is measured on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\"\n

The prediction results will be generated under ./output, and the prediction result for fall.png is shown below:

"},{"location":"en/practical_tutorials/object_detection_fall_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/fall.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html","title":"PaddleX 3.0 General Object Detection Pipeline \u2014 Tutorial for Fashion Element Detection","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can fine-tune the models with your private data. PaddleX also provides Python APIs for easy integration into personal projects. Before proceeding, ensure you have installed PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of fashion element detection in clothing.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For fashion element detection, this falls under the General Object Detection pipeline in PaddleX. If unsure about the task-pipeline correspondence, consult the Pipeline List for capabilities of each pipeline.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: locally through the PaddleX wheel package or on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline object_detection \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\n

  • AIStudio Community Experience: Visit Baidu AIStudio Community, click \"Create Pipeline,\" and select the General Object Detection pipeline for a quick trial.

Quick Trial Output Example:

After the trial, determine if the pipeline meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy is unsatisfactory, test alternative models or proceed with fine-tuning. For this tutorial, aiming to detect fashion elements in clothing, the default weights (trained on the COCO dataset) are insufficient. Data collection and annotation, followed by training and fine-tuning, are necessary.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 37 end-to-end object detection models. Refer to the Model List for details. Below are benchmarks for some models:

Model List mAP(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) RT-DETR-H 56.3 100.65 8451.92 471 RT-DETR-L 53.0 27.89 841.00 125 PP-YOLOE_plus-L 52.9 29.67 700.97 200 PP-YOLOE_plus-S 43.7 8.11 137.23 31 PicoDet-L 42.6 10.09 129.32 23 PicoDet-S 29.1 3.17 13.36 5

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models with faster inference speed are placed higher in the table, while models with higher accuracy are lower. This tutorial takes the PicoDet-L model as an example to complete a full model development process. You can judge and select an appropriate model for training based on your actual usage scenarios. After training, you can evaluate the suitable model weights within the pipeline and ultimately use them in practical scenarios.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Fashion Element Detection Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For data format introductions, you can refer to the PaddleX Object Detection Task Module Data Preparation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_mini_fashion_pedia_coco.tar -P ./dataset\ntar -xf ./dataset/det_mini_fashion_pedia_coco.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful command execution, \"Check dataset passed !\" will be printed in the log, and relevant outputs will be saved in the current directory's ./output/check_dataset directory. The output directory includes visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 15,\n    \"train_samples\": 4000,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/297ea597f7dfa6d710b2e8176cb3b913.jpg\",\n      \"check_dataset/demo_img/2d8b75ce472dbebd41ca8527f0a292f3.jpg\"\n    ],\n    \"val_samples\": 800,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/40e13ebcfa281567c92fc9842510abea.jpg\",\n      \"check_dataset/demo_img/87808e379034ac2344f5132d3dccc6e6.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/det_mini_fashion_pedia_coco\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n
The above verification results indicate that the dataset format meets the requirements as check_pass is True. The explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 15, which is the number of classes to be passed for subsequent training.
  • attributes.train_samples: The number of training samples in this dataset is 4000.
  • attributes.val_samples: The number of validation samples in this dataset is 800.
  • attributes.train_sample_paths: A list of relative paths to the visualization images of training samples in this dataset.
  • attributes.val_sample_paths: A list of relative paths to the visualization images of validation samples in this dataset.

Additionally, the dataset verification also analyzes the distribution of sample numbers across all classes and generates a histogram (histogram.png) for visualization:

Note: Only datasets that pass the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters.

The parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Some example explanations for the parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion. The default is False.
      • src_dataset_type: If dataset format conversion is enabled, you need to set the source dataset format. Available source formats are LabelMe and VOC.
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting. The default is False.
      • train_percent: If dataset splitting is enabled, you need to set the percentage of the training set. The value should be an integer between 0 and 100, and the sum with val_percent should be 100.
      • val_percent: If dataset splitting is enabled, you need to set the percentage of the validation set. The value should be an integer between 0 and 100, and the sum with train_percent should be 100.

Data conversion and data splitting can be enabled simultaneously. The original annotation files for data splitting will be renamed as xxx.bak in the original path. The above parameters can also be set by appending command line arguments, for example, to re-split the dataset and set the training set and validation set ratio: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, please ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco \\\n    -o Train.num_classes=15\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations of parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify the card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 50: -o Train.epochs_iters=50. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/det_mini_fashion_pedia_coco\n

Similar to model training, model evaluation supports modifying the configuration file or appending command line arguments.

Note: When evaluating the model, you need to specify the model weight file path. Each configuration file has a built-in default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/best_model.pdparams.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By reasonably tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs at 50 and the batch size at 16.
  2. Initiate three experiments based on the PicoDet-L model with learning rates of: 0.02, 0.04, 0.08.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.04. Based on this training hyperparameter, change the number of epochs and observe the accuracy results at different epochs, finding that the best accuracy is generally achieved at 80 epochs.

Learning Rate Exploration Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 1 50 0.02 16 4 GPUs 0.428 Experiment 2 50 0.04 16 4 GPUs 0.471 Experiment 3 50 0.08 16 4 GPUs 0.440

Epoch Variation Results: Experiment Epochs Learning Rate batch_size Training Environment mAP@0.5 Experiment 2 50 0.04 16 4 GPUs 0.471 Reduced Epochs in Exp. 2 30 0.04 16 4 GPUs 0.425 Increased Epochs in Exp. 2 80 0.04 16 4 GPUs 0.491 Further Increased Epochs 100 0.04 16 4 GPUs 0.459

Note: This tutorial is designed for a 4-GPU setup. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above figures, which is normal.

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#6-pipeline-testing","title":"6. Pipeline Testing","text":"

Replace the model in the pipeline with the fine-tuned model for testing, e.g.:

python main.py -c paddlex/configs/object_detection/PicoDet-L.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\"\n

The prediction results will be generated under ./output, and the prediction result for FashionPedia_demo.png is as follows:

"},{"location":"en/practical_tutorials/object_detection_fashion_pedia_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the General Object Detection Pipeline meets your requirements for inference speed and precision in your production line, you can proceed directly with development integration/deployment.

  1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/object_detection.yaml configuration file to your own model path:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/object_detection.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/object_detection/FashionPedia_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized result image\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n

For more parameters, please refer to General Object Detection Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 License Plate Recognition Tutorial","text":"

PaddleX provides a rich set of pipelines, each consisting of one or more models that work together to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with a license plate recognition task as an example.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For license plate recognition, this task falls under text detection, corresponding to PaddleX's Universal OCR pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List supported by PaddleX to understand the capabilities of relevant pipelines.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.), and whether the models included in the pipeline need further fine-tuning. If the speed or accuracy of the models does not meet expectations, select replaceable models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tune the models.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides two end-to-end text detection models. For details, refer to the Model List. The benchmarks of the models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The above accuracy metrics are for the Detection Hmean and Recognition Avg Accuracy on PaddleOCR's self-built Chinese dataset validation set. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, the models listed from top to bottom have faster inference speeds, while from bottom to top, they have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Depending on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"License Plate Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For information on data format, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ccpd_text_det.tar -P ./dataset\ntar -xf ./dataset/ccpd_text_det.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#42-dataset-validation","title":"4.2 Dataset Validation","text":"

To validate the dataset, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

After executing the above command, PaddleX will validate the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The validation result file is saved in ./output/check_dataset_result.json, and the specific content of the validation result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 5769,\n    \"train_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/0274305555556-90_266-204&460_520&548-516&548_209&547_204&464_520&460-0_0_3_25_24_24_24_26-63-89.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0126171875-90_267-294&424_498&486-498&486_296&485_294&425_496&424-0_0_3_24_33_32_30_31-157-29.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0371516927083-89_254-178&423_517&534-517&534_204&525_178&431_496&423-1_0_3_24_33_31_29_31-117-667.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/03349609375-90_268-211&469_526&576-526&567_214&576_211&473_520&469-0_0_3_27_31_32_29_32-174-48.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0388454861111-90_269-138&409_496&518-496&518_138&517_139&410_491&409-0_0_3_24_27_26_26_30-174-148.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0198741319444-89_112-208&517_449&600-423&593_208&600_233&517_449&518-0_0_3_24_28_26_26_26-87-268.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3027782118055555555-91_92-186&493_532&574-529&574_199&565_186&497_532&493-0_0_3_27_26_30_33_32-73-336.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/034375-90_258-168&449_528&546-528&542_186&546_168&449_525&449-0_0_3_26_30_30_26_33-94-221.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0286501736111-89_92-290&486_577&587-576&577_290&587_292&491_577&486-0_0_3_17_25_28_30_33-134-122.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/02001953125-92_103-212&486_458&569-458&569_224&555_212&486_446&494-0_0_3_24_24_25_24_24-88-24.jpg\"\n    ],\n    \"val_samples\": 1001,\n    \"val_sample_paths\": [\n      \"..\\/..\\/ccpd_text_det\\/images\\/3056141493055555554-88_93-205&455_603&597-603&575_207&597_205&468_595&455-0_0_3_24_32_27_31_33-90-213.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0680295138889-88_94-120&474_581&623-577&605_126&623_120&483_581&474-0_0_5_24_31_24_24_24-116-518.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0482421875-87_265-154&388_496&530-490&495_154&530_156&411_496&388-0_0_5_25_33_33_33_33-84-104.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0347504340278-105_106-235&443_474&589-474&589_240&518_235&443_473&503-0_0_3_25_30_33_27_30-162-4.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0205338541667-93_262-182&428_410&519-410&519_187&499_182&428_402&442-0_0_3_24_26_29_32_24-83-63.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0380913628472-97_250-234&403_529&534-529&534_250&480_234&403_528&446-0_0_3_25_25_24_25_25-185-85.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/020598958333333334-93_267-256&471_482&563-478&563_256&546_262&471_482&484-0_0_3_26_24_25_32_24-102-115.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3030323350694444445-86_131-170&495_484&593-434&569_170&593_226&511_484&495-11_0_5_30_30_31_33_24-118-59.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/3016158854166666667-86_97-243&471_462&546-462&527_245&546_243&479_453&471-0_0_3_24_30_27_24_29-98-40.jpg\",\n      \"..\\/..\\/ccpd_text_det\\/images\\/0340831163194-89_264-177&412_488&523-477&506_177&523_185&420_488&412-0_0_3_24_30_29_31_31-109-46.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/ccpd_text_det\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"TextDetDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 5769;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 1001;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to perform dataset format conversion, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, ensuring the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, ensuring the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

PaddleX supports modifying training hyperparameters, single-machine single/multi-GPU training, etc., by modifying the configuration file or appending command line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Parameters related to model training can be set by modifying the fields under Train in the configuration file. Some example explanations of the parameters in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset verification (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, please refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first 2 GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, defaulting to output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced. During model inference, static graph weights are selected by default.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, related file paths, etc.;
  • train.log: Training log file, recording model metric changes, loss changes, etc., during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires only one command:

python main.py -c paddlex/configs/text_detection/PP-OCRv4_server_det.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ccpd_text_det\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly according to the actual situation to achieve the best training effect.

It is recommended to follow the controlled variable method when debugging parameters:

  1. First, fix the number of training epochs to 10, the batch size to 8, the number of GPUs to 4, and the total batch size to 32.
  2. Start four experiments based on the PP-OCRv4_server_det model with learning rates of: 0.00005, 0.0001, 0.0005, 0.001.
  3. You can find that Experiment 4 with a learning rate of 0.001 has the highest accuracy, and by observing the validation set score, the accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 20 will further improve the model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Detection Hmean (%) 1 0.00005 99.06 2 0.0001 99.55 3 0.0005 99.60 4 0.001 99.70

Next, based on a learning rate of 0.001, we can increase the number of training epochs. Comparing Experiments [4, 5] below, it can be seen that increasing the number of training epochs further improves the model accuracy. Experiment ID Number of Training Epochs Detection Hmean (%) 4 10 99.70 5 20 99.80

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can complete the experiment by adjusting the number of training GPUs, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the models in the production line with the fine-tuned models for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir output/best_accuracy/inference None \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\n

This will generate prediction results under ./output, where the prediction result for case1.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_det_license_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR/case1.jpg\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html","title":"PaddleX 3.0 General OCR Pipeline \u2014 Handwritten Chinese Recognition Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that collectively solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also support fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of handwritten Chinese recognition.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For handwritten Chinese recognition, this task falls under the Text Recognition category, corresponding to PaddleX's Universal OCR Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline OCR \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal OCR pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the pipeline's models need further fine-tuning due to unsatisfactory speed or accuracy, select alternative models for continued testing to determine satisfaction. If the final results are unsatisfactory, fine-tuning the model is necessary.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#3-select-a-model","title":"3. Select a Model","text":"

PaddleX provides four end-to-end OCR models. For details, refer to the Model List. Benchmarks for some models are as follows:

Model List Detection Hmean(%) Recognition Avg Accuracy(%) GPU Inference Time(ms) CPU Inference Time(ms) Model Size(M) PP-OCRv4_server 82.69 79.20 22.20346 2662.158 198 PP-OCRv4_mobile 77.79 78.20 2.719474 79.1097 15

Note: The evaluation set is a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts. The text recognition set contains 11,000 images, and the detection set contains 500 images. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In summary, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-OCRv4_server model as an example to complete a full model development process. Based on your actual usage scenario, choose a suitable model for training. After training, evaluate the appropriate model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Handwritten Chinese Recognition Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to the PaddleX format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Text Detection/Text Recognition Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/handwrite_chinese_text_rec.tar -P ./dataset\ntar -xf ./dataset/handwrite_chinese_text_rec.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is:

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 23965,\n    \"train_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/64957.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/138926.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/86760.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/83191.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/79882.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/58639.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1187-P16_1.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/8199.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/1225-P19_9.jpg\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/train_data\\/183335.png\"\n    ],\n    \"val_samples\": 17259,\n    \"val_sample_paths\": [\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/11.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/12.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/13.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/14.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/15.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/16.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/17.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/18.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/19.png\",\n      \"..\\/..\\/handwrite_chinese_text_rec\\/test_data\\/20.png\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset\\/histogram.png\"\n  },\n  \"dataset_path\": \"\\/mnt\\/liujiaxuan01\\/new\\/new2\\/handwrite_chinese_text_rec\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"MSTextRecDataset\"\n}\n

In the above verification results, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 23965;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 17259;
  • attributes.train_sample_paths: The list of relative paths to the visualization images of the samples in the training set of this dataset;
  • attributes.val_sample_paths: The list of relative paths to the visualization images of the samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the distribution of sample numbers across all categories in the dataset and plots a histogram (histogram.png):

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#43-dataset-splitting-optional","title":"4.3 Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • split:
      • enable: Whether to re-split the dataset. Set to True to convert the dataset format, default is False;
      • train_percent: If re-splitting the dataset, you need to set the percentage of the training set, which is an integer between 0-100, and needs to ensure that the sum with val_percent is 100;
      • val_percent: If re-splitting the dataset, you need to set the percentage of the validation set, which is an integer between 0-100, and needs to ensure that the sum with train_percent is 100;

During data splitting, the original annotation files will be renamed to xxx.bak in their original paths. The above parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, etc., by modifying the configuration file or appending command-line arguments.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supporting dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training epochs;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command-line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training epochs to 10: -o Train.epochs_iters=10. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Output Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics and loss during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdopt, .pdstates, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/handwrite_chinese_text_rec\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command-line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command-line argument, e.g., -o Evaluate.weight_path=./output/best_accuracy/best_accuracy.pdparams.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters carefully and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs at 20, the batch size at 8, select 4 GPUs, and the total batch size is 32.
  2. Initiate four experiments based on the PP-OCRv4_server_rec model with learning rates of: 0.001, 0.005, 0.0002, 0.0001.
  3. It can be observed that Experiment 3, with a learning rate of 0.0002, yields the highest accuracy, and the validation set score indicates that accuracy continues to increase in the last few epochs. Therefore, increasing the number of training epochs to 30, 50, and 80 will further improve model accuracy.

Learning Rate Exploration Results: Experiment ID Learning Rate Recognition Acc (%) 1 0.001 43.28 2 0.005 32.63 3 0.0002 49.64 4 0.0001 46.32

Next, based on a learning rate of 0.0002, we can increase the number of training epochs. Comparing Experiments [4, 5, 6, 7] below, it can be seen that increasing the number of training epochs further improves model accuracy. Experiment ID Number of Training Epochs Recognition Acc (%) 4 20 49.64 5 30 52.03 6 50 54.15 7 80 54.35

Note: This tutorial is designed for 4 GPUs. If you only have 1 GPU, you can adjust the number of training GPUs to complete the experiments, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

paddlex --pipeline OCR \\\n        --model PP-OCRv4_server_det PP-OCRv4_server_rec \\\n        --model_dir None output/best_accuracy/inference \\\n        --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\n

The prediction results will be generated under ./output, and the prediction result for case.jpg is shown below:

"},{"location":"en/practical_tutorials/ocr_rec_chinese_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general OCR pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/OCR.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/OCR.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/OCR_rec/case.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to the General OCR Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html","title":"PaddleX 3.0 General Semantic Segmentation Pipeline \u2014 Lane Line Segmentation Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Installation. This tutorial introduces the usage of the pipeline tool with an example of a lane line segmentation task.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For lane line segmentation, this falls under the category of semantic segmentation tasks, corresponding to PaddleX's Universal Semantic Segmentation Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the Pipeline List for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#2-quick-start","title":"2. Quick Start","text":"

PaddleX offers two ways to experience the pipeline: one is through the PaddleX wheel package locally, and the other is on the Baidu AIStudio Community.

  • Local Experience:

    paddlex --pipeline semantic_segmentation \\\n    --input https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\n

  • AIStudio Community Experience: Go to Baidu AIStudio Community, click \"Create Pipeline\", and create a Universal Semantic Segmentation pipeline for a quick trial.

Quick trial output example:

After experiencing the pipeline, determine if it meets your expectations (including accuracy, speed, etc.). If the model's speed or accuracy does not meet your requirements, you can select alternative models for further testing. If the final results are unsatisfactory, you may need to fine-tune the model. This tutorial aims to produce a model that segments lane lines, and the default weights (trained on the Cityscapes dataset) cannot meet this requirement. Therefore, you need to collect and annotate data for training and fine-tuning.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides 18 end-to-end semantic segmentation models. For details, refer to the Model List. Some model benchmarks are as follows:

Model List mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) OCRNet_HRNet-W48 82.15 87.97 2180.76 270 PP-LiteSeg-T 77.04 5.98 140.02 31

Note: The above accuracy metrics are measured on the Cityscapes dataset. GPU inference time is based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speed is based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

In short, models listed from top to bottom have faster inference speeds, while those from bottom to top have higher accuracy. This tutorial uses the PP-LiteSeg-T model as an example to complete the full model development process. You can choose a suitable model for training based on your actual usage scenario, evaluate the appropriate model weights within the pipeline, and finally use them in practical scenarios.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#41-data-preparation","title":"4.1 Data Preparation","text":"

This tutorial uses the \"Lane Line Segmentation Dataset\" as an example dataset. You can obtain the example dataset using the following commands. If you use your own annotated dataset, you need to adjust it according to PaddleX's format requirements to meet PaddleX's data format specifications. For an introduction to data formats, you can refer to PaddleX Semantic Segmentation Task Module Data Annotation Tutorial.

Dataset acquisition commands:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/semantic-segmentation-makassaridn-road-dataset.tar -P ./dataset\ntar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./dataset/\n

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#42-dataset-verification","title":"4.2 Dataset Verification","text":"

To verify the dataset, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

After executing the above command, PaddleX will verify the dataset and collect basic information about it. Upon successful execution, the log will print \"Check dataset passed !\" information, and relevant outputs will be saved in the current directory's ./output/check_dataset directory, including visualized sample images and sample distribution histograms. The verification result file is saved in ./output/check_dataset_result.json, and the specific content of the verification result file is

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"num_classes\": 4,\n    \"train_samples\": 300,\n    \"train_sample_paths\": [\n      \"check_dataset/demo_img/20220311151733_0060_040.jpg\",\n      \"check_dataset/demo_img/20220311153115_0023_039.jpg\"\n    ],\n    \"val_samples\": 74,\n    \"val_sample_paths\": [\n      \"check_dataset/demo_img/20220311152033_0060_007.jpg\",\n      \"check_dataset/demo_img/20220311144930_0060_026.jpg\"\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/semantic-segmentation-makassaridn-road-dataset\",\n  \"show_type\": \"image\",\n  \"dataset_type\": \"COCODetDataset\"\n}\n

In the verification results above, check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.num_classes: The number of classes in this dataset is 4, which is the number of classes that need to be passed for subsequent training;
  • attributes.train_samples: The number of samples in the training set of this dataset is 300;
  • attributes.val_samples: The number of samples in the validation set of this dataset is 74;
  • attributes.train_sample_paths: A list of relative paths to the visualization images of samples in the training set of this dataset;
  • attributes.val_sample_paths: A list of relative paths to the visualization images of samples in the validation set of this dataset;

Additionally, the dataset verification also analyzes the sample distribution across all classes and plots a histogram (histogram.png):

Note: Only data that passes verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can set it by modifying the configuration file or appending hyperparameters.

Parameters related to dataset verification can be set by modifying the fields under CheckDataset in the configuration file. Examples of some parameters in the configuration file are as follows:

  • CheckDataset:
    • convert:
      • enable: Whether to convert the dataset format. Set to True to enable dataset format conversion, default is False;
      • src_dataset_type: If dataset format conversion is enabled, the source dataset format must be set. Available source formats are LabelMe and VOC;
    • split:
      • enable: Whether to re-split the dataset. Set to True to enable dataset splitting, default is False;
      • train_percent: If dataset splitting is enabled, the percentage of the training set must be set. The type is any integer between 0-100, and the sum with val_percent must be 100;
      • val_percent: If dataset splitting is enabled, the percentage of the validation set must be set. The type is any integer between 0-100, and the sum with train_percent must be 100;

Data conversion and splitting can be enabled simultaneously. For data splitting, the original annotation files will be renamed to xxx.bak in their original paths. These parameters also support being set by appending command-line arguments, for example, to re-split the dataset and set the training and validation set ratios: -o CheckDataset.split.enable=True -o CheckDataset.split.train_percent=80 -o CheckDataset.split.val_percent=20.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=train \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \\\n    -o Train.num_classes=4\n

PaddleX supports modifying training hyperparameters, single/multi-GPU training, and more, simply by modifying the configuration file or appending command line arguments.

Each model in PaddleX provides a configuration file for model development, which is used to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
    • mode: Mode, supports dataset validation (check_dataset), model training (train), and model evaluation (evaluate);
    • device: Training device, options include cpu, gpu, xpu, npu, mlu. For multi-GPU training, specify card numbers, e.g., gpu:0,1,2,3;
  • Train: Training hyperparameter settings;
    • epochs_iters: Number of training iterations;
    • learning_rate: Training learning rate;

For more hyperparameter introductions, refer to PaddleX General Model Configuration File Parameter Explanation.

Note: - The above parameters can be set by appending command line arguments, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first two GPUs for training: -o Global.device=gpu:0,1; setting the number of training iterations to 5000: -o Train.epochs_iters=5000. - During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file. - PaddleX shields you from the concepts of dynamic graph weights and static graph weights. During model training, both dynamic and static graph weights are produced, and static graph weights are selected by default for model inference.

Training Outputs Explanation:

After completing model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

  • train_result.json: Training result record file, recording whether the training task completed normally, as well as the output weight metrics, relevant file paths, etc.;
  • train.log: Training log file, recording changes in model metrics, loss, etc. during training;
  • config.yaml: Training configuration file, recording the hyperparameter configuration for this training session;
  • .pdparams, .pdema, .pdopt.pdstate, .pdiparams, .pdmodel: Model weight-related files, including network parameters, optimizer, EMA, static graph network parameters, static graph network structure, etc.;
"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weight file on the validation set to verify the model's accuracy. To evaluate a model using PaddleX, simply use the following command:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset\n

Similar to model training, model evaluation supports setting parameters by modifying the configuration file or appending command line arguments.

Note: When evaluating a model, you need to specify the model weight file path. Each configuration file has a default weight save path. If you need to change it, simply set it by appending a command line argument, e.g., -o Evaluate.weight_path=./output/best_model/model.pdparams.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can enhance model accuracy by adjusting hyperparameters. By carefully tuning the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to consider the values of these two parameters prudently and adjust them flexibly based on actual conditions to achieve the best training results.

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training iterations at 5000 and the batch size at 2.
  2. Initiate three experiments based on the PP-LiteSeg-T model, with learning rates of: 0.006, 0.008, and 0.01.
  3. It can be observed that the configuration with the highest accuracy in Experiment 2 is a learning rate of 0.008. Based on this training hyperparameter, change the number of training epochs and observe the accuracy results of different iterations, finding that the optimal accuracy is basically achieved at 80000 iterations.

Learning Rate Exploration Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 1 5000 0.006 2 4 GPUs 0.623 Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 3 5000 0.01 2 4 GPUs 0.619

Changing Epoch Results: Experiment Iterations Learning Rate batch_size Training Environment mIoU Experiment 2 5000 0.008 2 4 GPUs 0.629 Experiment 2 with fewer epochs 10000 0.008 2 4 GPUs 0.773 Experiment 2 with more epochs 40000 0.008 2 4 GPUs 0.855 Experiment 2 with more epochs 80000 0.008 2 4 GPUs 0.863

Note: This tutorial is designed for 4 GPUs. If you have only 1 GPU, you can adjust the number of training GPUs to complete the experiment, but the final metrics may not align with the above indicators, which is normal.

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, for example:

python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"output/best_model/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\"\n

The prediction results will be generated under ./output, where the prediction result for makassaridn-road_demo.png is shown below:

"},{"location":"en/practical_tutorials/semantic_segmentation_road_tutorial.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general semantic segmentation pipeline meets your requirements for inference speed and accuracy in the production line, you can proceed directly with development integration/deployment. 1. Directly apply the trained model in your Python project by referring to the following sample code, and modify the Pipeline.model in the paddlex/pipelines/semantic_segmentation.yaml configuration file to your own model path:

from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"paddlex/pipelines/semantic_segmentation.yaml\")\noutput = pipeline.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png\")\nfor res in output:\n    res.print() # Print the structured output of the prediction\n    res.save_to_img(\"./output/\") # Save the visualized image of the result\n    res.save_to_json(\"./output/\") # Save the structured output of the prediction\n
For more parameters, please refer to General Semantic Segmentation Pipeline Usage Tutorial.

  1. Additionally, PaddleX offers three other deployment methods, detailed as follows:

  2. high-performance inference: In actual production environments, many applications have stringent standards for deployment strategy performance metrics (especially response speed) to ensure efficient system operation and smooth user experience. To this end, PaddleX provides high-performance inference plugins aimed at deeply optimizing model inference and pre/post-processing for significant end-to-end process acceleration. For detailed high-performance inference procedures, please refer to the PaddleX High-Performance Inference Guide.

  3. Service-Oriented Deployment: Service-oriented deployment is a common deployment form in actual production environments. By encapsulating inference functions as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving cost-effective service-oriented deployment of production lines. For detailed service-oriented deployment procedures, please refer to the PaddleX Service-Oriented Deployment Guide.
  4. Edge Deployment: Edge deployment is a method that places computing and data processing capabilities directly on user devices, allowing devices to process data without relying on remote servers. PaddleX supports deploying models on edge devices such as Android. For detailed edge deployment procedures, please refer to the PaddleX Edge Deployment Guide.

You can select the appropriate deployment method for your model pipeline according to your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html","title":"PaddleX 3.0 Time Series Anomaly Detection Pipeline \u2014 Equipment Anomaly Detection Application Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models that can solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, fine-tuning the models with private data is also supported. PaddleX provides Python APIs for easy integration of pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, please refer to PaddleX Local Installation Tutorial. This tutorial introduces the usage of the pipeline tool with an example of detecting anomalies in equipment nodes.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. This task aims to identify and mark abnormal behaviors or states in equipment nodes, helping enterprises and organizations promptly detect and resolve issues in application server nodes, thereby improving system reliability and availability. Recognizing this as a time series anomaly detection task, we will use PaddleX's Time Series Anomaly Detection Pipeline. If you are unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"PatchTST_ad\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_ad.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Visit the Official Time Series Anomaly Detection Application to experience the capabilities of time series anomaly detection tasks. Note: Due to the tight correlation between time series data and scenarios, the online experience of official models for time series tasks is tailored to a specific scenario and is not a general solution. Therefore, the experience mode does not support using arbitrary files to evaluate the official model's performance. However, after training a model with your own scenario data, you can select your trained model and use data from the corresponding scenario for online experience.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series anomaly detection models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name Precision Recall F1-Score Model Size (M) Description DLinear_ad 0.9898 0.9396 0.9641 72.8K A simple, efficient, and easy-to-use time series anomaly detection model Nonstationary_ad 0.9855 0.8895 0.9351 1.5MB A transformer-based model optimized for anomaly detection in non-stationary time series AutoEncoder_ad 0.9936 0.8436 0.9125 32K A classic autoencoder-based model that is efficient and easy to use for time series anomaly detection PatchTST_ad 0.9878 0.9070 0.9457 164K A high-precision time series anomaly detection model that balances local patterns and global dependencies TimesNet_ad 0.9837 0.9480 0.9656 732K A highly adaptive and high-precision time series anomaly detection model through multi-period analysis

Note: The above accuracy metrics are measured on the PSM dataset with a time series length of 100.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire process of time series anomaly detection, we will use the publicly available MSL (Mars Science Laboratory) dataset for model training and validation. The PSM (Planetary Science Mission) dataset, sourced from NASA, comprises 55 dimensions and includes telemetry anomaly data reported by the spacecraft's monitoring system for unexpected event anomalies (ISA). With its practical application background, it better reflects real-world anomaly scenarios and is commonly used to test and validate the performance of time series anomaly detection models. This tutorial will perform anomaly detection based on this dataset.

We have converted the dataset into a standard data format, and you can obtain a sample dataset using the following command. For an introduction to the data format, please refer to the Time Series Anomaly Detection Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/msl.tar -P ./dataset\ntar -xf ./dataset/msl.tar -C ./dataset/\n

Data Considerations * Time series anomaly detection is an unsupervised learning task, thus labeled training data is not required. The collected training samples should ideally consist solely of normal data, i.e., devoid of anomalies, with the label column in the training set set to 0 or, alternatively, the label column can be omitted entirely. For the validation set, to assess accuracy, labeling is necessary. Points that are anomalous at a particular timestamp should have their labels set to 1, while normal points should have labels of 0. * Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods. * Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/msl\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 58317,\n    \"train_table\": [\n      [\n        \"timestamp\",\n        \"0\",\n        \"1\",\n        \"2\",\n        \"...\"\n      ],\n      [\n        \"...\"\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/msl\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSADDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, refer to Section 4.1.3 in the Time Series Anomaly Detection Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_anomaly_detection.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have verified the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/msl \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=timestamp \\\n-o Train.feature_cols=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 \\\n-o Train.freq=1 \\\n-o Train.label_col=label \\\n-o Train.seq_len=96\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example explanations for parameters in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset verification (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict).
  • device: Training device, options include cpu and gpu. You can check the models supported on different devices in the PaddleX Model List (CPU/GPU) document at the same level directory.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs.
  • learning_rate: Training learning rate.
  • batch_size: Training batch size for a single GPU.
  • time_col: Time column, set the column name of the time series dataset's time column based on your data.
  • feature_cols: Feature variables indicating variables related to whether the device is abnormal.
  • freq: Frequency of the time series dataset.
  • input_len: The length of the time series input to the model. The time series will be sliced according to this length, and the model will predict whether there is an anomaly in this segment of the time series for that length. The recommended input length should be considered in the context of the actual scenario. In this tutorial, the input length is 96, which means we hope to predict whether there are anomalies at 96 time points.
  • label: Represents the number indicating whether a time point in the time series is abnormal. Anomalous points are labeled as 1, and normal points are labeled as 0. In this tutorial, the anomaly monitoring dataset uses label for this purpose.

For more introductions to hyperparameters, please refer to PaddleX Time Series Task Model Configuration File Parameter Instructions. The above parameters can be set by appending command-line arguments. For example, to specify the mode as model training: -o Global.mode=train; to specify the first GPU for training: -o Global.device=gpu:0; to set the number of training epochs to 10: -o Train.epochs_iters=10.

More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/msl\n
Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including F1, recall, and precision.

"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#53-model-tuning","title":"5.3 Model Tuning","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series anomaly detection:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5, batch size to 16, and input length to 96.
  2. Initiate three experiments based on the PatchTST_ad model with learning rates of: 0.0001, 0.0005, 0.001.
  3. It can be found that Experiment 3 has the highest accuracy, with a learning rate of 0.001. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 20.
  4. It can be found that the accuracy of Experiment 4 is the same as that of Experiment 3, indicating that there is no need to further increase the number of training epochs.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 1 5 0.0001 16 96 1 GPU 79.5 Experiment 2 5 0.0005 16 96 1 GPU 80.1 Experiment 3 5 0.001 16 96 1 GPU 80.9

Increasing Training Epochs Results:

Experiment Epochs Learning Rate Batch Size Input Length Training Environment Validation F1 Score (%) Experiment 3 5 0.0005 16 96 1 GPU 80.9 Experiment 4 20 0.0005 16 96 1 GPU 80.9"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model for testing, using the test file for prediction:

python main.py -c paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_anomaly_detection/test.csv\"\n
Similar to model training, the following steps are required:

  • Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml)
  • Specify the mode as model evaluation: -o Global.mode=evaluate
  • Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.
"},{"location":"en/practical_tutorials/ts_anomaly_detection.html#7-integrationdeployment","title":"7. Integration/Deployment","text":"

If the general-purpose time series anomaly detection pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series anomaly detection pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_anomaly_detection\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series Anomaly Detection Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series anomaly detection pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_classification.html","title":"PaddleX 3.0 Time Series Classification Pipeline \u2014 Heartbeat Monitoring Time Series Classification Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario-based tasks. All PaddleX pipelines support quick trials, and if the results do not meet expectations, they also allow fine-tuning with private data. PaddleX provides Python APIs for easy integration into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the pipeline tool with an example of heartbeat time series data classification.

"},{"location":"en/practical_tutorials/ts_classification.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. For this task, the goal is to train a time series classification model based on heartbeat monitoring data to classify heartbeat time series conditions. Recognizing this as a time series classification task, we select PaddleX's Time Series Classification Pipeline. If unsure about the task-pipeline correspondence, consult the PaddleX Pipeline List (CPU/GPU) for pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_classification.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its capabilities: locally or on the Baidu AIStudio Community.

  • Local Experience:
    from paddlex import create_model\nmodel = create_model(\"TimesNet_cls\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_cls.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n
  • AIStudio Community Experience: Access the Official Time Series Classification Application to experience time series classification capabilities.

Note: Due to the tight coupling between time series data and scenarios, the online experience of official models is tailored to a specific scenario and not a universal solution. It does not support arbitrary files for model effect evaluation. However, after training a model with your scenario data, you can select your trained model and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_classification.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides a time series classification model. Refer to the Model List for details. The model benchmark is as follows:

Model Name Acc (%) Model Size (M) Description TimesNet_cls 87.5 792K TimesNet is an adaptive and high-precision time series classification model through multi-cycle analysis

Note: The evaluation set for the above accuracy metrics is UWaveGestureLibrary.

"},{"location":"en/practical_tutorials/ts_classification.html#4-data-preparation-and-verification","title":"4. Data Preparation and Verification","text":""},{"location":"en/practical_tutorials/ts_classification.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series classification process, we will use the public Heartbeat Dataset for model training and validation. The Heartbeat Dataset is part of the UEA Time Series Classification Archive, addressing the practical task of heartbeat monitoring for medical diagnosis. The dataset comprises multiple time series groups, with each data point consisting of a label variable, group ID, and 61 feature variables. This dataset is commonly used to test and validate the performance of time series classification prediction models.

We have converted the dataset into a standard format, which can be obtained using the following commands. For data format details, refer to the Time Series Classification Module Development Tutorial.

Dataset Acquisition Command:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/data/ts_classify_examples.tar -P ./dataset\ntar -xf ./dataset/ts_classify_examples.tar -C ./dataset/\n

Data Considerations * Based on collected real data, clarify the classification objectives of the time series data and define corresponding classification labels. For example, in stock price classification, labels might be \"Rise\" or \"Fall.\" For a time series that is \"Rising\" over a period, it can be considered a sample (group), where each time point in this period shares a common group_id. * Uniform Time Series Length: Ensure that the length of the time series for each group is consistent. Missing Value Handling: To guarantee the quality and integrity of the data, missing values can be imputed based on expert experience or statistical methods. * Non-Duplication: Ensure that the data is collected row by row in chronological order, with no duplication of the same time point.

"},{"location":"en/practical_tutorials/ts_classification.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples\n
After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data and class distribution histograms.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 82620,\n    \"train_table\": [\n      [ ...\n    ],\n    ],\n    \"val_samples\": 83025,\n    \"val_table\": [\n      [ ...\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"check_dataset/histogram.png\"\n  },\n  \"dataset_path\": \"./dataset/ts_classify_examples\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSCLSDataset\"\n}\n
The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 58317.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 73729.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_classification.html#43-dataset-format-conversion-dataset-splitting-optional","title":"4.3 Dataset Format Conversion / Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, please refer to Section 4.1.3 in the Time Series Classification Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_classification.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_classification.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/ts_classify_examples \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=time \\\n-o Train.target_cols=dim_0,dim_1,dim_2 \\\n-o Train.freq=1 \\\n-o Train.group_id=group_id \\\n-o Train.static_cov_cols=label\n
PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time-series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supports dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single-case testing (predict);
  • device: Training device, options include cpu, gpu. Check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Set the column names of the target variables of the time series dataset based on your data. Can be multiple, separated by commas. Generally, the more relevant the target variables are to the prediction target, the higher the model accuracy. In this tutorial, the heartbeat monitoring dataset has 61 feature variables for the time column, such as dim_0, dim_1, etc.;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • group_id: A group ID represents a time series sample, and time series sequences with the same ID form a sample. Set the column name of the specified group ID based on your data, e.g., group_id.
  • static_cov_cols: Represents the category ID column of the time series. The same sample has the same label. Set the column name of the category based on your data, e.g., label. For more hyperparameter introductions, please refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves model weight files, with the default being output. To specify a save path, use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_classification.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/ts_classify_examples \\\n    -o Evaluate.weight_path=./output/best_model/model.pdparams\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including Acc Top1.

"},{"location":"en/practical_tutorials/ts_classification.html#53-model-optimization","title":"5.3 Model Optimization","text":"

By adjusting the number of training epochs appropriately, you can control the depth of model training to avoid overfitting or underfitting. Meanwhile, the setting of the learning rate is crucial for the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training results.

Using the method of controlled variables, we can start with a fixed, relatively small number of epochs in the initial stage and adjust the learning rate multiple times to find an optimal learning rate. After that, we can increase the number of training epochs to further improve the results. Below, we introduce the parameter tuning method for time series classification in detail:

It is recommended to follow the method of controlled variables when debugging parameters:

  1. First, fix the number of training epochs to 5 and the batch size to 16.
  2. Launch three experiments based on the TimesNet_cls model with learning rates of 0.00001, 0.0001, and 0.001, respectively.
  3. It can be found that Experiment 3 has the highest accuracy. Therefore, fix the learning rate at 0.001 and try increasing the number of training epochs to 30. Note: Due to the built-in early stopping mechanism for time series tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. If you need to change the patience epochs for early stopping, you can manually modify the value of the patience hyperparameter in the configuration file.

Learning Rate Exploration Results:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 1 5 0.00001 16 1 GPU 72.20% Experiment 2 5 0.0001 16 1 GPU 72.20% Experiment 3 5 0.001 16 1 GPU 73.20%

Results of Increasing Training Epochs:

Experiment Epochs Learning Rate Batch Size Training Environment Validation Accuracy Experiment 3 5 0.001 16 1 GPU 73.20% Experiment 4 30 0.001 16 1 GPU 75.10%"},{"location":"en/practical_tutorials/ts_classification.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Set the model directory to the trained model for testing, using the test file to perform predictions:

python main.py -c paddlex/configs/ts_classification/TimesNet_cls.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=\"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_classification/test.csv\"\n
Similar to model training and evaluation, the following steps are required:

  • Specify the path to the .yaml configuration file of the model (here it is TimesNet_cls.yaml)
  • Specify the mode as model inference prediction: -o Global.mode=predict
  • Specify the path to the model weights: -o Predict.model_dir=\"./output/inference\"
  • Specify the path to the input data: -o Predict.input=\"...\"

Other related parameters can be set by modifying the fields under Global and Predict in the .yaml configuration file. For details, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

"},{"location":"en/practical_tutorials/ts_classification.html#7-development-integrationdeployment","title":"7. Development Integration/Deployment","text":"

If the general time series classification pipeline meets your requirements for inference speed and accuracy, you can directly proceed with development integration/deployment.

  1. If you need to directly apply the general time series classification pipeline in your Python project, you can refer to the following sample code:
from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_classification\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print() # \u200b\u6253\u5370\u200b\u9884\u6d4b\u200b\u7684\u200b\u7ed3\u6784\u5316\u200b\u8f93\u51fa\u200b\n    res.save_to_csv(\"./output/\") # \u200b\u4fdd\u5b58\u200bcsv\u200b\u683c\u5f0f\u200b\u7ed3\u679c\u200b\n

For more parameters, please refer to the Time Series Classification Pipeline Usage Tutorial

  1. Additionally, PaddleX's time series classification pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/practical_tutorials/ts_forecast.html","title":"PaddleX 3.0 Time Series Forecasting Pipeline \u2014 Long-term Electricity Consumption Forecasting Tutorial","text":"

PaddleX offers a rich set of pipelines, each consisting of one or more models tailored to solve specific scenario tasks. All PaddleX pipelines support quick trials, and if the results are not satisfactory, you can also fine-tune the models with private data. PaddleX provides Python APIs to easily integrate pipelines into personal projects. Before use, you need to install PaddleX. For installation instructions, refer to PaddleX Local Installation Guide. This tutorial introduces the usage of the time series forecasting pipeline tool with an example of long-term electricity consumption forecasting.

"},{"location":"en/practical_tutorials/ts_forecast.html#1-select-a-pipeline","title":"1. Select a Pipeline","text":"

First, choose the corresponding PaddleX pipeline based on your task scenario. The goal of this task is to predict future electricity consumption based on historical data. Recognizing this as a time series forecasting task, we will use PaddleX's time series forecasting pipeline. If you're unsure about the correspondence between tasks and pipelines, you can refer to the PaddleX Pipeline List (CPU/GPU) for an overview of pipeline capabilities.

"},{"location":"en/practical_tutorials/ts_forecast.html#2-quick-experience","title":"2. Quick Experience","text":"

PaddleX offers two ways to experience its pipelines: locally on your machine or on the Baidu AIStudio Community.

  • Local Experience:

    from paddlex import create_model\nmodel = create_model(\"DLinear\")\noutput = model.predict(\"https://paddle-model-ecology.bj.bcebos.com/paddlex/ts/demo_ts/ts_fc.csv\", batch_size=1)\nfor res in output:\n    res.print(json_format=False)\n    res.save_to_csv(\"./output/\")\n

  • AIStudio Community Experience: Visit the Official Time Series Forecasting Application to experience time series forecasting capabilities. Note: Due to the tight correlation between time series data and scenarios, the official online experience models for time series tasks are tailored to specific scenarios and are not universal. Therefore, the online experience does not support using arbitrary files to test the official model solutions. However, after training your own model with scenario-specific data, you can select your trained model solution and use corresponding scenario data for online experience.

"},{"location":"en/practical_tutorials/ts_forecast.html#3-choose-a-model","title":"3. Choose a Model","text":"

PaddleX provides five end-to-end time series forecasting models. For details, refer to the Model List. The benchmarks of these models are as follows:

Model Name MSE MAE Model Size (M) Description DLinear 0.382 0.394 76k A simple, efficient, and easy-to-use time series forecasting model Nonstationary 0.600 0.515 60.3M Based on transformer architecture, optimized for long-term forecasting of non-stationary time series PatchTST 0.385 0.397 2.2M A high-accuracy long-term forecasting model that balances local patterns and global dependencies TiDE 0.405 0.412 34.9M A high-accuracy model suitable for handling multivariate, long-term time series forecasting problems TimesNet 0.417 0.431 5.2M Through multi-period analysis, TimesNet is an adaptable and high-accuracy time series analysis model

Note: The above accuracy metrics are measured on the ETTH1 test dataset with an input sequence length of 96 and a prediction sequence length of 96 for all models except TiDE, which is 720.

Based on your actual usage scenario, select an appropriate model for training. After training, evaluate the model weights within the pipeline and use them in practical scenarios.

"},{"location":"en/practical_tutorials/ts_forecast.html#4-data-preparation-and-validation","title":"4. Data Preparation and Validation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#41-data-preparation","title":"4.1 Data Preparation","text":"

To demonstrate the entire time series forecasting process, we will use the Electricity dataset for model training and validation. This dataset collects electricity consumption at a certain node from 2012 to 2014, with data collected every hour. Each data point consists of the current timestamp and corresponding electricity consumption. This dataset is commonly used to test and validate the performance of time series forecasting models.

In this tutorial, we will use this dataset to predict the electricity consumption for the next 96 hours. We have already converted this dataset into a standard data format, and you can obtain a sample dataset by running the following command. For an introduction to the data format, you can refer to the Time Series Prediction Module Development Tutorial.

You can use the following commands to download the demo dataset to a specified folder:

cd /path/to/paddlex\nwget https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/electricity.tar -P ./dataset\ntar -xf ./dataset/electricity.tar -C ./dataset/\n

Data Considerations

  • When annotating data for time series forecasting tasks, based on the collected real data, all data is arranged in chronological order. During training, the data is automatically divided into multiple time segments, where the historical time series data and the future sequences respectively represent the input data for training the model and its corresponding prediction targets, forming a set of training samples.
  • Handling Missing Values: To ensure data quality and integrity, missing values can be imputed based on expert knowledge or statistical methods.
  • Non-Repetitiveness: Ensure that data is collected in chronological order by row, with no duplication of timestamps.
"},{"location":"en/practical_tutorials/ts_forecast.html#42-data-validation","title":"4.2 Data Validation","text":"

Data Validation can be completed with just one command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=check_dataset \\\n    -o Global.dataset_dir=./dataset/electricity\n

After executing the above command, PaddleX will validate the dataset, summarize its basic information, and print Check dataset passed ! in the log if the command runs successfully. The validation result file is saved in ./output/check_dataset_result.json, and related outputs are saved in the current directory's ./output/check_dataset directory, including example time series data.

{\n  \"done_flag\": true,\n  \"check_pass\": true,\n  \"attributes\": {\n    \"train_samples\": 22880,\n    \"train_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2012-01-01 00:00:00\",\n        2162.0\n      ],\n      [\n        \"2012-01-01 01:00:00\",\n        2835.0\n      ],\n      [\n        \"2012-01-01 02:00:00\",\n        2764.0\n      ],\n      [\n        \"2012-01-01 03:00:00\",\n        2735.0\n      ],\n      [\n        \"2012-01-01 04:00:00\",\n        2721.0\n      ],\n      [\n        \"2012-01-01 05:00:00\",\n        2742.0\n      ],\n      [\n        \"2012-01-01 06:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 07:00:00\",\n        2716.0\n      ],\n      [\n        \"2012-01-01 08:00:00\",\n        2680.0\n      ],\n      [\n        \"2012-01-01 09:00:00\",\n        2581.0\n      ]\n    ],\n    \"val_samples\": 3424,\n    \"val_table\": [\n      [\n        \"date\",\n        \"OT\"\n      ],\n      [\n        \"2014-08-11 08:00:00\",\n        3528.0\n      ],\n      [\n        \"2014-08-11 09:00:00\",\n        3800.0\n      ],\n      [\n        \"2014-08-11 10:00:00\",\n        3889.0\n      ],\n      [\n        \"2014-08-11 11:00:00\",\n        4340.0\n      ],\n      [\n        \"2014-08-11 12:00:00\",\n        4321.0\n      ],\n      [\n        \"2014-08-11 13:00:00\",\n        4293.0\n      ],\n      [\n        \"2014-08-11 14:00:00\",\n        4393.0\n      ],\n      [\n        \"2014-08-11 15:00:00\",\n        4384.0\n      ],\n      [\n        \"2014-08-11 16:00:00\",\n        4495.0\n      ],\n      [\n        \"2014-08-11 17:00:00\",\n        4374.0\n      ]\n    ]\n  },\n  \"analysis\": {\n    \"histogram\": \"\"\n  },\n  \"dataset_path\": \"./dataset/electricity\",\n  \"show_type\": \"csv\",\n  \"dataset_type\": \"TSDataset\"\n}\n

The above verification results have omitted some data parts. check_pass being True indicates that the dataset format meets the requirements. Explanations for other indicators are as follows:

  • attributes.train_samples: The number of samples in the training set of this dataset is 22880.
  • attributes.val_samples: The number of samples in the validation set of this dataset is 3424.
  • attributes.train_table: Sample data rows from the training set of this dataset.
  • attributes.val_table: Sample data rows from the validation set of this dataset.

Note: Only data that passes the verification can be used for training and evaluation.

"},{"location":"en/practical_tutorials/ts_forecast.html#43-dataset-format-conversiondataset-splitting-optional","title":"4.3 Dataset Format Conversion/Dataset Splitting (Optional)","text":"

If you need to convert the dataset format or re-split the dataset, you can modify the configuration file or append hyperparameters for settings. Refer to Section 4.1.3 in the Time Series Prediction Module Development Tutorial.

"},{"location":"en/practical_tutorials/ts_forecast.html#5-model-training-and-evaluation","title":"5. Model Training and Evaluation","text":""},{"location":"en/practical_tutorials/ts_forecast.html#51-model-training","title":"5.1 Model Training","text":"

Before training, ensure that you have validated the dataset. To complete PaddleX model training, simply use the following command:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n-o Global.mode=train \\\n-o Global.dataset_dir=./dataset/electricity \\\n-o Train.epochs_iters=5 \\\n-o Train.batch_size=16 \\\n-o Train.learning_rate=0.0001 \\\n-o Train.time_col=date \\\n-o Train.target_cols=OT \\\n-o Train.freq=1h \\\n-o Train.input_len=96 \\\n-o Train.predict_len=96\n

PaddleX supports modifying training hyperparameters and single-machine single-GPU training (time series models only support single-GPU training). Simply modify the configuration file or append command-line parameters.

Each model in PaddleX provides a configuration file for model development to set relevant parameters. Model training-related parameters can be set by modifying the Train fields in the configuration file. Some example parameter descriptions in the configuration file are as follows:

  • Global:
  • mode: Mode, supporting dataset validation (check_dataset), model training (train), model evaluation (evaluate), and single instance testing (predict);
  • device: Training device, options include cpu, gpu, xpu, npu, mlu; check the Model Support List for models supported on different devices.
  • Train: Training hyperparameter settings;
  • epochs_iters: Number of training epochs;
  • learning_rate: Training learning rate;
  • batch_size: Training batch size per GPU;
  • time_col: Time column, set the column name of the time series dataset's time column based on your data;
  • target_cols: Target variable columns, set the column name(s) of the time series dataset's target variable(s) based on your data. Multiple columns can be separated by commas;
  • freq: Frequency, set the time frequency based on your data, e.g., 1min, 5min, 1h;
  • input_len: The length of historical time series input to the model; the input length should be considered comprehensively with the prediction length. Generally, the larger the setting, the more historical information can be referenced, and the higher the model accuracy.
  • predict_len: The length of the future sequence that the model is expected to predict; the prediction length should be considered comprehensively with the actual scenario. Generally, the larger the setting, the longer the future sequence you want to predict, and the lower the model accuracy.
  • patience: The parameter for the early stopping mechanism, indicating how many times the model's performance on the validation set can be continuously unimproved before stopping training; the larger the patience value, the longer the training time. For more hyperparameter introductions, refer to PaddleX Time Series Task Model Configuration File Parameter Description.

Note:

  • The above parameters can be set by appending command-line parameters, e.g., specifying the mode as model training: -o Global.mode=train; specifying the first GPU for training: -o Global.device=gpu:0; setting the number of training epochs to 10: -o Train.epochs_iters=10.
  • During model training, PaddleX automatically saves the model weight files, with the default being output. If you need to specify a save path, you can use the -o Global.output field in the configuration file.
More Details (Click to Expand)
  • During the model training process, PaddleX automatically saves the model weight files, with the default directory being output. If you need to specify a different save path, you can configure it through the -o Global.output field in the configuration file.
  • PaddleX abstracts away the concepts of dynamic graph weights and static graph weights from you. During model training, both dynamic and static graph weights are produced simultaneously. By default, static graph weights are selected for inference.
  • When training other models, you need to specify the corresponding configuration file. The correspondence between models and configuration files can be found in the PaddleX Model List (CPU/GPU)

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

Explanation of Training Outputs:

After completing the model training, all outputs are saved in the specified output directory (default is ./output/), typically including the following:

train_result.json: A training result record file that logs whether the training task was completed normally, as well as the output weight metrics, relevant file paths, etc. train.log: A training log file that records changes in model metrics, loss values, and other information during the training process. config.yaml: The training configuration file that records the hyperparameter configurations for this training session. best_accuracy.pdparams.tar, scaler.pkl, .checkpoints, .inference*: Files related to model weights, including network parameters, optimizers, static graph network parameters, etc.

"},{"location":"en/practical_tutorials/ts_forecast.html#52-model-evaluation","title":"5.2 Model Evaluation","text":"

After completing model training, you can evaluate the specified model weights file on the validation set to verify the model's accuracy. Using PaddleX for model evaluation requires just one command:

    python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=evaluate \\\n    -o Global.dataset_dir=./dataset/electricity \\\n

Similar to model training, model evaluation supports setting through modifying the configuration file or appending command-line parameters.

Note: When evaluating the model, you need to specify the model weights file path. Each configuration file has a default weight save path built-in. If you need to change it, simply set it by appending a command-line parameter, such as -o Evaluate.weight_path=./output/best_model/model.pdparams.

After completing the model evaluation, typically, the following outputs are generated:

Upon completion of model evaluation, evaluate_result.json will be produced, which records the evaluation results, specifically, whether the evaluation task was completed successfully, and the model's evaluation metrics, including mse and mae.

"},{"location":"en/practical_tutorials/ts_forecast.html#53-model-optimization","title":"5.3 Model Optimization","text":"

After learning about model training and evaluation, we can improve the model's accuracy by adjusting hyperparameters. By reasonably adjusting the number of training epochs, you can control the depth of model training, avoiding overfitting or underfitting. The setting of the learning rate is related to the speed and stability of model convergence. Therefore, when optimizing model performance, it is essential to carefully consider the values of these two parameters and adjust them flexibly based on actual conditions to achieve the best training effect.

Based on the method of controlled variables, we can adopt the following approach for hyperparameter tuning in time-series forecast:

It is recommended to follow the method of controlled variables when debugging parameters: 1. Initial Setup: Set the training epochs to 5, batch size to 16, and input length to 96.

  1. Experiments with DLinear Model and Launch three experiments with learning rates: 0.0001, 0.001, 0.01.

  2. Learning Rate Exploration: Experiment 2 yields the highest accuracy. Therefore, fix the learning rate at 0.001 and increase the training epochs to 30. Note: Due to the built-in early stopping mechanism for temporal tasks, training will automatically stop if the validation set accuracy does not improve after 10 patience epochs. To adjust the patience epochs, modify the patience hyperparameter in the advanced configuration.

  3. Increasing Training Epochs and Input Length.

After increasing the training epochs, Experiment 4 achieves the highest accuracy. Next, increase the input length to 144 (using 144 hours of historical data to predict the next 96 hours), resulting in Experiment 5 with an accuracy of 0.188.

Learning Rate Exploration Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 1 5 0.0001 16 96 96 1 GPU 0.314 Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 3 5 0.01 16 96 96 1 GPU 0.320

Increasing Training Epochs Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 2 5 0.001 16 96 96 1 GPU 0.302 Experiment 4 30 0.001 16 96 96 1 GPU 0.301

Increasing Input Length Results:

Experiment ID Epochs Learning Rate Batch Size Input Length Prediction Length Training Environment Validation MSE Experiment 4 30 0.001 16 96 96 1 GPU 0.301 Experiment 5 30 0.001 16 144 96 1 GPU 0.188"},{"location":"en/practical_tutorials/ts_forecast.html#6-production-line-testing","title":"6. Production Line Testing","text":"

Replace the model in the production line with the fine-tuned model and test using this power test data for prediction:

python main.py -c paddlex/configs/ts_forecast/DLinear.yaml \\\n    -o Global.mode=predict \\\n    -o Predict.model_dir=\"./output/inference\" \\\n    -o Predict.input=https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/doc_images/practical_tutorial/timeseries_forecast/test.csv\n
This will generate prediction results under ./output, with the predictions for test.csv saved in result.csv.

Similar to model training and evaluation, follow these steps: * Specify the path to the model's .yaml configuration file (here it's PatchTST_ad.yaml) * Specify the mode as model evaluation: -o Global.mode=evaluate * Specify the path to the validation dataset: -o Global.dataset_dir Other related parameters can be set by modifying the Global and Evaluate fields in the .yaml configuration file. For details, refer to PaddleX Configuration.

"},{"location":"en/practical_tutorials/ts_forecast.html#7integrationdeployment","title":"7.Integration/Deployment","text":"

If the general-purpose time series forecast pipeline meets your requirements for inference speed and accuracy, you can proceed directly with development integration/deployment.

  1. If you need to apply the general-purpose time series forecast pipeline directly in your Python project, you can refer to the following sample code:

    from paddlex import create_pipeline\npipeline = create_pipeline(pipeline=\"ts_forecast\")\noutput = pipeline.predict(\"pre_ts.csv\")\nfor res in output:\n    res.print()\n    res.save_to_csv(\"./output/\")\n
    For more parameters, please refer to the Time Series forecast Pipeline Usage Tutorial

  2. Additionally, PaddleX's time series forecast pipeline also offers a service-oriented deployment method, detailed as follows:

Service-Oriented Deployment: This is a common deployment form in actual production environments. By encapsulating the inference functionality as services, clients can access these services through network requests to obtain inference results. PaddleX supports users in achieving service-oriented deployment of pipelines at low cost. For detailed instructions on service-oriented deployment, please refer to the PPaddleX Service-Oriented Deployment Guide. You can choose the appropriate method to deploy your model pipeline based on your needs, and proceed with subsequent AI application integration.

"},{"location":"en/support_list/model_list_dcu.html","title":"PaddleX Model List (Hygon DCU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. The specific models to use can be selected based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/model_list_dcu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Storage Size (M) Model Download Link ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_dcu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Storage Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model

Note: The above accuracy metrics are mIoU on the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html","title":"PaddleX Model List (Cambricon MLU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_mlu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_mlu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_mlu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_mlu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_mlu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_mlu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_mlu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html","title":"PaddleX Model List (Huawei Ascend NPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_npu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link CLIP_vit_base_patch16_224 85.36 306.5 M Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 1.04 G Inference Model/Trained Model ConvNeXt_base_224 83.84 313.9 M Inference Model/Trained Model ConvNeXt_base_384 84.90 313.9 M Inference Model/Trained Model ConvNeXt_large_224 84.26 700.7 M Inference Model/Trained Model ConvNeXt_large_384 85.27 700.7 M Inference Model/Trained Model ConvNeXt_small 83.13 178.0 M Inference Model/Trained Model ConvNeXt_tiny 82.03 101.4 M Inference Model/Trained Model MobileNetV1_x0_5 63.5 4.8 M Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.8 M Inference Model/Trained Model MobileNetV1_x0_75 68.8 9.3 M Inference Model/Trained Model MobileNetV1_x1_0 71.0 15.2 M Inference Model/Trained Model MobileNetV2_x0_5 65.0 7.1 M Inference Model/Trained Model MobileNetV2_x0_25 53.2 5.5 M Inference Model/Trained Model MobileNetV2_x1_0 72.2 12.6 M Inference Model/Trained Model MobileNetV2_x1_5 74.1 25.0 M Inference Model/Trained Model MobileNetV2_x2_0 75.2 41.2 M Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model MobileNetV4_conv_large 83.4 125.2 M Inference Model/Trained Model MobileNetV4_conv_medium 79.9 37.6 M Inference Model/Trained Model MobileNetV4_conv_small 74.6 14.7 M Inference Model/Trained Model PP-HGNet_base 85.0 249.4 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-HGNet_tiny 79.83 52.4 M Inference Model/Trained Model PP-HGNetV2-B0 77.77 21.4 M Inference Model/Trained Model PP-HGNetV2-B1 79.18 22.6 M Inference Model/Trained Model PP-HGNetV2-B2 81.74 39.9 M Inference Model/Trained Model PP-HGNetV2-B3 82.98 57.9 M Inference Model/Trained Model PP-HGNetV2-B4 83.57 70.4 M Inference Model/Trained Model PP-HGNetV2-B5 84.75 140.8 M Inference Model/Trained Model PP-HGNetV2-B6 86.30 268.4 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model PP-LCNetV2_base 77.05 23.7 M Inference Model/Trained Model PP-LCNetV2_large 78.51 37.3 M Inference Model/Trained Model PP-LCNetV2_small 73.97 14.6 M Inference Model/Trained Model ResNet18_vd 72.3 41.5 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34_vd 76.0 77.3 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50_vd 79.1 90.8 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101_vd 80.2 158.4 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152_vd 80.6 214.3 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model ResNet200_vd 80.9 266.0 M Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 310.5 M Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 311.4 M Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 694.8 M Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 696.1 M Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 175.6 M Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics refer to Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_npu.html#_1","title":"\u56fe\u50cf\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link CLIP_vit_base_patch16_448_ML 89.15 325.6 M Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 39.6 M PP-HGNetV2-B4_ML 87.96 88.5 M Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 286.5 M Inference Model/Trained Model Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b COCO2017 \u200b\u7684\u200b\u591a\u200b\u6807\u7b7e\u200b\u5206\u7c7b\u200b\u4efb\u52a1\u200bmAP\u3002

"},{"location":"en/support_list/model_list_npu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 245.4 M Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 246.2 M Inference Model/Trained Model CenterNet-DLA-34 37.6 75.4 M Inference Model/Trained Model CenterNet-ResNet50 38.9 319.7 M Inference Model/Trained Model DETR-R50 42.3 159.3 M Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 137.5 M Inference Model/Trained Model FasterRCNN-ResNet50 36.7 120.2 M Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 148.1 M Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 148.1 M Inference Model/Trained Model FasterRCNN-ResNet101 39.0 188.1 M Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 216.3 M Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 360.6 M Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 159.8 M Inference Model/Trained Model FCOS-ResNet50 39.6 124.2 M Inference Model/Trained Model PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-M 37.5 16.8 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PicoDet-XS 26.2 5.7M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model RT-DETR-H 56.3 435.8 M Inference Model/Trained Model RT-DETR-L 53.0 113.7 M Inference Model/Trained Model RT-DETR-R18 46.5 70.7 M Inference Model/Trained Model RT-DETR-R50 53.1 149.1 M Inference Model/Trained Model RT-DETR-X 54.8 232.9 M Inference Model/Trained Model YOLOv3-DarkNet53 39.1 219.7 M Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 83.8 M Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 163.0 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set mAP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_2","title":"\u5c0f\u200b\u76ee\u6807\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE_plus_SOD-S 25.1 77.3 M Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 325.0 M Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 340.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b VisDrone-DET \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_3","title":"\u884c\u4eba\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_human 48.0 196.1 M Inference Model/Trained Model PP-YOLOE-S_human 42.5 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b CrowdHuman \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link Deeplabv3_Plus-R50 80.36 94.9 M Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 162.5 M Inference Model/Trained Model Deeplabv3-R50 79.90 138.3 M Inference Model/Trained Model Deeplabv3-R101 80.85 205.9 M Inference Model/Trained Model OCRNet_HRNet-W48 82.15 249.8 M Inference Model/Trained Model PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for Cityscapes dataset mIoU.

"},{"location":"en/support_list/model_list_npu.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP Model Size (M) Model Download Link Mask-RT-DETR-H 50.6 449.9 M Inference Model/Trained Model Mask-RT-DETR-L 45.7 113.6 M Inference Model/Trained Model Mask-RT-DETR-M 42.7 66.6 M Inference Model/Trained Model Mask-RT-DETR-S 41.0 51.8 M Inference Model/Trained Model Mask-RT-DETR-X 47.5 237.5 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 254.8 M Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 254.7 M Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 157.5 M Inference Model/Trained Model MaskRCNN-ResNet50 32.8 127.8 M Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 225.4 M Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 225.1 M Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 370.0 M Inference Model/Trained Model PP-YOLOE_seg-S 32.5 31.5 M Inference Model/Trained Model

Note: The above accuracy metrics are for COCO2017 validation set Mask AP(0.5:0.95).

"},{"location":"en/support_list/model_list_npu.html#_4","title":"\u56fe\u50cf\u200b\u7279\u5f81\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b recall@1\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_rec_CLIP_vit_base 88.69 306.6 M Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 1.05 G Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b AliProducts recall@1\u3002

"},{"location":"en/support_list/model_list_npu.html#_5","title":"\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-ShiTuV2_det 41.5 27.6 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PaddleClas\u200b\u4e3b\u4f53\u200b\u68c0\u6d4b\u200b\u6570\u636e\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_6","title":"\u8f66\u8f86\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b mAP\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link PP-YOLOE-L_vehicle 63.9 196.1 M Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 28.8 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b PPVehicle \u200b\u9a8c\u8bc1\u200b\u96c6\u200b mAP(0.5:0.95)\u3002

"},{"location":"en/support_list/model_list_npu.html#_7","title":"\u5f02\u5e38\u200b\u68c0\u6d4b\u200b\u6a21\u5757","text":"\u6a21\u578b\u200b\u540d\u79f0\u200b Avg\uff08%\uff09 \u200b\u6a21\u578b\u200b\u5b58\u50a8\u200b\u5927\u5c0f\u200b Model Download Link STFPM 96.2 21.5 M Inference Model/Trained Model

\u200b\u6ce8\u200b\uff1a\u200b\u4ee5\u4e0a\u200b\u7cbe\u5ea6\u200b\u6307\u6807\u200b\u4e3a\u200b MVTec AD \u200b\u9a8c\u8bc1\u200b\u96c6\u200b \u200b\u5e73\u5747\u200b\u5f02\u5e38\u200b\u5206\u6570\u200b\u3002

"},{"location":"en/support_list/model_list_npu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_npu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, and handwritten scenarios, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_SVTRv2_rec 68.81 73.9 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link ch_RepSVTR_rec 65.07 22.1 M Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/model_list_npu.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) Model Size (M) Model Download Link SLANet 76.31 6.9 M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PubtabNet English table recognition dataset.

"},{"location":"en/support_list/model_list_npu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 22.6 M Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 470.1 M Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 470.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_npu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name MSE MAE Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Inference Model/Trained Model PatchTST 0.385 0.397 2.0M Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model TiDE 0.405 0.412 31.7M Inference Model/Trained Model TimesNet 0.417 0.431 4.9M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/model_list_npu.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall F1-Score Model Size (M) Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52K Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112K Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8M Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320K Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3M Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/model_list_npu.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name Acc (%) Model Size (M) Model Download Link TimesNet_cls 87.5 792K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary: Training, Evaluation datasets.

"},{"location":"en/support_list/model_list_xpu.html","title":"PaddleX Model List (Kunlun XPU)","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module encompasses various models. You can select the appropriate models based on the benchmark data below. If you prioritize model accuracy, choose models with higher accuracy. If you prioritize model size, select models with smaller storage requirements.

"},{"location":"en/support_list/model_list_xpu.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Accuracy (%) Model Size (M) Model Download Link MobileNetV3_large_x0_5 69.2 9.6 M Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 7.5 M Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 14.0 M Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 19.5 M Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 26.5 M Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 6.8 M Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 6.0 M Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 8.5 M Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 10.5 M Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 13.0 M Inference Model/Trained Model PP-HGNet_small 81.51 86.5 M Inference Model/Trained Model PP-LCNet_x0_5 63.14 6.7 M Inference Model/Trained Model PP-LCNet_x0_25 51.86 5.5 M Inference Model/Trained Model PP-LCNet_x0_35 58.09 5.9 M Inference Model/Trained Model PP-LCNet_x0_75 68.18 8.4 M Inference Model/Trained Model PP-LCNet_x1_0 71.32 10.5 M Inference Model/Trained Model PP-LCNet_x1_5 73.71 16.0 M Inference Model/Trained Model PP-LCNet_x2_0 75.18 23.2 M Inference Model/Trained Model PP-LCNet_x2_5 76.60 32.1 M Inference Model/Trained Model ResNet18 71.0 41.5 M Inference Model/Trained Model ResNet34 74.6 77.3 M Inference Model/Trained Model ResNet50 76.5 90.8 M Inference Model/Trained Model ResNet101 77.6 158.7 M Inference Model/Trained Model ResNet152 78.3 214.2 M Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Accuracy on the ImageNet-1k validation set.

"},{"location":"en/support_list/model_list_xpu.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet-L 42.6 20.9 M Inference Model/Trained Model PicoDet-S 29.1 4.4 M Inference Model/Trained Model PP-YOLOE_plus-L 52.9 185.3 M Inference Model/Trained Model PP-YOLOE_plus-M 49.8 83.2 M Inference Model/Trained Model PP-YOLOE_plus-S 43.7 28.3 M Inference Model/Trained Model PP-YOLOE_plus-X 54.7 349.4 M Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/model_list_xpu.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) Model Size (M) Model Download Link PP-LiteSeg-T 73.10 28.5 M Inference Model/Trained Model

Note: The above accuracy metrics are based on the mIoU of the Cityscapes dataset.

"},{"location":"en/support_list/model_list_xpu.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) Model Size (M) Model Download Link PP-OCRv4_mobile_det 77.79 4.2 M Inference Model/Trained Model PP-OCRv4_server_det 82.69 100.1M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 500 images for detection.

"},{"location":"en/support_list/model_list_xpu.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) Model Size (M) Model Download Link PP-OCRv4_mobile_rec 78.20 10.6 M Inference Model/Trained Model PP-OCRv4_server_rec 79.20 71.2 M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built Chinese dataset, covering street scenes, web images, documents, handwriting, and more scenarios, with 11,000 images for text recognition.

"},{"location":"en/support_list/model_list_xpu.html#layout-analysis-module","title":"Layout Analysis Module","text":"Model Name mAP (%) Model Size (M) Model Download Link PicoDet_layout_1x 86.8 7.4M Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is PaddleOCR's self-built layout analysis dataset, containing 10,000 images.

"},{"location":"en/support_list/model_list_xpu.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size (M) Model Download Link DLinear 0.382 0.394 72K Inference Model/Trained Model NLinear 0.386 0.392 40K Inference Model/Trained Model RLinear 0.384 0.392 40K Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html","title":"PaddleX Model List\uff08CPU/GPU\uff09","text":"

PaddleX incorporates multiple pipelines, each containing several modules, and each module includes various models. You can choose which models to use based on the benchmark data below. If you prioritize model accuracy, select models with higher accuracy. If you prioritize inference speed, choose models with faster inference. If you prioritize model storage size, select models with smaller storage sizes.

"},{"location":"en/support_list/models_list.html#image-classification-module","title":"Image Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_224 85.36 13.1957 285.493 306.5 M CLIP_vit_base_patch16_224.yaml Inference Model/Trained Model CLIP_vit_large_patch14_224 88.1 51.1284 1131.28 1.04 G CLIP_vit_large_patch14_224.yaml Inference Model/Trained Model ConvNeXt_base_224 83.84 12.8473 1513.87 313.9 M ConvNeXt_base_224.yaml Inference Model/Trained Model ConvNeXt_base_384 84.90 31.7607 3967.05 313.9 M ConvNeXt_base_384.yaml Inference Model/Trained Model ConvNeXt_large_224 84.26 26.8103 2463.56 700.7 M ConvNeXt_large_224.yaml Inference Model/Trained Model ConvNeXt_large_384 85.27 66.4058 6598.92 700.7 M ConvNeXt_large_384.yaml Inference Model/Trained Model ConvNeXt_small 83.13 9.74075 1127.6 178.0 M ConvNeXt_small.yaml Inference Model/Trained Model ConvNeXt_tiny 82.03 5.48923 672.559 101.4 M ConvNeXt_tiny.yaml Inference Model/Trained Model FasterNet-L 83.5 23.4415 - 357.1 M FasterNet-L.yaml Inference Model/Trained Model FasterNet-M 83.0 21.8936 - 204.6 M FasterNet-M.yaml Inference Model/Trained Model FasterNet-S 81.3 13.0409 - 119.3 M FasterNet-S.yaml Inference Model/Trained Model FasterNet-T0 71.9 12.2432 - 15.1 M FasterNet-T0.yaml Inference Model/Trained Model FasterNet-T1 75.9 11.3562 - 29.2 M FasterNet-T1.yaml Inference Model/Trained Model FasterNet-T2 79.1 10.703 - 57.4 M FasterNet-T2.yaml Inference Model/Trained Model MobileNetV1_x0_5 63.5 1.86754 7.48297 4.8 M MobileNetV1_x0_5.yaml Inference Model/Trained Model MobileNetV1_x0_25 51.4 1.83478 4.83674 1.8 M MobileNetV1_x0_25.yaml Inference Model/Trained Model MobileNetV1_x0_75 68.8 2.57903 10.6343 9.3 M MobileNetV1_x0_75.yaml Inference Model/Trained Model MobileNetV1_x1_0 71.0 2.78781 13.98 15.2 M MobileNetV1_x1_0.yaml Inference Model/Trained Model MobileNetV2_x0_5 65.0 4.94234 11.1629 7.1 M MobileNetV2_x0_5.yaml Inference Model/Trained Model MobileNetV2_x0_25 53.2 4.50856 9.40991 5.5 M MobileNetV2_x0_25.yaml Inference Model/Trained Model MobileNetV2_x1_0 72.2 6.12159 16.0442 12.6 M MobileNetV2_x1_0.yaml Inference Model/Trained Model MobileNetV2_x1_5 74.1 6.28385 22.5129 25.0 M MobileNetV2_x1_5.yaml Inference Model/Trained Model MobileNetV2_x2_0 75.2 6.12888 30.8612 41.2 M MobileNetV2_x2_0.yaml Inference Model/Trained Model MobileNetV3_large_x0_5 69.2 6.31302 14.5588 9.6 M MobileNetV3_large_x0_5.yaml Inference Model/Trained Model MobileNetV3_large_x0_35 64.3 5.76207 13.9041 7.5 M MobileNetV3_large_x0_35.yaml Inference Model/Trained Model MobileNetV3_large_x0_75 73.1 8.41737 16.9506 14.0 M MobileNetV3_large_x0_75.yaml Inference Model/Trained Model MobileNetV3_large_x1_0 75.3 8.64112 19.1614 19.5 M MobileNetV3_large_x1_0.yaml Inference Model/Trained Model MobileNetV3_large_x1_25 76.4 8.73358 22.1296 26.5 M MobileNetV3_large_x1_25.yaml Inference Model/Trained Model MobileNetV3_small_x0_5 59.2 5.16721 11.2688 6.8 M MobileNetV3_small_x0_5.yaml Inference Model/Trained Model MobileNetV3_small_x0_35 53.0 5.22053 11.0055 6.0 M MobileNetV3_small_x0_35.yaml Inference Model/Trained Model MobileNetV3_small_x0_75 66.0 5.39831 12.8313 8.5 M MobileNetV3_small_x0_75.yaml Inference Model/Trained Model MobileNetV3_small_x1_0 68.2 6.00993 12.9598 10.5 M MobileNetV3_small_x1_0.yaml Inference Model/Trained Model MobileNetV3_small_x1_25 70.7 6.9589 14.3995 13.0 M MobileNetV3_small_x1_25.yaml Inference Model/Trained Model MobileNetV4_conv_large 83.4 12.5485 51.6453 125.2 M MobileNetV4_conv_large.yaml Inference Model/Trained Model MobileNetV4_conv_medium 79.9 9.65509 26.6157 37.6 M MobileNetV4_conv_medium.yaml Inference Model/Trained Model MobileNetV4_conv_small 74.6 5.24172 11.0893 14.7 M MobileNetV4_conv_small.yaml Inference Model/Trained Model MobileNetV4_hybrid_large 83.8 20.0726 213.769 145.1 M MobileNetV4_hybrid_large.yaml Inference Model/Trained Model MobileNetV4_hybrid_medium 80.5 19.7543 62.2624 42.9 M MobileNetV4_hybrid_medium.yaml Inference Model/Trained Model PP-HGNet_base 85.0 14.2969 327.114 249.4 M PP-HGNet_base.yaml Inference Model/Trained Model PP-HGNet_small 81.51 5.50661 119.041 86.5 M PP-HGNet_small.yaml Inference Model/Trained Model PP-HGNet_tiny 79.83 5.22006 69.396 52.4 M PP-HGNet_tiny.yaml Inference Model/Trained Model PP-HGNetV2-B0 77.77 6.53694 23.352 21.4 M PP-HGNetV2-B0.yaml Inference Model/Trained Model PP-HGNetV2-B1 79.18 6.56034 27.3099 22.6 M PP-HGNetV2-B1.yaml Inference Model/Trained Model PP-HGNetV2-B2 81.74 9.60494 43.1219 39.9 M PP-HGNetV2-B2.yaml Inference Model/Trained Model PP-HGNetV2-B3 82.98 11.0042 55.1367 57.9 M PP-HGNetV2-B3.yaml Inference Model/Trained Model PP-HGNetV2-B4 83.57 9.66407 54.2462 70.4 M PP-HGNetV2-B4.yaml Inference Model/Trained Model PP-HGNetV2-B5 84.75 15.7091 115.926 140.8 M PP-HGNetV2-B5.yaml Inference Model/Trained Model PP-HGNetV2-B6 86.30 21.226 255.279 268.4 M PP-HGNetV2-B6.yaml Inference Model/Trained Model PP-LCNet_x0_5 63.14 3.67722 6.66857 6.7 M PP-LCNet_x0_5.yaml Inference Model/Trained Model PP-LCNet_x0_25 51.86 2.65341 5.81357 5.5 M PP-LCNet_x0_25.yaml Inference Model/Trained Model PP-LCNet_x0_35 58.09 2.7212 6.28944 5.9 M PP-LCNet_x0_35.yaml Inference Model/Trained Model PP-LCNet_x0_75 68.18 3.91032 8.06953 8.4 M PP-LCNet_x0_75.yaml Inference Model/Trained Model PP-LCNet_x1_0 71.32 3.84845 9.23735 10.5 M PP-LCNet_x1_0.yaml Inference Model/Trained Model PP-LCNet_x1_5 73.71 3.97666 12.3457 16.0 M PP-LCNet_x1_5.yaml Inference Model/Trained Model PP-LCNet_x2_0 75.18 4.07556 16.2752 23.2 M PP-LCNet_x2_0.yaml Inference Model/Trained Model PP-LCNet_x2_5 76.60 4.06028 21.5063 32.1 M PP-LCNet_x2_5.yaml Inference Model/Trained Model PP-LCNetV2_base 77.05 5.23428 19.6005 23.7 M PP-LCNetV2_base.yaml Inference Model/Trained Model PP-LCNetV2_large 78.51 6.78335 30.4378 37.3 M PP-LCNetV2_large.yaml Inference Model/Trained Model PP-LCNetV2_small 73.97 3.89762 13.0273 14.6 M PP-LCNetV2_small.yaml Inference Model/Trained Model ResNet18_vd 72.3 3.53048 31.3014 41.5 M ResNet18_vd.yaml Inference Model/Trained Model ResNet18 71.0 2.4868 27.4601 41.5 M ResNet18.yaml Inference Model/Trained Model ResNet34_vd 76.0 5.60675 56.0653 77.3 M ResNet34_vd.yaml Inference Model/Trained Model ResNet34 74.6 4.16902 51.925 77.3 M ResNet34.yaml Inference Model/Trained Model ResNet50_vd 79.1 10.1885 68.446 90.8 M ResNet50_vd.yaml Inference Model/Trained Model ResNet50 76.5 9.62383 64.8135 90.8 M ResNet50.yaml Inference Model/Trained Model ResNet101_vd 80.2 20.0563 124.85 158.4 M ResNet101_vd.yaml Inference Model/Trained Model ResNet101 77.6 19.2297 121.006 158.7 M ResNet101.yaml Inference Model/Trained Model ResNet152_vd 80.6 29.6439 181.678 214.3 M ResNet152_vd.yaml Inference Model/Trained Model ResNet152 78.3 30.0461 177.707 214.2 M ResNet152.yaml Inference Model/Trained Model ResNet200_vd 80.9 39.1628 235.185 266.0 M ResNet200_vd.yaml Inference Model/Trained Model StarNet-S1 73.6 9.895 23.0465 11.2 M StarNet-S1.yaml Inference Model/Trained Model StarNet-S2 74.8 7.91279 21.9571 14.3 M StarNet-S2.yaml Inference Model/Trained Model StarNet-S3 77.0 10.7531 30.7656 22.2 M StarNet-S3.yaml Inference Model/Trained Model StarNet-S4 79.0 15.2868 43.2497 28.9 M StarNet-S4.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window7_224 83.37 16.9848 383.83 310.5 M SwinTransformer_base_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_base_patch4_window12_384 84.17 37.2855 1178.63 311.4 M SwinTransformer_base_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window7_224 86.19 27.5498 689.729 694.8 M SwinTransformer_large_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_large_patch4_window12_384 87.06 74.1768 2105.22 696.1 M SwinTransformer_large_patch4_window12_384.yaml Inference Model/Trained Model SwinTransformer_small_patch4_window7_224 83.21 16.3982 285.56 175.6 M SwinTransformer_small_patch4_window7_224.yaml Inference Model/Trained Model SwinTransformer_tiny_patch4_window7_224 81.10 8.54846 156.306 100.1 M SwinTransformer_tiny_patch4_window7_224.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on the ImageNet-1k validation set.

"},{"location":"en/support_list/models_list.html#image-multi-label-classification-module","title":"Image Multi-Label Classification Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link CLIP_vit_base_patch16_448_ML 89.15 - - 325.6 M CLIP_vit_base_patch16_448_ML.yaml Inference Model/Trained Model PP-HGNetV2-B0_ML 80.98 - - 39.6 M PP-HGNetV2-B0_ML.yaml Inference Model/Trained Model PP-HGNetV2-B4_ML 87.96 - - 88.5 M PP-HGNetV2-B4_ML.yaml Inference Model/Trained Model PP-HGNetV2-B6_ML 91.25 - - 286.5 M PP-HGNetV2-B6_ML.yaml Inference Model/Trained Model PP-LCNet_x1_0_ML 77.96 - - 29.4 M PP-LCNet_x1_0_ML.yaml Inference Model/Trained Model ResNet50_ML 83.50 - - 108.9 M ResNet50_ML.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP for the multi-label classification task on COCO2017.

"},{"location":"en/support_list/models_list.html#pedestrian-attribute-module","title":"Pedestrian Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_pedestrian_attribute 92.2 3.84845 9.23735 6.7 M PP-LCNet_x1_0_pedestrian_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#vehicle-attribute-module","title":"Vehicle Attribute Module","text":"Model Name mA (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_vehicle_attribute 91.7 3.84845 9.23735 6.7 M PP-LCNet_x1_0_vehicle_attribute.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mA on the VeRi dataset.

"},{"location":"en/support_list/models_list.html#image-feature-module","title":"Image Feature Module","text":"Model Name recall@1 (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_rec 84.2 5.23428 19.6005 16.3 M PP-ShiTuV2_rec.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_base 88.69 13.1957 285.493 306.6 M PP-ShiTuV2_rec_CLIP_vit_base.yaml Inference Model/Trained Model PP-ShiTuV2_rec_CLIP_vit_large 91.03 51.1284 1131.28 1.05 G PP-ShiTuV2_rec_CLIP_vit_large.yaml Inference Model/Trained Model

Note: The above accuracy metrics are recall@1 on AliProducts.

"},{"location":"en/support_list/models_list.html#document-orientation-classification-module","title":"Document Orientation Classification Module","text":"Model Name Top-1 Acc (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-LCNet_x1_0_doc_ori 99.26 3.84845 9.23735 7.1 M PP-LCNet_x1_0_doc_ori.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Top-1 Acc on PaddleX's internal self-built dataset.

"},{"location":"en/support_list/models_list.html#face-feature-module","title":"Face Feature Module","text":"Model Name Output Feature Dimension Acc (%)AgeDB-30/CFP-FP/LFW GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link MobileFaceNet 128 96.28/96.71/99.58 4.1 MobileFaceNet.yaml Inference Model/Trained Model ResNet50_face 512 98.12/98.56/99.77 87.2 ResNet50_face.yaml Inference Model/Trained Model

Note: The above accuracy metrics are Accuracy scores measured on the AgeDB-30, CFP-FP, and LFW datasets, respectively.

"},{"location":"en/support_list/models_list.html#main-body-detection-module","title":"Main Body Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-ShiTuV2_det 41.5 33.7426 537.003 27.6 M PP-ShiTuV2_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PaddleClas main body detection dataset.

"},{"location":"en/support_list/models_list.html#object-detection-module","title":"Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Cascade-FasterRCNN-ResNet50-FPN 41.1 - - 245.4 M Cascade-FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN 45.0 - - 246.2 M Cascade-FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model CenterNet-DLA-34 37.6 - - 75.4 M CenterNet-DLA-34.yaml Inference Model/Trained Model CenterNet-ResNet50 38.9 - - 319.7 M CenterNet-ResNet50.yaml Inference Model/Trained Model DETR-R50 42.3 59.2132 5334.52 159.3 M DETR-R50.yaml Inference Model/Trained Model FasterRCNN-ResNet34-FPN 37.8 - - 137.5 M FasterRCNN-ResNet34-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-FPN 38.4 - - 148.1 M FasterRCNN-ResNet50-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-FPN 39.5 - - 148.1 M FasterRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50-vd-SSLDv2-FPN 41.4 - - 148.1 M FasterRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet50 36.7 - - 120.2 M FasterRCNN-ResNet50.yaml Inference Model/Trained Model FasterRCNN-ResNet101-FPN 41.4 - - 216.3 M FasterRCNN-ResNet101-FPN.yaml Inference Model/Trained Model FasterRCNN-ResNet101 39.0 - - 188.1 M FasterRCNN-ResNet101.yaml Inference Model/Trained Model FasterRCNN-ResNeXt101-vd-FPN 43.4 - - 360.6 M FasterRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model FasterRCNN-Swin-Tiny-FPN 42.6 - - 159.8 M FasterRCNN-Swin-Tiny-FPN.yaml Inference Model/Trained Model FCOS-ResNet50 39.6 103.367 3424.91 124.2 M FCOS-ResNet50.yaml Inference Model/Trained Model PicoDet-L 42.6 16.6715 169.904 20.9 M PicoDet-L.yaml Inference Model/Trained Model PicoDet-M 37.5 16.2311 71.7257 16.8 M PicoDet-M.yaml Inference Model/Trained Model PicoDet-S 29.1 14.097 37.6563 4.4 M PicoDet-S.yaml Inference Model/Trained Model PicoDet-XS 26.2 13.8102 48.3139 5.7M PicoDet-XS.yaml Inference Model/Trained Model PP-YOLOE_plus-L 52.9 33.5644 814.825 185.3 M PP-YOLOE_plus-L.yaml Inference Model/Trained Model PP-YOLOE_plus-M 49.8 19.843 449.261 83.2 M PP-YOLOE_plus-M.yaml Inference Model/Trained Model PP-YOLOE_plus-S 43.7 16.8884 223.059 28.3 M PP-YOLOE_plus-S.yaml Inference Model/Trained Model PP-YOLOE_plus-X 54.7 57.8995 1439.93 349.4 M PP-YOLOE_plus-X.yaml Inference Model/Trained Model RT-DETR-H 56.3 114.814 3933.39 435.8 M RT-DETR-H.yaml Inference Model/Trained Model RT-DETR-L 53.0 34.5252 1454.27 113.7 M RT-DETR-L.yaml Inference Model/Trained Model RT-DETR-R18 46.5 19.89 784.824 70.7 M RT-DETR-R18.yaml Inference Model/Trained Model RT-DETR-R50 53.1 41.9327 1625.95 149.1 M RT-DETR-R50.yaml Inference Model/Trained Model RT-DETR-X 54.8 61.8042 2246.64 232.9 M RT-DETR-X.yaml Inference Model/Trained Model YOLOv3-DarkNet53 39.1 40.1055 883.041 219.7 M YOLOv3-DarkNet53.yaml Inference Model/Trained Model YOLOv3-MobileNetV3 31.4 18.6692 267.214 83.8 M YOLOv3-MobileNetV3.yaml Inference Model/Trained Model YOLOv3-ResNet50_vd_DCN 40.6 31.6276 856.047 163.0 M YOLOv3-ResNet50_vd_DCN.yaml Inference Model/Trained Model YOLOX-L 50.1 185.691 1250.58 192.5 M YOLOX-L.yaml Inference Model/Trained Model YOLOX-M 46.9 123.324 688.071 90.0 M YOLOX-M.yaml Inference Model/Trained Model YOLOX-N 26.1 79.1665 155.59 3.4 M YOLOX-N.yaml Inference Model/Trained Model YOLOX-S 40.4 184.828 474.446 32.0 M YOLOX-S.yaml Inference Model/Trained Model YOLOX-T 32.9 102.748 212.52 18.1 M YOLOX-T.yaml Inference Model/Trained Model YOLOX-X 51.8 227.361 2067.84 351.5 M YOLOX-X.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the COCO2017 validation set.

"},{"location":"en/support_list/models_list.html#small-object-detection-module","title":"Small Object Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE_plus_SOD-S 25.1 65.4608 324.37 77.3 M PP-YOLOE_plus_SOD-S.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-L 31.9 57.1448 1006.98 325.0 M PP-YOLOE_plus_SOD-L.yaml Inference Model/Trained Model PP-YOLOE_plus_SOD-largesize-L 42.7 458.521 11172.7 340.5 M PP-YOLOE_plus_SOD-largesize-L.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the VisDrone-DET validation set.

"},{"location":"en/support_list/models_list.html#pedestrian-detection-module","title":"Pedestrian Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_human 48.0 32.7754 777.691 196.1 M PP-YOLOE-L_human.yaml Inference Model/Trained Model PP-YOLOE-S_human 42.5 15.0118 179.317 28.8 M PP-YOLOE-S_human.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the CrowdHuman validation set.

"},{"location":"en/support_list/models_list.html#vehicle-detection-module","title":"Vehicle Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-YOLOE-L_vehicle 63.9 32.5619 775.633 196.1 M PP-YOLOE-L_vehicle.yaml Inference Model/Trained Model PP-YOLOE-S_vehicle 61.3 15.3787 178.441 28.8 M PP-YOLOE-S_vehicle.yaml Inference Model/Trained Model

Note: The above accuracy metrics are mAP(0.5:0.95) on the PPVehicle validation set.

"},{"location":"en/support_list/models_list.html#face-detection-module","title":"Face Detection Module","text":"Model AP (%)Easy/Medium/Hard GPU Inference Time (ms) CPU Inference Time (ms) Model Size (M) YAML File Model Download Link BlazeFace 77.7/73.4/49.5 0.447 BlazeFace.yaml Inference Model/Trained Model BlazeFace-FPN-SSH 83.2/80.5/60.5 0.606 BlazeFace-FPN-SSH.yaml Inference Model/Trained Model PicoDet_LCNet_x2_5_face 93.7/90.7/68.1 28.9 PicoDet_LCNet_x2_5_face.yaml Inference Model/Trained Model PP-YOLOE_plus-S_face 93.9/91.8/79.8 26.5 PP-YOLOE_plus-S_face Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the WIDER-FACE validation set with an input size of 640*640.

"},{"location":"en/support_list/models_list.html#abnormality-detection-module","title":"Abnormality Detection Module","text":"Model Name Avg (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link STFPM 96.2 - - 21.5 M STFPM.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the MVTec AD dataset using the average anomaly score.

"},{"location":"en/support_list/models_list.html#semantic-segmentation-module","title":"Semantic Segmentation Module","text":"Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Deeplabv3_Plus-R50 80.36 61.0531 1513.58 94.9 M Deeplabv3_Plus-R50.yaml Inference Model/Trained Model Deeplabv3_Plus-R101 81.10 100.026 2460.71 162.5 M Deeplabv3_Plus-R101.yaml Inference Model/Trained Model Deeplabv3-R50 79.90 82.2631 1735.83 138.3 M Deeplabv3-R50.yaml Inference Model/Trained Model Deeplabv3-R101 80.85 121.492 2685.51 205.9 M Deeplabv3-R101.yaml Inference Model/Trained Model OCRNet_HRNet-W18 80.67 48.2335 906.385 43.1 M OCRNet_HRNet-W18.yaml Inference Model/Trained Model OCRNet_HRNet-W48 82.15 78.9976 2226.95 249.8 M OCRNet_HRNet-W48.yaml Inference Model/Trained Model PP-LiteSeg-T 73.10 7.6827 138.683 28.5 M PP-LiteSeg-T.yaml Inference Model/Trained Model PP-LiteSeg-B 75.25 10.9935 194.727 47.0 M PP-LiteSeg-B.yaml Inference Model/Trained Model SegFormer-B0 (slice) 76.73 11.1946 268.929 13.2 M SegFormer-B0.yaml Inference Model/Trained Model SegFormer-B1 (slice) 78.35 17.9998 403.393 48.5 M SegFormer-B1.yaml Inference Model/Trained Model SegFormer-B2 (slice) 81.60 48.0371 1248.52 96.9 M SegFormer-B2.yaml Inference Model/Trained Model SegFormer-B3 (slice) 82.47 64.341 1666.35 167.3 M SegFormer-B3.yaml Inference Model/Trained Model SegFormer-B4 (slice) 82.38 82.4336 1995.42 226.7 M SegFormer-B4.yaml Inference Model/Trained Model SegFormer-B5 (slice) 82.58 97.3717 2420.19 229.7 M SegFormer-B5.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the Cityscapes dataset using mIoU.

Model Name mIoU (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SeaFormer_base(slice) 40.92 24.4073 397.574 30.8 M SeaFormer_base.yaml Inference Model/Trained Model SeaFormer_large (slice) 43.66 27.8123 550.464 49.8 M SeaFormer_large.yaml Inference Model/Trained Model SeaFormer_small (slice) 38.73 19.2295 358.343 14.3 M SeaFormer_small.yaml Inference Model/Trained Model SeaFormer_tiny (slice) 34.58 13.9496 330.132 6.1 M SeaFormer_tiny.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on the ADE20k dataset. \"slice\" indicates that the input image has been cropped.

"},{"location":"en/support_list/models_list.html#instance-segmentation-module","title":"Instance Segmentation Module","text":"Model Name Mask AP GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link Mask-RT-DETR-H 50.6 132.693 4896.17 449.9 M Mask-RT-DETR-H.yaml Inference Model/Trained Model Mask-RT-DETR-L 45.7 46.5059 2575.92 113.6 M Mask-RT-DETR-L.yaml Inference Model/Trained Model Mask-RT-DETR-M 42.7 36.8329 - 66.6 M Mask-RT-DETR-M.yaml Inference Model/Trained Model Mask-RT-DETR-S 41.0 33.5007 - 51.8 M Mask-RT-DETR-S.yaml Inference Model/Trained Model Mask-RT-DETR-X 47.5 75.755 3358.04 237.5 M Mask-RT-DETR-X.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-FPN 36.3 - - 254.8 M Cascade-MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN 39.1 - - 254.7 M Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-FPN 35.6 - - 157.5 M MaskRCNN-ResNet50-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50-vd-FPN 36.4 - - 157.5 M MaskRCNN-ResNet50-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet50 32.8 - - 127.8 M MaskRCNN-ResNet50.yaml Inference Model/Trained Model MaskRCNN-ResNet101-FPN 36.6 - - 225.4 M MaskRCNN-ResNet101-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNet101-vd-FPN 38.1 - - 225.1 M MaskRCNN-ResNet101-vd-FPN.yaml Inference Model/Trained Model MaskRCNN-ResNeXt101-vd-FPN 39.5 - - 370.0 M MaskRCNN-ResNeXt101-vd-FPN.yaml Inference Model/Trained Model PP-YOLOE_seg-S 32.5 - - 31.5 M PP-YOLOE_seg-S.yaml Inference Model/Trained Model

|SOLOv2| 35.5|-|-|179.1 M|SOLOv2.yaml

Note: The above accuracy metrics are evaluated on the COCO2017 validation set using Mask AP(0.5:0.95).

"},{"location":"en/support_list/models_list.html#text-detection-module","title":"Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_det 77.79 10.6923 120.177 4.2 M PP-OCRv4_mobile_det.yaml Inference Model/Trained Model PP-OCRv4_server_det 82.69 83.3501 2434.01 100.1M PP-OCRv4_server_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 500 images for detection.

"},{"location":"en/support_list/models_list.html#seal-text-detection-module","title":"Seal Text Detection Module","text":"Model Name Detection Hmean (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_seal_det 96.47 10.5878 131.813 4.7 M PP-OCRv4_mobile_seal_det.yaml Inference Model/Trained Model PP-OCRv4_server_seal_det 98.21 84.341 2425.06 108.3 M PP-OCRv4_server_seal_det.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built seal dataset by PaddleX, containing 500 seal images.

"},{"location":"en/support_list/models_list.html#text-recognition-module","title":"Text Recognition Module","text":"Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PP-OCRv4_mobile_rec 78.20 7.95018 46.7868 10.6 M PP-OCRv4_mobile_rec.yaml Inference Model/Trained Model PP-OCRv4_server_rec 79.20 7.19439 140.179 71.2 M PP-OCRv4_server_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built Chinese dataset by PaddleOCR, covering street scenes, web images, documents, and handwritten texts, with 11,000 images for text recognition.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_SVTRv2_rec 68.81 8.36801 165.706 73.9 M ch_SVTRv2_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition A-Rank.

Model Name Recognition Avg Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link ch_RepSVTR_rec 65.07 10.5047 51.5647 22.1 M ch_RepSVTR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition B-Rank.

"},{"location":"en/support_list/models_list.html#formula-recognition-module","title":"Formula Recognition Module","text":"Model Name BLEU Score Normed Edit Distance ExpRate (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link LaTeX_OCR_rec 0.8821 0.0823 40.01 - - 89.7 M LaTeX_OCR_rec.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the LaTeX-OCR formula recognition test set.

"},{"location":"en/support_list/models_list.html#table-structure-recognition-module","title":"Table Structure Recognition Module","text":"Model Name Accuracy (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link SLANet 59.52 522.536 1845.37 6.9 M SLANet.yaml Inference Model/Trained Model SLANet_plus 63.69 522.536 1845.37 6.9 M SLANet_plus.yaml Inference Model/Trained Model

Note: The above accuracy metrics are evaluated on a self-built English table recognition dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#image-rectification-module","title":"Image Rectification Module","text":"Model Name MS-SSIM (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link UVDoc 54.40 - - 30.3 M UVDoc.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on a self-built image rectification dataset by PaddleX.

"},{"location":"en/support_list/models_list.html#layout-detection-module","title":"Layout Detection Module","text":"Model Name mAP (%) GPU Inference Time (ms) CPU Inference Time (ms) Model Size YAML File Model Download Link PicoDet_layout_1x 86.8 13.036 91.2634 7.4 M PicoDet_layout_1x.yaml Inference Model/Trained Model PicoDet-S_layout_3cls 87.1 13.521 45.7633 4.8 M PicoDet-S_layout_3cls.yaml Inference Model/Trained Model PicoDet-S_layout_17cls 70.3 13.5632 46.2059 4.8 M PicoDet-S_layout_17cls.yaml Inference Model/Trained Model PicoDet-L_layout_3cls 89.3 15.7425 159.771 22.6 M PicoDet-L_layout_3cls.yaml Inference Model/Trained Model PicoDet-L_layout_17cls 79.9 17.1901 160.262 22.6 M PicoDet-L_layout_17cls.yaml Inference Model/Trained Model RT-DETR-H_layout_3cls 95.9 114.644 3832.62 470.1 M RT-DETR-H_layout_3cls.yaml Inference Model/Trained Model RT-DETR-H_layout_17cls 92.6 115.126 3827.25 470.2 M RT-DETR-H_layout_17cls.yaml Inference Model/Trained Model

Note: The evaluation set for the above accuracy metrics is the PaddleX self-built Layout Detection Dataset, containing 10,000 images.

"},{"location":"en/support_list/models_list.html#time-series-forecasting-module","title":"Time Series Forecasting Module","text":"Model Name mse mae Model Size YAML File Model Download Link DLinear 0.382 0.394 72 K DLinear.yaml Inference Model/Trained Model NLinear 0.386 0.392 40 K NLinear.yaml Inference Model/Trained Model Nonstationary 0.600 0.515 55.5 M Nonstationary.yaml Inference Model/Trained Model PatchTST 0.385 0.397 2.0 M PatchTST.yaml Inference Model/Trained Model RLinear 0.384 0.392 40 K RLinear.yaml Inference Model/Trained Model TiDE 0.405 0.412 31.7 M TiDE.yaml Inference Model/Trained Model TimesNet 0.417 0.431 4.9 M TimesNet.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the ETTH1 dataset (evaluation results on the test set test.csv).

"},{"location":"en/support_list/models_list.html#time-series-anomaly-detection-module","title":"Time Series Anomaly Detection Module","text":"Model Name Precision Recall f1_score Model Size YAML File Model Download Link AutoEncoder_ad 99.36 84.36 91.25 52 K AutoEncoder_ad.yaml Inference Model/Trained Model DLinear_ad 98.98 93.96 96.41 112 K DLinear_ad.yaml Inference Model/Trained Model Nonstationary_ad 98.55 88.95 93.51 1.8 M Nonstationary_ad.yaml Inference Model/Trained Model PatchTST_ad 98.78 90.70 94.57 320 K PatchTST_ad.yaml Inference Model/Trained Model TimesNet_ad 98.37 94.80 96.56 1.3 M TimesNet_ad.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the PSM dataset.

"},{"location":"en/support_list/models_list.html#time-series-classification-module","title":"Time Series Classification Module","text":"Model Name acc (%) Model Size YAML File Model Download Link TimesNet_cls 87.5 792 K TimesNet_cls.yaml Inference Model/Trained Model

Note: The above accuracy metrics are measured on the UWaveGestureLibrary dataset.

>Note: All GPU inference times for the above models are based on an NVIDIA Tesla T4 machine with FP32 precision. CPU inference speeds are based on an Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz with 8 threads and FP32 precision.

"},{"location":"en/support_list/pipelines_list.html","title":"PaddleX Pipelines (CPU/GPU)","text":""},{"location":"en/support_list/pipelines_list.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
Document Scene Information Extraction v3 Table Structure Recognition Online Experience Document Image Scene Information Extraction v3 (PP-ChatOCRv3-doc) is a PaddlePaddle-specific intelligent document and image analysis solution that integrates LLM and OCR technologies to solve common complex document information extraction challenges such as layout analysis, rare characters, multi-page PDFs, tables, and seal recognition. By integrating the Wenxin large model, it combines vast data and knowledge, providing high accuracy and wide applicability. The open-source version supports local experience and deployment, and fine-tuning training for each module.
  • Construction of knowledge graphs
  • Detection of information related to specific events in online news and social media
  • Extraction and analysis of key information in academic literature (especially in scenarios requiring recognition of seals, distorted images, and more complex tables)
Layout Area Detection Text Detection Text Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
Multi-label Image Classification Multi-label Image Classification None Image multi-label classification is a technology that assigns an image to multiple related categories simultaneously. It is widely used in image tagging, content recommendation, and social media analysis. It can identify multiple objects or features present in an image, such as both \"dog\" and \"outdoor\" labels in a single picture. By using deep learning models, image multi-label classification can automatically extract image features and perform accurate classification to provide more comprehensive information for users. This technology is significant in applications like intelligent search engines and automatic content generation.
  • Medical image diagnosis
  • Complex scene recognition
  • Multi-target monitoring
  • Product attribute recognition
  • Ecological environment monitoring
  • Security monitoring
  • Disaster warning
Small Object Detection Small Object Detection None Small object detection is a technology specifically for identifying small objects in images. It is widely used in surveillance, autonomous driving, and satellite image analysis. It can accurately find and classify small-sized objects like pedestrians, traffic signs, or small animals in complex scenes. By using deep learning algorithms and optimized convolutional neural networks, small object detection can effectively enhance the recognition ability of small objects, ensuring that important information is not missed in practical applications. This technology plays an important role in improving safety and automation levels.
  • Pedestrian detection in autonomous vehicles
  • Identification of small buildings in satellite images
  • Detection of small traffic signs in intelligent transportation systems
  • Identification of small intruding objects in security surveillance
  • Detection of small defects in industrial inspection
  • Monitoring of small animals in drone images
Image Anomaly Detection Image Anomaly Detection None Image anomaly detection is a technology that identifies images that deviate from or do not conform to normal patterns by analyzing their content. It is widely used in industrial quality inspection, medical image analysis, and security surveillance. By using machine learning and deep learning algorithms, image anomaly detection can automatically identify potential defects, anomalies, or abnormal behavior in images, helping us detect problems and take appropriate measures promptly. Image anomaly detection systems are designed to automatically detect and label abnormal situations in images to improve work efficiency and accuracy.
  • Industrial quality control
  • Medical image analysis
  • Anomaly detection in surveillance videos
  • Identification of violations in traffic monitoring
  • Obstacle detection in autonomous driving
  • Agricultural pest and disease monitoring
  • Pollutant identification in environmental monitoring
Layout Parsing Table Structure Recognition None Layout analysis is a technology for extracting structured information from document images, primarily used to convert complex document layouts into machine-readable data formats. This technology has wide applications in document management, information extraction, and data digitization. By combining optical character recognition (OCR), image processing, and machine learning algorithms, layout analysis can identify and extract text blocks, titles, paragraphs, images, tables, and other layout elements from documents. This process typically includes three main steps: layout analysis, element analysis, and data formatting, ultimately generating structured document data that enhances data processing efficiency and accuracy.
  • Financial and legal document analysis
  • Digitization of historical documents and archives
  • Automated form filling
  • Page structure analysis
Layout Area Detection Text Detection Text Recognition Formula Recognition Seal Text Detection Text Image Correction Document Image Orientation Classification Formula Recognition Layout Area Detection None Formula recognition is a technology that automatically identifies and extracts LaTeX formula content and its structure from documents or images. It is widely used in document editing and data analysis in fields such as mathematics, physics, and computer science. By using computer vision and machine learning algorithms, formula recognition can convert complex mathematical formula information into an editable LaTeX format, facilitating further data processing and analysis by users.
  • Document digitization and retrieval
  • Formula search engine
  • Formula editor
  • Automated typesetting
Formula Recognition Seal Text Recognition Layout Area Detection None Seal text recognition is a technology that automatically extracts and recognizes seal content from documents or images. Recognizing seal text is part of document processing and has applications in many scenarios, such as contract comparison, inventory audit, and invoice reimbursement audit.
  • Contract and agreement validation
  • Check processing
  • Loan approval
  • Legal document management
Seal Text Detection Text Recognition"},{"location":"en/support_list/pipelines_list.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience Link Pipeline Introduction Applicable Scenarios Semi-supervised Learning for Large Models - Image Classification Semi-supervised Learning for Large Models - Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The general image classification pipeline is designed to solve image classification tasks for given images.
  • Commodity image classification
  • Artwork style classification
  • Crop disease and pest identification
  • Animal species recognition
  • Classification of land, water bodies, and buildings in satellite remote sensing images
Semi-supervised Learning for Large Models - Object Detection Semi-supervised Learning for Large Models - Object Detection Online Experience The semi-supervised learning for large models - object detection pipeline is a unique offering from PaddlePaddle. It utilizes a joint training approach with large and small models, leveraging a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below demonstrates the performance of this pipeline on the COCO dataset with 10% labeled data. After training with this pipeline, on COCO 10% labeled data + 90% unlabeled data, the large model (RT-DETR-H) achieves an 8.4% higher accuracy (47.7% -> 56.1%), setting a new state-of-the-art (SOTA) for this dataset. The small model (PicoDet-S) also achieves over 10% higher accuracy (18.3% -> 28.8%) compared to direct training.
  • Pedestrian, vehicle, and traffic sign detection in autonomous driving
  • Enemy facility and equipment detection in military reconnaissance
  • Seabed organism detection in deep-sea exploration
Semi-supervised Learning for Large Models - OCR Text Detection Online Experience The semi-supervised learning for large models - OCR pipeline is a unique OCR training pipeline from PaddlePaddle. It consists of a text detection model and a text recognition model working in series. The input image is first processed by the text detection model to obtain and rectify all text line bounding boxes, which are then fed into the text recognition model to generate OCR text results. In the text recognition part, a joint training approach with large and small models is adopted, utilizing a small amount of labeled data and a large amount of unlabeled data to enhance model accuracy, significantly reducing the costs of manual model iteration and data annotation. The figure below shows the effects of this pipeline in two OCR application scenarios, demonstrating significant improvements for both large and small models in different contexts.
  • Digitizing paper documents
  • Reading and verifying personal information on IDs, passports, and driver's licenses
  • Recognizing product information in retail
Large Model Semi-supervised Learning - Text Recognition General Scene Information Extraction v2 Text Detection Online Experience The General Scene Information Extraction Pipeline (PP-ChatOCRv2-common) is a unique intelligent analysis solution for complex documents from PaddlePaddle. It combines Large Language Models (LLMs) and OCR technology, leveraging the Wenxin Large Model to integrate massive data and knowledge, achieving high accuracy and wide applicability. The system flow of PP-ChatOCRv2-common is as follows: Input the prediction image, send it to the general OCR system, predict text through text detection and text recognition models, perform vector retrieval between the predicted text and user queries to obtain relevant text information, and finally pass these text information to the prompt generator to recombine them into prompts for the Wenxin Large Model to generate prediction results.
  • Key information extraction from various scenarios such as ID cards, bank cards, household registration books, train tickets, and paper invoices
Text Recognition"},{"location":"en/support_list/pipelines_list_dcu.html","title":"PaddleX Pipelines (DCU)","text":""},{"location":"en/support_list/pipelines_list_dcu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
"},{"location":"en/support_list/pipelines_list_dcu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_mlu.html","title":"PaddleX Pipelines (MLU)","text":""},{"location":"en/support_list/pipelines_list_mlu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis.
  • Stock prediction
  • Climate forecasting
  • Disease spread prediction
  • Energy demand forecasting
  • Traffic flow prediction
  • Product lifecycle prediction
  • Electric load forecasting
"},{"location":"en/support_list/pipelines_list_mlu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_npu.html","title":"PaddleX Pipelines (NPU)","text":""},{"location":"en/support_list/pipelines_list_npu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General Instance Segmentation Instance Segmentation Online Experience Instance segmentation is a computer vision task that identifies object categories in images and distinguishes the pixels of different instances within the same category, enabling precise segmentation of each object. Instance segmentation can separately mark each car, person, or animal in an image, ensuring they are processed independently at the pixel level. For example, in a street scene image with multiple cars and pedestrians, instance segmentation can clearly separate the contours of each car and person, forming multiple independent region labels. This technology is widely used in autonomous driving, video surveillance, and robot vision, often relying on deep learning models (e.g., Mask R-CNN) that use CNNs for efficient pixel classification and instance differentiation, providing powerful support for understanding complex scenes.
  • Crowd counting in malls
  • Counting crops or fruits in agricultural intelligence
  • Selecting and segmenting specific objects in image editing
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition General Table Recognition Layout Detection Online Experience Table recognition is a technology that automatically identifies and extracts table content and its structure from documents or images. It is widely used in data entry, information retrieval, and document analysis. By leveraging computer vision and machine learning algorithms, table recognition can convert complex table information into editable formats, facilitating further data processing and analysis by users
  • Processing of bank statements
  • recognition and extraction of various indicators in medical reports
  • extraction of tabular information from contracts
Table Structure Recognition Text Detection Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
Time Series Anomaly Detection Time Series Anomaly Detection Module Online Experience Time series anomaly detection is a technique that identifies abnormal patterns or behaviors in time series data. It is widely used in network security, device monitoring, and financial fraud detection. By analyzing normal trends and patterns in historical data, it discovers events that significantly differ from expected behaviors, such as sudden increases in network traffic or unusual transaction activities. Time series anomaly detection often employs statistical methods or machine learning algorithms (like Isolation Forest, LSTM, etc.), which can automatically identify anomalies in data, providing real-time alerts to enterprises and organizations to help promptly address potential risks and issues. This technology plays a vital role in ensuring system stability and security
  • Financial fraud detection
  • network intrusion detection
  • equipment failure detection
  • industrial production anomaly detection
  • stock market anomaly detection
  • power system anomaly detection
Time Series Classification Time Series Classification Module Online Experience Time series classification is a technique that categorizes time series data into predefined classes. It is widely applied in behavior recognition, speech recognition, and financial trend analysis. By analyzing features that vary over time, it identifies different patterns or events, such as classifying a speech signal as \"greeting\" or \"request\" or dividing stock price movements into \"rising\" or \"falling.\" Time series classification typically utilizes machine learning and deep learning models, effectively capturing time dependencies and variation patterns to provide accurate classification labels for data. This technology plays a key role in intelligent monitoring, voice assistants, and market forecasting applications
  • Electrocardiogram Classification
  • Stock Market Behavior Classification
  • Electroencephalogram Classification
  • Emotion Classification
  • Traffic Condition Classification
  • Network Traffic Classification
  • Equipment Operating Condition Classification
"},{"location":"en/support_list/pipelines_list_npu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"},{"location":"en/support_list/pipelines_list_xpu.html","title":"PaddleX Pipelines (XPU)","text":""},{"location":"en/support_list/pipelines_list_xpu.html#1-basic-pipelines","title":"1. Basic Pipelines","text":"Pipeline Name Pipeline Modules Baidu AIStudio Community Experience URL Pipeline Introduction Applicable Scenarios General Image Classification Image Classification Online Experience Image classification is a technique that assigns images to predefined categories. It is widely used in object recognition, scene understanding, and automatic annotation. Image classification can identify various objects such as animals, plants, traffic signs, etc., and categorize them based on their features. By leveraging deep learning models, image classification can automatically extract image features and perform accurate classification. The General Image Classification Pipeline is designed to solve image classification tasks for given images.
  • Automatic classification and recognition of product images
  • Real-time monitoring of defective products on production lines
  • Personnel recognition in security surveillance
General Object Detection Object Detection Online Experience Object detection aims to identify the categories and locations of multiple objects in images or videos by generating bounding boxes to mark these objects. Unlike simple image classification, object detection not only recognizes what objects are in the image, such as people, cars, and animals, but also accurately determines the specific location of each object, usually represented by a rectangular box. This technology is widely used in autonomous driving, surveillance systems, and smart photo albums, relying on deep learning models (e.g., YOLO, Faster R-CNN) that efficiently extract features and perform real-time detection, significantly enhancing the computer's ability to understand image content.
  • Tracking moving objects in video surveillance
  • Vehicle detection in autonomous driving
  • Defect detection in industrial manufacturing
  • Shelf product detection in retail
General Semantic Segmentation Semantic Segmentation Online Experience Semantic segmentation is a computer vision technique that assigns each pixel in an image to a specific category, enabling detailed understanding of image content. Semantic segmentation not only identifies the types of objects in an image but also classifies each pixel, allowing entire regions of the same category to be marked. For example, in a street scene image, semantic segmentation can distinguish pedestrians, cars, sky, and roads at the pixel level, forming a detailed label map. This technology is widely used in autonomous driving, medical image analysis, and human-computer interaction, often relying on deep learning models (e.g., FCN, U-Net) that use Convolutional Neural Networks (CNNs) to extract features and achieve high-precision pixel-level classification, providing a foundation for further intelligent analysis.
  • Analysis of satellite images in Geographic Information Systems
  • Segmentation of obstacles and passable areas in robot vision
  • Separation of foreground and background in film production
General OCR Text Detection Online Experience OCR (Optical Character Recognition) is a technology that converts text in images into editable text. It is widely used in document digitization, information extraction, and data processing. OCR can recognize printed text, handwritten text, and even certain types of fonts and symbols. The General OCR Pipeline is designed to solve text recognition tasks, extracting text information from images and outputting it in text form. PP-OCRv4 is an end-to-end OCR system that achieves millisecond-level text content prediction on CPUs, achieving state-of-the-art (SOTA) performance in general scenarios. Based on this project, developers from academia, industry, and research have quickly implemented various OCR applications covering general, manufacturing, finance, transportation.
  • Document digitization
  • Information extraction
  • Data processing
Text Recognition Time Series Forecasting Time Series Forecasting Module Online Experience Time series forecasting is a technique that utilizes historical data to predict future trends by analyzing patterns in time series data. It is widely applied in financial markets, weather forecasting, and sales prediction. Time series forecasting typically employs statistical methods or deep learning models (such as LSTM, ARIMA, etc.), which can handle time dependencies in data to provide accurate predictions, assisting decision-makers in better planning and response. This technology plays a crucial role in many industries, including energy management, supply chain optimization, and market analysis
  • Stock prediction
  • climate forecasting
  • disease spread prediction
  • energy demand forecasting
  • traffic flow prediction
  • product lifecycle prediction
  • electric load forecasting
"},{"location":"en/support_list/pipelines_list_xpu.html#2-featured-pipelines","title":"2. Featured Pipelines","text":"

Not supported yet, please stay tuned!

"}]} \ No newline at end of file diff --git a/main/sitemap.xml b/main/sitemap.xml index 606911a50c..5811be5de8 100644 --- a/main/sitemap.xml +++ b/main/sitemap.xml @@ -329,6 +329,20 @@ + + https://paddlepaddle.github.io/PaddleX/main/other_devices_support/how_to_contribute_device.html + 2024-11-21 + daily + + + + + https://paddlepaddle.github.io/PaddleX/main/other_devices_support/how_to_contribute_model.html + 2024-11-21 + daily + + + https://paddlepaddle.github.io/PaddleX/main/other_devices_support/multi_devices_use_guide.html 2024-11-21 @@ -1064,6 +1078,20 @@ + + https://paddlepaddle.github.io/PaddleX/main/en/other_devices_support/how_to_contribute_device.html + 2024-11-21 + daily + + + + + https://paddlepaddle.github.io/PaddleX/main/en/other_devices_support/how_to_contribute_model.html + 2024-11-21 + daily + + + https://paddlepaddle.github.io/PaddleX/main/en/other_devices_support/multi_devices_use_guide.html 2024-11-21 diff --git a/main/sitemap.xml.gz b/main/sitemap.xml.gz index 467c3bc66065d70792c0aeb59eebf2656ae813fb..57a7945e5d195b4efa133e3ab58f711df5bc7293 100644 GIT binary patch literal 4071 zcmV3k6BrP_8?}!mO61gFVEIG90{q@TaNtPIXj7ZLz!!zwgV@q=QzVkjAj>$8JuYcJ^ z;j??5W)739;e|VjzVaDaN;=>|)bLC5!{JdH{ zJUm=yf#eZOvgdK*YTUtb6D>Pz*)-6~>%SOvo4yX*4rd%Y@u z_T+D3nT%rZ?ahmufB*RM<&QTni%;xdd-{~?GqL5Hl>hzKV?p@%dUf*3)5j{sKZk+% z_AKRvF&0Xm3MTp0Ge6~2KfnI2_IMI6 zGKUEfOD2mGX0~$gonrj+kY}qPVq5OGMI>3U3Eb)fiw<&>S-7+($%8~l~ z{6QInR--sL=#>V8LB=B{WZ>Fyn&@_m1BhXL8mWlg^e9BKb;zBRyYW^8^pF^~YLEwY zaZoVu-N__n2^IaGvEZSmQX?lah{{E68u08%)yZp2#1RW0sjf4|**8efG{FWzqWo*i z2=9myGV`m=kg82w%#H;Nf!NvwPt!PJa=N6>hfQ@ICJZY*XWuORo^78i$ose|Iy9wu z`UB4X9XhFYx-*pSpq}|su4f7-&)Ak%BGTNg=aV%Tt{<`V+oE$;^#_;qrHUZ3c4M&# zwobxQ78PsLv{+}vQMB-hd!$_qBq#|q1IEdc!Wuf7o^c}5r4oXZ;vF73$)ogR;k^6u zfhZcSHZjo9D@+prGM8~0u<-06JFQDnWBnRJVuV6SHa5)V)_~Ds784ac^1zXxP(?Mu zDmonW)>93O@bicXYbJ;`x0sOV(+5cfx#HUimND@GSct1C#*Pz-$)emT>fm{Z@=yjL zTl3Jy`J>-GK4#SPf>K1T%zKJwRKx(5d=INBKemoNd#-wP7{)}%fJ8_?obfBOnVqxf5c0TGc zjf#|EnUJX5b3bs4kJxx(8upF}9CfuO__1Y{Y4?kf6GL;$>DC%AcAX&FI>lRubD{-T z=thiyaegLf1|@0}r%@g<>L)1`%cz(c5(x@P$R6XI_`-M4FDg8G6@s#naTYq~TRy4d z(PbGGAwwcTA*pwa*L9b9%56H^3|U77jjC8!c&wUSu+J-Krj$}geFHof4=hcVzK3>- zXMBY8sf6dmrt?jkUwnKRJG0o;8)Vi&FisJcJ|QFJ(Z5oMx@XAznvD}hrGLmw_R+JX zzn4fXeV!H*;Cm-eNIi2prTDT32mKooL_Ih5=5cbs%aLK#2JC%kB`>C zaIlIJhNd_pFns!A4GagXC}C)dGXle%Juuv1hT%>d3`vmi!e9B@N)pD8EADL%UoSfO zAzyGYt18i#sUK{8C*f&XcvS5W48(?~TrB(|!G$)>C9Wt;9{?Fo%Sndfzv~uj=7R1K zqaob-3gwB0dmhFKf#37h9U6#QS(CQJ&$`?l-@Er}EU>JyWogCv8 z84lX}Pc~GXZF4!iw{K=frBr5uWn*-V5eW^+mJ6P;a9`kM7cKqXv0CUmSqoUOeIfRO+Cfdfy3`n`uC4%bPtK_=b%{T-&K~fYA4i&lHc2j+$!w0a(oth$2 zjbkQQ#zqQI(-<`|q??+}I0V=rGSu8mO&q-jXH$J+!w0g_nW7?k&CVtpM@J20(=#*MzebXk|Mh6I7|1?EG`;J`+OS7f#)*bH{9VR^* z!3n84c3C!`w0cHINv}$9PUXuhhPz0>2H9ORM&^xvia>%*LTz9@x5ikbGcPONXCmZ1%tzd zMLZnbVnw2>K_zU24xv2D%;SDVp}P{vt{YJe3>k3>aNYgbh%E=w6qmm7ZgXaEMF7ltrf!5 zTjr$o#5ehyW zFeuhr8R0ccuTjHPs7TX~L9v>4T)(^$O&o(xqvkOfl%^Mh);$(Z8Z(bB5vrce!f~le zy_`sL)e)DNG)sa6tZHaKJf(^SWrxN?hp9AZKlb5nG{vmXyctiqRn2_)?)xGaOU+EK zs^@4_Upk(fFFM;HUvRmqD$$>56w=J};LCibO(ps>6$#Bu55CN2+Ek)H(;d-FcW5%* z0cM(2UlR-T#FWW2TV!a8@>rBfEX@{Qh63$T0+K1MC2xl}6xl*8eH%w5wfybyh9h5~ zWpLxDq?W=R-f-j#v?OjEbw@bg9jbiwEsxh>yj=ytkELk^D4wpv&KeWC#lYy4Ca(uZg#@t}@R(!{6C$n)OsYPJMF4q-`>_(ElN{w2 zDDO$yfT`GUCi9fj$Kli{8V=e-!2y8yIS+b3nDGG*^8*3+OoxGSib9J{7Ey@wOc8}B zP7_GGq-$YerpD;AqX5(eePDDjKWRY=4s$+YVRj}UpQ_L{PUWVDgBGm)8t0>8*sUof z)Rh79z;~y6<*Wgt-!=+D)FkRf<+NSeQP=|dcg{!6xDhY~&@{DXSt9<6%n18fDKhrU z&X6#CojBq6ncjjE1|I!gH>-QqnPg#DNjm#x`8VPFjDg*lR}rBv(9@rB_V17iw$q@A zfCt6Q8gxBn?7R7vM@w_Jo>RgX1i6k|2LQ=}O|BFaMDxOv5f~B*rM@aLDhDr*t6w~kMYvEt(0h(R!m&;-HIP?gW) z%|m9v*-FJV9&CmbLUYo5R=5R_v|7ePNUuC-JgVn+pKl|zfRHZNcpw>42+c{o7rn08 z%u{aJX=lhi9&S{Xg7ahB6oYzp!8EayQtG?qxp-h{LSSF+6x+xk>62FXUMZI+QC zV)7JYUGI@u$H6Q}i29I>RA|LTJiI+g<`;|sDnk89W*Pz9IDzykiKWleVkW!~+~Sb? zhsdn__`#8}_`SH~}4oKlWG8=S`fL~tm)=a;iDqd7(BE}uO>Q2hz(Sc z)g_whd$AOo=gl|@2w758Y=SF_t@Nf^$3+lqOFcDF)OyoQaE%HUxV|)MdZ;&0n{gCS zab&KMnwmb6&D5q^M@0~DQ#D0VBpa(u_Kpi2;09}Isz^6kn`;PAab&33TBo=`RFx7{ z7bd=wDXX7&|0LLp-MpMBoy_H;DyL}qJXzFc93ImcYOn%>Xt^=^N#*C;zsSnfn5Jr~ZY-o(a#McPK;UQ0_^tV2iG+IV%s2}8 z(E{nQlT??E+_LZPQQCL&=JCD7^K-ddC{D&JGsuI(g%G)or!MS(uq*zLEiBE$tNZ1mHb_K-B z8Pq5bfOTh~P6KC@>w=vFDSM!fIJTr55_xvC!OQGMxnZoc$*hpYibt11H| z)+i(!>%p4gSer6HVigJ5SP#|=$J&$u66=m`tUDaB?qFlhs;}u~dg9Aipe-8orFpFB zq!(z5H4~Zk$bgEK+#0RYVU)@J|! literal 3996 zcmV;N4`c8jiwFn+cs^$W|8r?{Wo=<_E_iKh0PUSykK0BPh2Qfli~;=Ukv+Q)ao{*G zCWvFev7KN8%p1`|wj{233)viN_SY{jl15^9X_4%zVs-rB(dc5H)8})uMHY*1e%gh> zvj>@GejNRH_3HZN)iW8nvFAsdAFuxW&o3{&zxwIzcW?4E$fSB!ygAB#yxJ<2{IFVm z`}XZR^OX!ml3mB?W|g_y;+Jf-e{%Km`t?=)nICpr6$WRY{PwTvGp}C1e!Z$*y?XoI zv*J&=t@=^*TM)Z%%THy+#}eUrfvo?&-uP;p-(UOj>Pz*+-6|A*wDKcQ?yk#!@6D?G z?8(0*G8M+&+nbj+|97$C;Z^?&FbWtr?*v#e+c~O z>$6lA#zdfG8VMz@o^4aP4n#SA|J&BT)xIxxaJ9O0i!vIqMcKB^H>+a~6BD`p_1&lU zA3wiebSP&g;Bsl*?0nJu^6vLVr*hB_7f5r9^JVc@?z>-|Oo>!2I+LakxNN$%JYPnh zP{I*W6f2>M9cH$2ADm+R^FU@RKNK73xJ4wHzxLhg4T}zPlv%j6C&`0EVl9QrQ^}l# zQ}{ZbBI;<}*U4TOu?J>Vu&o3~bp)v^%9iL%%i{65{*+N>@3a zRK*X@Aha5#!9lMy7z{EQib(mc9lMEcw={ql)@P84*iDZ@l(-M1lS((6s=N5hTuE zTSj;%j1bOOn;})}xR@Oa82o5s7d%blgvsfWIv+OGahM>e^ql>&@N>3(t{~6j>gX_( z=IIBV{VRM@?R1Bf?x3FeQm$tTC(p!2RwB~et>=?_8M)g~q+b`Ev#vk5q%Tzjk+mB~ zYk%V;A{Ak=Hcg9lMjVCMD0Qo*kHc7kO}d;k{W>WZ;rM}k?DJ4GEl4`CiC zKM?mauyOwAcTbNQJ-wh5u`BbQ;+YgNfF<9QaYANF*76*6p}zZ#yRta@1S2&c=Rd+Wh0X!aLzCJ z#|Wm1F;i3EkDzGA$tyUbH*)81ytIw@#$#lpg4)#O5bULiB3lsf7Y;Cb{-q{-5+ zp`GHH9wB`y;W@Esf79ld9v^6X7Q1?b%sL3@6jA9DGEyG@BXy*EhRm-SohUB-LuRs1 zo+b0WL}Im-X)ysl_-?ViEKia+RjaB*^!RL^NoSM$-m(k6FLw%u$9Qd~NoZ@4;rx92 zCqoo^tzxsFB@P9K-#%Ic!@(*^7@FcxVEFXK8W;{%Ny5++hXTW$Juuu+hT+Z_42hq} z!e3eIk_7SNN_v~a<3%Sw0r5eW^+Mn*Cf!M>8i zE?WA%Q^Q72Ei^y18eZiT)16aeM@K6TIgF|$CfcUS3`kwXC4%bHtL)lV%{T-!LDCcr z4i&p5R#SbG!w0aLm7XG29U>-JrbY@-cL+T(th*P@I0V!nLh53qCyrkyqp7~B;RD&x zNK+BNu11rMlcNT*yOEwGz8#L{@=pySj7~?L%KWIRe5ksh$el_>eVgbfwO;JzAE7&rjj8YE4$O%4#aMoF52 z_N{pmk!DN3EN{GHa+vgJ1Sh0w&12bo((0KUCA})aIjOtxSO!YFX>z3W%LG8>^s?d; zS!_F5%svnVkeVu;1ZFmzY9BQUivSGwg!`~QE*&mr9D+q~WxmrzQXL<1%PyBkU4NS{ zkFPBop3AKQLNZ<)77UJzEaKtdmMRiWeP*esug0s6I4;qWsKJ>y+)C#(2-^ygJL!9xZCnbG;<6(jpAc4D9tPe zt=CvMX)HXxMCf|Ph2v6{W;s#psv|BjiA#b4tZHcAJg15UZHMTg!&DlyZ~JgInq$^y z-q2HSRWo0{`@YD_v+Eijb(;d@HcVsf%0cM(2kC_E}VhS_O78!=3JQig#OS8onQlLFbKr-dED?VkINjJj6OpVcJM**k{`oQQ=zSDvc9Ok^m!t6{y-c_M( zoXU$H4qB-8Yn+dYVYgUF=qm%{LGDhkm9qwne%mAn(UWKvmD6@{|c*MI}Kt4JSb+?pzA4P-_5t&TAI7{#BwhqcN>cI>(ZmvwFngUrE-Ac zcH?O6Z_2x&h_G0#rp2-&4#VZo;3FNQ!=R-Ojg6BPhE0GpZ4;!VOCk^|^(AV_quR!i z^X|(BzI3!YMF*l+l{p5^?lOA#8p7^q)mY0IRE&@ZjK^BI(k3=q{E`8qM;iteOlq%2 zxTQse@hYrg9oswjvS$ipZB?9RaQLH2#{gtBDKIQvAkMgifuB~0AIPFAt)^G`(xjZ zsmC`RScWwM)AAs&;-HIP?h)N%>!Y<-b%+c9c+daLUYo*SGWa`v|6S^NUuC-JgWP5pI=65 z0U=$k=|D215So+vTJ*YRGf$;uyPYBTbhyz~3eJyhQw-_Zh0?@QN~zD5=g~KjCJe62 zono69Bz+Q5P_b;s(`K0%BAB}v>w1sOIu5uX5$Z!SQlS+G@#yv>nO`sks2KGpnP~)Q z;{?*HBvxCQ7Bk_4?-rZf-$Z6rm6sl$%`@q2a^G8gz4+y3fe0Bd3;>3<797scw}0}a zq1P=c4qD2vc=+w3O*|aj(&M4242y?PUu@#x;FcZ_O=Va-+*!rL9a$dkO!9EJ?O-7# z3F60<^frgbOAmj@8c@=@GK|K$^*385k!e|xP+e8zM{AkN;t{u$2b>~>uBpl>1I2gL za<*amzq`d9Qr106%;Z}ir8trCAcHvJ@%>-lBy`%^f=q^f);jC>+U>^=_3O;i*Kv!3 z!6nMzdEnE{Zj4<@L_qYlYX~_jia*|Eyl#)g=mh!%*EoQTQHa3FMn*Cf!M^yzI$-+k zlOjh?Dgr{aAa>;!)6J8@M@J|cJiMwaCORjG4OAV)C7SAUu^jtj%{U4KS<+OD!4=1D zSyQdkA_%r?mYyhX?I$Lj^zQ+fNmCTd z-bs_a(*g&$hmxKu)_s)b8Uj)rA@x)06z4}(r9{YG|W3HD+)FK0?8b7fSO zQ?$IFEow6k4>pDdtiT{zUi}Vn9+g0J3jZX|+uYlwOG#sMI}w>|>?fH!WEDHNwzxdbRS2GR|!> zW*-Y|s;26uLYgHfF*{x)wOUt2ss zm%D}HWV|v&9vm6jg~Y)yNh+G+jDt~M+gBZy<~&1m*+hh3NRs*JbEPH7=NN&Fz5PP2dP;C=d8=ZIL_o~I7UR}0(BT{WZSC9NP51o4U$gl zv}hTWX&xK5Y|y5hz%Q0x8SnK=uUAYkbaa7`P^_;VcUvB+=1)SWS7Z_fbr~n2^+F9N zjfKY=3SHZXd|WEgI4X)`Da9o|5n)iUB@pcjn3XqZo5al>tSq5@^M_N{OyfSYhZ}UO zlvyL*cV#XXpP4G}Um}C*q2syv(&HVn1{AHX43JpEfNiV?Ysj%SWq`yQC2V6oSVNAr zDFY|aok~#K*Vs1_~yd&PxiMV6IT>Z$Tdi#I)oci^KvjG5m C)}Imp diff --git a/main/support_list/model_list_dcu.html b/main/support_list/model_list_dcu.html index 8987125196..b96a2c4491 100644 --- a/main/support_list/model_list_dcu.html +++ b/main/support_list/model_list_dcu.html @@ -4409,7 +4409,7 @@

语义分割模块AmberC0209 + zhang-prog diff --git a/main/support_list/model_list_mlu.html b/main/support_list/model_list_mlu.html index 5bb53c3cd7..b07224069d 100644 --- a/main/support_list/model_list_mlu.html +++ b/main/support_list/model_list_mlu.html @@ -4728,7 +4728,7 @@

时序预测模块AmberC0209 + zhang-prog diff --git a/main/support_list/model_list_npu.html b/main/support_list/model_list_npu.html index dcc39265d5..94b64ccced 100644 --- a/main/support_list/model_list_npu.html +++ b/main/support_list/model_list_npu.html @@ -5703,7 +5703,7 @@

时序分类模块AmberC0209 + zhang-prog diff --git a/main/support_list/model_list_xpu.html b/main/support_list/model_list_xpu.html index 0f5862473e..81ffd3de89 100644 --- a/main/support_list/model_list_xpu.html +++ b/main/support_list/model_list_xpu.html @@ -4728,7 +4728,7 @@

时序预测模块AmberC0209 + zhang-prog diff --git a/main/support_list/models_list.html b/main/support_list/models_list.html index 5761b3b7bb..1cb97fa18a 100644 --- a/main/support_list/models_list.html +++ b/main/support_list/models_list.html @@ -6903,7 +6903,7 @@

AmberC0209 + zhang-prog diff --git a/main/support_list/pipelines_list.html b/main/support_list/pipelines_list.html index ca44da4619..5b60318ff0 100644 --- a/main/support_list/pipelines_list.html +++ b/main/support_list/pipelines_list.html @@ -4804,7 +4804,7 @@

2、特色产线AmberC0209 + zhang-prog diff --git a/main/support_list/pipelines_list_dcu.html b/main/support_list/pipelines_list_dcu.html index 4df58575c9..925bc3c0b3 100644 --- a/main/support_list/pipelines_list_dcu.html +++ b/main/support_list/pipelines_list_dcu.html @@ -4386,7 +4386,7 @@

2、特色产线AmberC0209 + zhang-prog diff --git a/main/support_list/pipelines_list_mlu.html b/main/support_list/pipelines_list_mlu.html index f2c7c6e818..6805aa3595 100644 --- a/main/support_list/pipelines_list_mlu.html +++ b/main/support_list/pipelines_list_mlu.html @@ -4434,7 +4434,7 @@

2、特色产线AmberC0209 + zhang-prog diff --git a/main/support_list/pipelines_list_npu.html b/main/support_list/pipelines_list_npu.html index ce97bb5471..eec73a4997 100644 --- a/main/support_list/pipelines_list_npu.html +++ b/main/support_list/pipelines_list_npu.html @@ -4502,7 +4502,7 @@

2、特色产线AmberC0209 + zhang-prog diff --git a/main/support_list/pipelines_list_xpu.html b/main/support_list/pipelines_list_xpu.html index 510e7a3995..9c434c35b4 100644 --- a/main/support_list/pipelines_list_xpu.html +++ b/main/support_list/pipelines_list_xpu.html @@ -4434,7 +4434,7 @@

2、特色产线AmberC0209 + zhang-prog